Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpenBoard
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lifo
Nicolas Ollinger
OpenBoard
Commits
869e4cdd
Commit
869e4cdd
authored
Jul 02, 2013
by
Claudio Valerio
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
hacked the frame bahaviour. To be removed
parent
a62dfe29
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
117 additions
and
139 deletions
+117
-139
UBBoardView.cpp
src/board/UBBoardView.cpp
+113
-137
UBGraphicsItemDelegate.cpp
src/domain/UBGraphicsItemDelegate.cpp
+1
-0
UBGraphicsTextItem.cpp
src/domain/UBGraphicsTextItem.cpp
+2
-1
UBGraphicsTextItemDelegate.cpp
src/domain/UBGraphicsTextItemDelegate.cpp
+1
-1
No files found.
src/board/UBBoardView.cpp
View file @
869e4cdd
...
@@ -989,16 +989,6 @@ void UBBoardView::mousePressEvent (QMouseEvent *event)
...
@@ -989,16 +989,6 @@ void UBBoardView::mousePressEvent (QMouseEvent *event)
if
(
!
movingItem
&&
!
mController
->
cacheIsVisible
())
if
(
!
movingItem
&&
!
mController
->
cacheIsVisible
())
mLongPressTimer
.
start
();
mLongPressTimer
.
start
();
if
(
!
movingItem
)
{
// Rubberband selection implementation
// if (!mUBRubberBand) {
// mUBRubberBand = new UBRubberBand(QRubberBand::Rectangle, this);
// }
// mUBRubberBand->setGeometry (QRect (mMouseDownPos, QSize ()));
// mUBRubberBand->show();
// scene()->updateMultipleSelectionFrame();
}
if
(
mUBRubberBand
)
{
if
(
mUBRubberBand
)
{
mUBRubberBand
->
hide
();
mUBRubberBand
->
hide
();
}
}
...
@@ -1131,7 +1121,6 @@ void UBBoardView::mouseMoveEvent (QMouseEvent *event)
...
@@ -1131,7 +1121,6 @@ void UBBoardView::mouseMoveEvent (QMouseEvent *event)
if
(
!
mUBRubberBand
)
{
if
(
!
mUBRubberBand
)
{
mUBRubberBand
=
new
UBRubberBand
(
QRubberBand
::
Rectangle
,
this
);
mUBRubberBand
=
new
UBRubberBand
(
QRubberBand
::
Rectangle
,
this
);
}
}
// mUBRubberBand->setGeometry (QRect (mMouseDownPos, QSize ()));
mUBRubberBand
->
setGeometry
(
bandRect
);
mUBRubberBand
->
setGeometry
(
bandRect
);
mUBRubberBand
->
show
();
mUBRubberBand
->
show
();
...
@@ -1209,112 +1198,18 @@ void UBBoardView::mouseReleaseEvent (QMouseEvent *event)
...
@@ -1209,112 +1198,18 @@ void UBBoardView::mouseReleaseEvent (QMouseEvent *event)
{
{
UBStylusTool
::
Enum
currentTool
=
(
UBStylusTool
::
Enum
)
UBDrawingController
::
drawingController
()
->
stylusTool
();
UBStylusTool
::
Enum
currentTool
=
(
UBStylusTool
::
Enum
)
UBDrawingController
::
drawingController
()
->
stylusTool
();
setToolCursor
(
currentTool
);
setToolCursor
(
currentTool
);
// first/ propagate device release to the scene
// first/ propagate device release to the scene
if
(
scene
())
if
(
scene
())
scene
()
->
inputDeviceRelease
();
scene
()
->
inputDeviceRelease
();
if
(
currentTool
==
UBStylusTool
::
Selector
)
if
(
currentTool
==
UBStylusTool
::
Selector
)
{
if
(
bIsDesktop
)
{
event
->
ignore
();
return
;
}
UBGraphicsItem
*
graphicsItem
=
dynamic_cast
<
UBGraphicsItem
*>
(
movingItem
);
if
(
graphicsItem
)
graphicsItem
->
Delegate
()
->
commitUndoStep
();
bool
bReleaseIsNeed
=
true
;
if
(
movingItem
!=
determineItemToPress
(
scene
()
->
itemAt
(
this
->
mapToScene
(
event
->
posF
().
toPoint
()))))
{
movingItem
=
NULL
;
bReleaseIsNeed
=
false
;
}
if
(
mWidgetMoved
)
{
mWidgetMoved
=
false
;
movingItem
=
NULL
;
}
else
if
(
movingItem
&&
(
!
isCppTool
(
movingItem
)
||
UBGraphicsCurtainItem
::
Type
==
movingItem
->
type
()))
{
if
(
suspendedMousePressEvent
)
{
QGraphicsView
::
mousePressEvent
(
suspendedMousePressEvent
);
// suspendedMousePressEvent is deleted by old Qt event loop
movingItem
=
NULL
;
delete
suspendedMousePressEvent
;
suspendedMousePressEvent
=
NULL
;
bReleaseIsNeed
=
true
;
}
else
{
if
(
isUBItem
(
movingItem
)
&&
DelegateButton
::
Type
!=
movingItem
->
type
()
&&
QGraphicsSvgItem
::
Type
!=
movingItem
->
type
()
&&
UBGraphicsDelegateFrame
::
Type
!=
movingItem
->
type
()
&&
UBGraphicsCache
::
Type
!=
movingItem
->
type
()
&&
QGraphicsWebView
::
Type
!=
movingItem
->
type
()
&&
// for W3C widgets as Tools.
!
(
!
isMultipleSelectionEnabled
()
&&
movingItem
->
parentItem
()
&&
UBGraphicsWidgetItem
::
Type
==
movingItem
->
type
()
&&
UBGraphicsGroupContainerItem
::
Type
==
movingItem
->
parentItem
()
->
type
()))
{
bReleaseIsNeed
=
false
;
if
(
movingItem
->
isSelected
()
&&
isMultipleSelectionEnabled
())
movingItem
->
setSelected
(
false
);
else
if
(
movingItem
->
parentItem
()
&&
movingItem
->
parentItem
()
->
isSelected
()
&&
isMultipleSelectionEnabled
())
movingItem
->
parentItem
()
->
setSelected
(
false
);
else
{
if
(
movingItem
->
isSelected
())
bReleaseIsNeed
=
true
;
movingItem
->
setSelected
(
true
);
}
}
}
}
else
bReleaseIsNeed
=
true
;
if
(
mUBRubberBand
&&
mUBRubberBand
->
isVisible
())
{
mUBRubberBand
->
hide
();
}
if
(
bReleaseIsNeed
)
{
QGraphicsView
::
mouseReleaseEvent
(
event
);
}
}
else
if
(
currentTool
==
UBStylusTool
::
Play
)
{
if
(
bIsDesktop
)
{
event
->
ignore
();
return
;
}
if
(
mWidgetMoved
)
{
movingItem
=
NULL
;
mWidgetMoved
=
false
;
}
else
{
if
(
suspendedMousePressEvent
)
{
QGraphicsView
::
mousePressEvent
(
suspendedMousePressEvent
);
// suspendedMousePressEvent is deleted by old Qt event loop
movingItem
=
NULL
;
delete
suspendedMousePressEvent
;
suspendedMousePressEvent
=
NULL
;
}
}
QGraphicsView
::
mouseReleaseEvent
(
event
);
}
else
if
(
currentTool
==
UBStylusTool
::
Text
)
{
{
if
(
mRubberBand
)
{
if
(
bIsDesktop
)
{
mRubberBand
->
hide
();
event
->
ignore
();
}
return
;
}
UBGraphicsItem
*
graphicsItem
=
dynamic_cast
<
UBGraphicsItem
*>
(
movingItem
);
UBGraphicsItem
*
graphicsItem
=
dynamic_cast
<
UBGraphicsItem
*>
(
movingItem
);
if
(
graphicsItem
)
if
(
graphicsItem
)
graphicsItem
->
Delegate
()
->
commitUndoStep
();
graphicsItem
->
Delegate
()
->
commitUndoStep
();
...
@@ -1325,7 +1220,6 @@ void UBBoardView::mouseReleaseEvent (QMouseEvent *event)
...
@@ -1325,7 +1220,6 @@ void UBBoardView::mouseReleaseEvent (QMouseEvent *event)
movingItem
=
NULL
;
movingItem
=
NULL
;
bReleaseIsNeed
=
false
;
bReleaseIsNeed
=
false
;
}
}
if
(
mWidgetMoved
)
if
(
mWidgetMoved
)
{
{
mWidgetMoved
=
false
;
mWidgetMoved
=
false
;
...
@@ -1381,18 +1275,22 @@ void UBBoardView::mouseReleaseEvent (QMouseEvent *event)
...
@@ -1381,18 +1275,22 @@ void UBBoardView::mouseReleaseEvent (QMouseEvent *event)
QGraphicsView
::
mouseReleaseEvent
(
event
);
QGraphicsView
::
mouseReleaseEvent
(
event
);
}
}
}
}
else
if
(
currentTool
==
UBStylusTool
::
Play
)
{
else
if
(
currentTool
==
UBStylusTool
::
Play
)
{
if
(
bIsDesktop
)
{
if
(
bIsDesktop
)
{
event
->
ignore
();
event
->
ignore
();
return
;
return
;
}
}
if
(
mWidgetMoved
)
{
if
(
mWidgetMoved
)
{
movingItem
=
NULL
;
movingItem
=
NULL
;
mWidgetMoved
=
false
;
mWidgetMoved
=
false
;
}
}
else
{
else
if
(
suspendedMousePressEvent
)
{
{
if
(
suspendedMousePressEvent
)
{
QGraphicsView
::
mousePressEvent
(
suspendedMousePressEvent
);
// suspendedMousePressEvent is deleted by old Qt event loop
QGraphicsView
::
mousePressEvent
(
suspendedMousePressEvent
);
// suspendedMousePressEvent is deleted by old Qt event loop
movingItem
=
NULL
;
movingItem
=
NULL
;
delete
suspendedMousePressEvent
;
delete
suspendedMousePressEvent
;
...
@@ -1401,32 +1299,109 @@ void UBBoardView::mouseReleaseEvent (QMouseEvent *event)
...
@@ -1401,32 +1299,109 @@ void UBBoardView::mouseReleaseEvent (QMouseEvent *event)
}
}
QGraphicsView
::
mouseReleaseEvent
(
event
);
QGraphicsView
::
mouseReleaseEvent
(
event
);
}
}
else
if
(
currentTool
==
UBStylusTool
::
Text
)
{
else
if
(
currentTool
==
UBStylusTool
::
Text
)
if
(
mRubberBand
)
{
mRubberBand
->
hide
();
UBGraphicsItem
*
graphicsItem
=
dynamic_cast
<
UBGraphicsItem
*>
(
movingItem
);
if
(
graphicsItem
)
graphicsItem
->
Delegate
()
->
commitUndoStep
();
if
(
scene
()
&&
mRubberBand
&&
mIsCreatingTextZone
)
{
bool
bReleaseIsNeed
=
true
;
QRect
rubberRect
=
mRubberBand
->
geometry
();
if
(
movingItem
!=
determineItemToPress
(
scene
()
->
itemAt
(
this
->
mapToScene
(
event
->
posF
().
toPoint
()))))
{
movingItem
=
NULL
;
bReleaseIsNeed
=
false
;
}
UBGraphicsTextItem
*
textItem
=
scene
()
->
addTextHtml
(
""
,
mapToScene
(
rubberRect
.
topLeft
()));
if
(
mWidgetMoved
)
event
->
accept
();
{
mWidgetMoved
=
false
;
movingItem
=
NULL
;
if
(
scene
()
&&
mRubberBand
&&
mIsCreatingTextZone
)
{
QRect
rubberRect
=
mRubberBand
->
geometry
();
UBDrawingController
::
drawingController
()
->
setStylusTool
(
UBStylusTool
::
Selector
);
UBGraphicsTextItem
*
textItem
=
scene
()
->
addTextHtml
(
""
,
mapToScene
(
rubberRect
.
topLeft
()));
event
->
accept
();
UBDrawingController
::
drawingController
()
->
setStylusTool
(
UBStylusTool
::
Selector
);
textItem
->
setTextInteractionFlags
(
Qt
::
TextEditorInteraction
);
textItem
->
setTextInteractionFlags
(
Qt
::
TextEditorInteraction
);
textItem
->
setSelected
(
true
);
textItem
->
setSelected
(
true
);
textItem
->
setFocus
();
textItem
->
setFocus
();
}
}
else
if
(
movingItem
&&
(
!
isCppTool
(
movingItem
)
||
UBGraphicsCurtainItem
::
Type
==
movingItem
->
type
()))
{
if
(
suspendedMousePressEvent
)
{
QGraphicsView
::
mousePressEvent
(
suspendedMousePressEvent
);
// suspendedMousePressEvent is deleted by old Qt event loop
movingItem
=
NULL
;
delete
suspendedMousePressEvent
;
suspendedMousePressEvent
=
NULL
;
bReleaseIsNeed
=
true
;
}
else
{
if
(
isUBItem
(
movingItem
)
&&
DelegateButton
::
Type
!=
movingItem
->
type
()
&&
QGraphicsSvgItem
::
Type
!=
movingItem
->
type
()
&&
UBGraphicsDelegateFrame
::
Type
!=
movingItem
->
type
()
&&
UBGraphicsCache
::
Type
!=
movingItem
->
type
()
&&
QGraphicsWebView
::
Type
!=
movingItem
->
type
()
&&
// for W3C widgets as Tools.
!
(
!
isMultipleSelectionEnabled
()
&&
movingItem
->
parentItem
()
&&
UBGraphicsWidgetItem
::
Type
==
movingItem
->
type
()
&&
UBGraphicsGroupContainerItem
::
Type
==
movingItem
->
parentItem
()
->
type
()))
{
bReleaseIsNeed
=
false
;
if
(
movingItem
->
isSelected
()
&&
isMultipleSelectionEnabled
())
movingItem
->
setSelected
(
false
);
else
if
(
movingItem
->
parentItem
()
&&
movingItem
->
parentItem
()
->
isSelected
()
&&
isMultipleSelectionEnabled
())
movingItem
->
parentItem
()
->
setSelected
(
false
);
else
{
if
(
movingItem
->
isSelected
())
bReleaseIsNeed
=
true
;
movingItem
->
setSelected
(
true
);
}
}
}
}
}
else
else
bReleaseIsNeed
=
true
;
if
(
mUBRubberBand
&&
mUBRubberBand
->
isVisible
())
{
mUBRubberBand
->
hide
();
}
if
(
bReleaseIsNeed
)
{
QGraphicsView
::
mouseReleaseEvent
(
event
);
QGraphicsView
::
mouseReleaseEvent
(
event
);
}
}
else
if
(
currentTool
==
UBStylusTool
::
Play
)
{
if
(
bIsDesktop
)
{
event
->
ignore
();
return
;
}
mIsCreatingTextZone
=
false
;
if
(
mWidgetMoved
)
{
movingItem
=
NULL
;
mWidgetMoved
=
false
;
}
else
{
if
(
suspendedMousePressEvent
)
{
QGraphicsView
::
mousePressEvent
(
suspendedMousePressEvent
);
// suspendedMousePressEvent is deleted by old Qt event loop
movingItem
=
NULL
;
delete
suspendedMousePressEvent
;
suspendedMousePressEvent
=
NULL
;
}
}
QGraphicsView
::
mouseReleaseEvent
(
event
);
}
}
else
if
(
currentTool
==
UBStylusTool
::
Capture
)
else
if
(
currentTool
==
UBStylusTool
::
Capture
)
{
{
if
(
mRubberBand
)
{
if
(
mRubberBand
)
mRubberBand
->
hide
();
mRubberBand
->
hide
();
}
if
(
scene
()
&&
mRubberBand
&&
mIsCreatingSceneGrabZone
&&
mRubberBand
->
geometry
().
width
()
>
16
)
if
(
scene
()
&&
mRubberBand
&&
mIsCreatingSceneGrabZone
&&
mRubberBand
->
geometry
().
width
()
>
16
)
{
{
QRect
rect
=
mRubberBand
->
geometry
();
QRect
rect
=
mRubberBand
->
geometry
();
...
@@ -1558,7 +1533,8 @@ void UBBoardView::dropEvent (QDropEvent *event)
...
@@ -1558,7 +1533,8 @@ void UBBoardView::dropEvent (QDropEvent *event)
QGraphicsItem
*
onItem
=
itemAt
(
event
->
pos
().
x
(),
event
->
pos
().
y
());
QGraphicsItem
*
onItem
=
itemAt
(
event
->
pos
().
x
(),
event
->
pos
().
y
());
if
(
onItem
&&
onItem
->
type
()
==
UBGraphicsWidgetItem
::
Type
)
{
if
(
onItem
&&
onItem
->
type
()
==
UBGraphicsWidgetItem
::
Type
)
{
QGraphicsView
::
dropEvent
(
event
);
QGraphicsView
::
dropEvent
(
event
);
}
else
{
}
else
{
if
(
!
event
->
source
()
if
(
!
event
->
source
()
||
qobject_cast
<
UBThumbnailWidget
*>
(
event
->
source
())
||
qobject_cast
<
UBThumbnailWidget
*>
(
event
->
source
())
||
qobject_cast
<
QWebView
*>
(
event
->
source
())
||
qobject_cast
<
QWebView
*>
(
event
->
source
())
...
...
src/domain/UBGraphicsItemDelegate.cpp
View file @
869e4cdd
...
@@ -641,6 +641,7 @@ void UBGraphicsItemDelegate::onZoomChanged()
...
@@ -641,6 +641,7 @@ void UBGraphicsItemDelegate::onZoomChanged()
void
UBGraphicsItemDelegate
::
buildButtons
()
void
UBGraphicsItemDelegate
::
buildButtons
()
{
{
}
}
void
UBGraphicsItemDelegate
::
freeButtons
()
void
UBGraphicsItemDelegate
::
freeButtons
()
{
{
//Previously deleted with the frame
//Previously deleted with the frame
...
...
src/domain/UBGraphicsTextItem.cpp
View file @
869e4cdd
...
@@ -46,13 +46,14 @@ UBGraphicsTextItem::UBGraphicsTextItem(QGraphicsItem * parent) :
...
@@ -46,13 +46,14 @@ UBGraphicsTextItem::UBGraphicsTextItem(QGraphicsItem * parent) :
{
{
setDelegate
(
new
UBGraphicsTextItemDelegate
(
this
,
0
));
setDelegate
(
new
UBGraphicsTextItemDelegate
(
this
,
0
));
// TODO claudio remove this because in contrast with the fact the frame should be created on demand.
Delegate
()
->
createControls
();
Delegate
()
->
frame
()
->
setOperationMode
(
UBGraphicsDelegateFrame
::
Resizing
);
Delegate
()
->
frame
()
->
setOperationMode
(
UBGraphicsDelegateFrame
::
Resizing
);
Delegate
()
->
setUBFlag
(
GF_FLIPPABLE_ALL_AXIS
,
false
);
Delegate
()
->
setUBFlag
(
GF_FLIPPABLE_ALL_AXIS
,
false
);
Delegate
()
->
setUBFlag
(
GF_REVOLVABLE
,
true
);
Delegate
()
->
setUBFlag
(
GF_REVOLVABLE
,
true
);
mTypeTextHereLabel
=
tr
(
"<Type Text Here>"
);
mTypeTextHereLabel
=
tr
(
"<Type Text Here>"
);
setData
(
UBGraphicsItemData
::
ItemLayerType
,
UBItemLayerType
::
Object
);
setData
(
UBGraphicsItemData
::
ItemLayerType
,
UBItemLayerType
::
Object
);
setData
(
UBGraphicsItemData
::
itemLayerType
,
QVariant
(
itemLayerType
::
ObjectItem
));
//Necessary to set if we want z value to be assigned correctly
setData
(
UBGraphicsItemData
::
itemLayerType
,
QVariant
(
itemLayerType
::
ObjectItem
));
//Necessary to set if we want z value to be assigned correctly
...
...
src/domain/UBGraphicsTextItemDelegate.cpp
View file @
869e4cdd
...
@@ -42,7 +42,7 @@ const int UBGraphicsTextItemDelegate::sMinPixelSize = 8;
...
@@ -42,7 +42,7 @@ const int UBGraphicsTextItemDelegate::sMinPixelSize = 8;
const
int
UBGraphicsTextItemDelegate
::
sMinPointSize
=
8
;
const
int
UBGraphicsTextItemDelegate
::
sMinPointSize
=
8
;
UBGraphicsTextItemDelegate
::
UBGraphicsTextItemDelegate
(
UBGraphicsTextItem
*
pDelegated
,
QObject
*
)
UBGraphicsTextItemDelegate
::
UBGraphicsTextItemDelegate
(
UBGraphicsTextItem
*
pDelegated
,
QObject
*
)
:
UBGraphicsItemDelegate
(
pDelegated
,
0
,
GF_COMMON
|
GF_REVOLVABLE
)
:
UBGraphicsItemDelegate
(
pDelegated
,
0
,
GF_COMMON
|
GF_REVOLVABLE
|
GF_TOOLBAR_USED
)
,
mLastFontPixelSize
(
-
1
)
,
mLastFontPixelSize
(
-
1
)
,
delta
(
5
)
,
delta
(
5
)
{
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment