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
30b4a3f2
Commit
30b4a3f2
authored
Aug 29, 2012
by
Aleksei Kanash
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improved behavior of interacts with items on board.
parent
3a296792
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
5 deletions
+23
-5
UBBoardView.cpp
src/board/UBBoardView.cpp
+22
-5
UBBoardView.h
src/board/UBBoardView.h
+1
-0
No files found.
src/board/UBBoardView.cpp
View file @
30b4a3f2
...
@@ -55,6 +55,8 @@
...
@@ -55,6 +55,8 @@
#include "document/UBDocumentProxy.h"
#include "document/UBDocumentProxy.h"
#include "tools/UBGraphicsRuler.h"
#include "tools/UBGraphicsCurtainItem.h"
#include "tools/UBGraphicsCompass.h"
#include "tools/UBGraphicsCompass.h"
#include "tools/UBGraphicsCache.h"
#include "tools/UBGraphicsCache.h"
#include "tools/UBGraphicsTriangle.h"
#include "tools/UBGraphicsTriangle.h"
...
@@ -433,6 +435,15 @@ bool UBBoardView::itemHaveParentWithType(QGraphicsItem *item, int type)
...
@@ -433,6 +435,15 @@ bool UBBoardView::itemHaveParentWithType(QGraphicsItem *item, int type)
return
itemHaveParentWithType
(
item
->
parentItem
(),
type
);
return
itemHaveParentWithType
(
item
->
parentItem
(),
type
);
}
}
bool
UBBoardView
::
isUBItem
(
QGraphicsItem
*
item
)
{
if
((
UBGraphicsItemType
::
UserTypesCount
>
item
->
type
())
&&
(
item
->
type
()
>
QGraphicsItem
::
UserType
))
return
true
;
else
{
return
false
;
}
}
void
UBBoardView
::
handleItemsSelection
(
QGraphicsItem
*
item
)
void
UBBoardView
::
handleItemsSelection
(
QGraphicsItem
*
item
)
{
{
...
@@ -504,6 +515,13 @@ Here we determines cases when items should to get mouse press event at pressing
...
@@ -504,6 +515,13 @@ Here we determines cases when items should to get mouse press event at pressing
switch
(
item
->
type
())
switch
(
item
->
type
())
{
{
case
UBGraphicsProtractor
:
:
Type
:
case
UBGraphicsRuler
:
:
Type
:
case
UBGraphicsTriangle
:
:
Type
:
case
UBGraphicsCompass
:
:
Type
:
case
UBGraphicsCache
:
:
Type
:
return
true
;
case
UBGraphicsDelegateFrame
:
:
Type
:
case
UBGraphicsDelegateFrame
:
:
Type
:
case
QGraphicsSvgItem
:
:
Type
:
case
QGraphicsSvgItem
:
:
Type
:
return
true
;
return
true
;
...
@@ -550,10 +568,7 @@ Here we determines cases when items should to get mouse press event at pressing
...
@@ -550,10 +568,7 @@ Here we determines cases when items should to get mouse press event at pressing
break
;
break
;
}
}
if
((
UBGraphicsItemType
::
UserTypesCount
>
item
->
type
())
&&
(
item
->
type
()
>
QGraphicsItem
::
UserType
))
return
!
isUBItem
(
item
);
// standard behavior of QGraphicsScene for not UB items. UB items should be managed upper.
return
true
;
else
return
false
;
}
}
bool
UBBoardView
::
itemShouldReceiveSuspendedMousePressEvent
(
QGraphicsItem
*
item
)
bool
UBBoardView
::
itemShouldReceiveSuspendedMousePressEvent
(
QGraphicsItem
*
item
)
...
@@ -609,6 +624,7 @@ bool UBBoardView::itemShouldBeMoved(QGraphicsItem *item)
...
@@ -609,6 +624,7 @@ bool UBBoardView::itemShouldBeMoved(QGraphicsItem *item)
switch
(
item
->
type
())
switch
(
item
->
type
())
{
{
case
UBGraphicsCurtainItem
:
:
Type
:
case
UBGraphicsGroupContainerItem
:
:
Type
:
case
UBGraphicsGroupContainerItem
:
:
Type
:
return
true
;
return
true
;
...
@@ -1102,7 +1118,8 @@ UBBoardView::mouseReleaseEvent (QMouseEvent *event)
...
@@ -1102,7 +1118,8 @@ UBBoardView::mouseReleaseEvent (QMouseEvent *event)
}
}
else
else
{
{
if
(
QGraphicsSvgItem
::
Type
!=
movingItem
->
type
()
&&
if
(
isUBItem
(
movingItem
)
&&
QGraphicsSvgItem
::
Type
!=
movingItem
->
type
()
&&
UBGraphicsDelegateFrame
::
Type
!=
movingItem
->
type
()
&&
UBGraphicsDelegateFrame
::
Type
!=
movingItem
->
type
()
&&
UBToolWidget
::
Type
!=
movingItem
->
type
()
&&
UBToolWidget
::
Type
!=
movingItem
->
type
()
&&
UBGraphicsCache
::
Type
!=
movingItem
->
type
()
&&
UBGraphicsCache
::
Type
!=
movingItem
->
type
()
&&
...
...
src/board/UBBoardView.h
View file @
30b4a3f2
...
@@ -57,6 +57,7 @@ class UBBoardView : public QGraphicsView
...
@@ -57,6 +57,7 @@ class UBBoardView : public QGraphicsView
protected
:
protected
:
bool
itemIsLocked
(
QGraphicsItem
*
item
);
bool
itemIsLocked
(
QGraphicsItem
*
item
);
bool
isUBItem
(
QGraphicsItem
*
item
);
// we should to determine items who is not UB and use general scene behavior for them.
void
handleItemsSelection
(
QGraphicsItem
*
item
);
void
handleItemsSelection
(
QGraphicsItem
*
item
);
bool
itemShouldReceiveMousePressEvent
(
QGraphicsItem
*
item
);
bool
itemShouldReceiveMousePressEvent
(
QGraphicsItem
*
item
);
bool
itemShouldReceiveSuspendedMousePressEvent
(
QGraphicsItem
*
item
);
bool
itemShouldReceiveSuspendedMousePressEvent
(
QGraphicsItem
*
item
);
...
...
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