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
26ae8fb2
Commit
26ae8fb2
authored
Apr 18, 2012
by
Ivan Ilin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
System dependant rubberband created
parent
0bfa2983
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
29 additions
and
2 deletions
+29
-2
UBBoardView.cpp
src/board/UBBoardView.cpp
+20
-2
UBBoardView.h
src/board/UBBoardView.h
+3
-0
UBRubberBand.cpp
src/gui/UBRubberBand.cpp
+5
-0
UBRubberBand.h
src/gui/UBRubberBand.h
+1
-0
No files found.
src/board/UBBoardView.cpp
View file @
26ae8fb2
...
...
@@ -117,6 +117,7 @@ UBBoardView::init ()
mUsingTabletEraser
=
false
;
mIsCreatingTextZone
=
false
;
mRubberBand
=
0
;
mUBRubberBand
=
0
;
mVirtualKeyboardActive
=
false
;
...
...
@@ -414,10 +415,19 @@ void UBBoardView::mousePressEvent (QMouseEvent *event)
}
else
if
(
currentTool
==
UBStylusTool
::
Selector
)
{
QSet
<
QGraphicsItem
*>
existingTools
=
scene
()
->
tools
();
// QSet<QGraphicsItem*> existingTools = scene()->tools(); why do we need to get tools here?
movingItem
=
scene
()
->
itemAt
(
this
->
mapToScene
(
event
->
posF
().
toPoint
()));
if
(
!
movingItem
)
{
// Rubberband selection implementation
if
(
!
mUBRubberBand
)
{
mUBRubberBand
=
new
UBRubberBand
(
QRubberBand
::
Rectangle
,
this
);
}
mUBRubberBand
->
setGeometry
(
QRect
(
mMouseDownPos
,
QSize
()));
mUBRubberBand
->
show
();
}
if
(
!
movingItem
||
movingItem
->
isSelected
()
||
movingItem
->
type
()
==
UBGraphicsDelegateFrame
::
Type
...
...
@@ -443,6 +453,7 @@ void UBBoardView::mousePressEvent (QMouseEvent *event)
suspendedMousePressEvent
=
new
QMouseEvent
(
event
->
type
(),
event
->
pos
(),
event
->
button
(),
event
->
buttons
(),
event
->
modifiers
());
// удалить
}
event
->
accept
();
}
else
if
(
currentTool
==
UBStylusTool
::
Text
)
...
...
@@ -470,7 +481,6 @@ void UBBoardView::mousePressEvent (QMouseEvent *event)
if
(
!
mRubberBand
)
mRubberBand
=
new
UBRubberBand
(
QRubberBand
::
Rectangle
,
this
);
mRubberBand
->
setGeometry
(
QRect
(
mMouseDownPos
,
QSize
()));
mRubberBand
->
show
();
mIsCreatingTextZone
=
true
;
...
...
@@ -533,6 +543,10 @@ UBBoardView::mouseMoveEvent (QMouseEvent *event)
return
;
}
if
(
mUBRubberBand
&&
mUBRubberBand
->
isVisible
())
{
mUBRubberBand
->
setGeometry
(
QRect
(
mMouseDownPos
,
event
->
pos
()).
normalized
());
}
if
(
movingItem
&&
(
mMouseButtonIsPressed
||
mTabletStylusIsPressed
))
{
QPointF
scenePos
=
mapToScene
(
event
->
pos
());
...
...
@@ -598,6 +612,10 @@ UBBoardView::mouseReleaseEvent (QMouseEvent *event)
suspendedMousePressEvent
=
NULL
;
}
if
(
mUBRubberBand
&&
mUBRubberBand
->
isVisible
())
{
mUBRubberBand
->
hide
();
}
QGraphicsView
::
mouseReleaseEvent
(
event
);
}
else
if
(
currentTool
==
UBStylusTool
::
Text
)
...
...
src/board/UBBoardView.h
View file @
26ae8fb2
...
...
@@ -24,6 +24,7 @@ class UBBoardController;
class
UBAppleWidget
;
class
UBGraphicsScene
;
class
UBGraphicsWidgetItem
;
class
UBRubberBand
;
class
UBBoardView
:
public
QGraphicsView
{
...
...
@@ -123,6 +124,8 @@ class UBBoardView : public QGraphicsView
QGraphicsItem
*
movingItem
;
QMouseEvent
*
suspendedMousePressEvent
;
UBRubberBand
*
mUBRubberBand
;
private
slots
:
void
settingChanged
(
QVariant
newValue
);
...
...
src/gui/UBRubberBand.cpp
View file @
26ae8fb2
...
...
@@ -16,6 +16,8 @@
#include "UBRubberBand.h"
#include <QtGui>
#include <QtGui/QPlastiqueStyle>
#include <QStyleFactory>
#ifdef Q_WS_MAC
#include <QtGui/QMacStyle>
...
...
@@ -32,10 +34,13 @@ UBRubberBand::UBRubberBand(Shape s, QWidget * p)
customStyle
=
new
QWindowsXPStyle
();
#elif defined(Q_WS_MAC)
customStyle
=
new
QMacStyle
();
#elif defined(Q_WS_X11)
customStyle
=
QStyleFactory
::
create
(
"oxygen"
);
#endif
if
(
customStyle
)
QRubberBand
::
setStyle
(
customStyle
);
}
UBRubberBand
::~
UBRubberBand
()
...
...
src/gui/UBRubberBand.h
View file @
26ae8fb2
...
...
@@ -25,6 +25,7 @@ class UBRubberBand : public QRubberBand
public
:
UBRubberBand
(
Shape
s
,
QWidget
*
p
=
0
);
virtual
~
UBRubberBand
();
private
:
QStyle
*
customStyle
;
};
...
...
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