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
a6043930
Commit
a6043930
authored
May 02, 2012
by
Ivan Ilyin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Sankore smart button
parent
8be4c32b
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
95 additions
and
20 deletions
+95
-20
UB.h
src/core/UB.h
+2
-1
UBGraphicsPolygonItem.cpp
src/domain/UBGraphicsPolygonItem.cpp
+8
-8
UBGraphicsPolygonItem.h
src/domain/UBGraphicsPolygonItem.h
+1
-1
UBGraphicsScene.cpp
src/domain/UBGraphicsScene.cpp
+59
-7
UBGraphicsScene.h
src/domain/UBGraphicsScene.h
+2
-1
ubgraphicsgroupcontaineritem.cpp
src/domain/ubgraphicsgroupcontaineritem.cpp
+9
-0
ubgraphicsgroupcontaineritem.h
src/domain/ubgraphicsgroupcontaineritem.h
+8
-0
UBGraphicsCompass.cpp
src/tools/UBGraphicsCompass.cpp
+1
-0
UBGraphicsProtractor.cpp
src/tools/UBGraphicsProtractor.cpp
+1
-0
UBGraphicsProtractor.h
src/tools/UBGraphicsProtractor.h
+1
-1
UBGraphicsRuler.cpp
src/tools/UBGraphicsRuler.cpp
+2
-1
UBGraphicsTriangle.cpp
src/tools/UBGraphicsTriangle.cpp
+1
-0
No files found.
src/core/UB.h
View file @
a6043930
...
...
@@ -123,7 +123,8 @@ struct UBGraphicsItemType
StrokeItemType
,
TriangleItemType
,
MagnifierItemType
,
cacheItemType
cacheItemType
,
groupContainerType
};
};
...
...
src/domain/UBGraphicsPolygonItem.cpp
View file @
a6043930
...
...
@@ -184,18 +184,18 @@ void UBGraphicsPolygonItem::paint ( QPainter * painter, const QStyleOptionGraphi
QGraphicsPolygonItem
::
paint
(
painter
,
option
,
widget
);
}
QPainterPath
UBGraphicsPolygonItem
::
shape
()
const
{
//
QPainterPath UBGraphicsPolygonItem::shape() const
//
{
QPainterPath
path
;
path
.
addRect
(
boundingRect
());
//
QPainterPath path;
//
path.addRect(boundingRect());
return
path
;
//
return path;
// static QPainterPath shapePath = QGraphicsPolygonItem::shape();
//
//
static QPainterPath shapePath = QGraphicsPolygonItem::shape();
// return shapePath;
}
//
//
return shapePath;
//
}
UBGraphicsScene
*
UBGraphicsPolygonItem
::
scene
()
...
...
src/domain/UBGraphicsPolygonItem.h
View file @
a6043930
...
...
@@ -115,7 +115,7 @@ class UBGraphicsPolygonItem : public QGraphicsPolygonItem, public UBItem
protected
:
void
paint
(
QPainter
*
painter
,
const
QStyleOptionGraphicsItem
*
option
,
QWidget
*
widget
);
QPainterPath
shape
()
const
;
//
QPainterPath shape () const;
private
:
...
...
src/domain/UBGraphicsScene.cpp
View file @
a6043930
...
...
@@ -65,6 +65,9 @@
#include "core/memcheck.h"
const
QString
groupText
=
"Group items"
;
const
QString
ungroupText
=
"Ungroup items"
;
qreal
UBZLayerController
::
errorNumber
=
-
20000001.0
;
UBZLayerController
::
UBZLayerController
(
QGraphicsScene
*
scene
)
:
...
...
@@ -291,9 +294,9 @@ UBGraphicsScene::UBGraphicsScene(UBDocumentProxy* parent)
}
connect
(
this
,
SIGNAL
(
selectionChanged
()),
this
,
SLOT
(
selectionChangedProcessing
()));
connect
(
this
,
SIGNAL
(
selectionChanged
()),
this
,
SLOT
(
enableGroupingButton
()));
connect
(
this
,
SIGNAL
(
selectionChanged
()),
this
,
SLOT
(
groupButtonProcessing
()));
connect
(
UBApplication
::
mainWindow
->
actionGroupItems
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
processGroupItems
()));
connect
(
UBApplication
::
mainWindow
->
actionGroupItems
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
groupButtonClicked
()));
}
UBGraphicsScene
::~
UBGraphicsScene
()
...
...
@@ -312,15 +315,65 @@ void UBGraphicsScene::selectionChangedProcessing()
UBApplication
::
showMessage
(
"ZValue is "
+
QString
::
number
(
selectedItems
().
first
()
->
zValue
(),
'f'
)
+
"own z value is "
+
QString
::
number
(
selectedItems
().
first
()
->
data
(
UBGraphicsItemData
::
ItemOwnZValue
).
toReal
(),
'f'
));
}
void
UBGraphicsScene
::
enableGroupingButton
()
void
UBGraphicsScene
::
groupButtonProcessing
()
{
QAction
*
groupAction
=
UBApplication
::
mainWindow
->
actionGroupItems
;
QList
<
QGraphicsItem
*>
selItems
=
selectedItems
();
int
selCount
=
selItems
.
count
();
if
(
selectedItems
().
count
()
>
1
)
{
groupAction
->
setEnabled
(
true
);
}
else
{
if
(
selCount
<
1
)
{
groupAction
->
setEnabled
(
false
);
groupAction
->
setText
(
groupText
);
}
else
if
(
selCount
==
1
)
{
if
(
selItems
.
first
()
->
type
()
==
UBGraphicsGroupContainerItem
::
Type
)
{
groupAction
->
setEnabled
(
true
);
groupAction
->
setText
(
ungroupText
);
}
else
{
groupAction
->
setEnabled
(
false
);
}
}
else
if
(
selCount
>
1
)
{
groupAction
->
setEnabled
(
true
);
groupAction
->
setText
(
groupText
);
}
}
void
UBGraphicsScene
::
groupButtonClicked
()
{
QAction
*
groupAction
=
UBApplication
::
mainWindow
->
actionGroupItems
;
QList
<
QGraphicsItem
*>
selItems
=
selectedItems
();
if
(
!
selItems
.
count
())
{
qDebug
()
<<
"Got grouping request when there is no any selected item on the scene"
;
return
;
}
if
(
groupAction
->
text
()
==
groupText
)
{
//The only way to get information from item, considering using smth else
UBGraphicsGroupContainerItem
*
groupItem
=
new
UBGraphicsGroupContainerItem
();
foreach
(
QGraphicsItem
*
item
,
selItems
)
{
item
->
setSelected
(
false
);
item
->
setFlag
(
QGraphicsItem
::
ItemIsSelectable
,
false
);
item
->
setFlag
(
QGraphicsItem
::
ItemIsMovable
,
false
);
item
->
setFlag
(
QGraphicsItem
::
ItemIsFocusable
);
groupItem
->
addToGroup
(
item
);
}
addItem
(
groupItem
);
groupItem
->
setVisible
(
true
);
groupItem
->
setFocus
();
}
else
if
(
groupAction
->
text
()
==
ungroupText
)
{
//Considering one selected item and it's a group
if
(
selItems
.
count
()
>
1
)
{
qDebug
()
<<
"can't make sense of ungrouping more then one item. Grouping action should be performed for that purpose"
;
return
;
}
UBGraphicsGroupContainerItem
*
currentGroup
=
dynamic_cast
<
UBGraphicsGroupContainerItem
*>
(
selItems
.
first
());
if
(
currentGroup
)
{
currentGroup
->
destroy
();
}
}
}
void
UBGraphicsScene
::
processGroupItems
()
{
...
...
@@ -432,7 +485,6 @@ bool UBGraphicsScene::inputDevicePress(const QPointF& scenePos, const qreal& pre
return
accepted
;
}
bool
UBGraphicsScene
::
inputDeviceMove
(
const
QPointF
&
scenePos
,
const
qreal
&
pressure
)
{
bool
accepted
=
false
;
...
...
src/domain/UBGraphicsScene.h
View file @
a6043930
...
...
@@ -305,7 +305,8 @@ public slots:
void
setToolCursor
(
int
tool
);
void
selectionChangedProcessing
();
void
enableGroupingButton
();
void
groupButtonProcessing
();
void
groupButtonClicked
();
void
processGroupItems
();
void
moveMagnifier
(
QPoint
newPos
);
...
...
src/domain/ubgraphicsgroupcontaineritem.cpp
View file @
a6043930
...
...
@@ -53,6 +53,15 @@ void UBGraphicsGroupContainerItem::remove()
mDelegate
->
remove
();
}
void
UBGraphicsGroupContainerItem
::
destroy
()
{
foreach
(
QGraphicsItem
*
item
,
childItems
())
{
removeFromGroup
(
item
);
item
->
setFlag
(
QGraphicsItem
::
ItemIsSelectable
,
true
);
}
mDelegate
->
remove
(
true
);
}
void
UBGraphicsGroupContainerItem
::
mousePressEvent
(
QGraphicsSceneMouseEvent
*
event
)
{
...
...
src/domain/ubgraphicsgroupcontaineritem.h
View file @
a6043930
...
...
@@ -15,6 +15,14 @@ public:
virtual
UBGraphicsScene
*
scene
();
virtual
UBGraphicsGroupContainerItem
*
deepCopy
()
const
;
virtual
void
remove
();
enum
{
Type
=
UBGraphicsItemType
::
groupContainerType
};
virtual
int
type
()
const
{
return
Type
;
}
void
destroy
();
protected
:
...
...
src/tools/UBGraphicsCompass.cpp
View file @
a6043930
...
...
@@ -71,6 +71,7 @@ UBGraphicsCompass::UBGraphicsCompass()
unsetCursor
();
setData
(
UBGraphicsItemData
::
itemLayerType
,
QVariant
(
itemLayerType
::
CppTool
));
//Necessary to set if we want z value to be assigned correctly
setFlag
(
QGraphicsItem
::
ItemIsSelectable
,
false
);
connect
(
UBApplication
::
boardController
,
SIGNAL
(
penColorChanged
()),
this
,
SLOT
(
penColorChanged
()));
connect
(
UBDrawingController
::
drawingController
(),
SIGNAL
(
lineWidthIndexChanged
(
int
)),
this
,
SLOT
(
lineWidthChanged
()));
...
...
src/tools/UBGraphicsProtractor.cpp
View file @
a6043930
...
...
@@ -64,6 +64,7 @@ UBGraphicsProtractor::UBGraphicsProtractor()
mRotateSvgItem
->
setData
(
UBGraphicsItemData
::
ItemLayerType
,
QVariant
(
UBItemLayerType
::
Control
));
setData
(
UBGraphicsItemData
::
itemLayerType
,
QVariant
(
itemLayerType
::
CppTool
));
//Necessary to set if we want z value to be assigned correctly
setFlag
(
QGraphicsItem
::
ItemIsSelectable
,
false
);
scale
(
1.5
,
1.5
);
}
...
...
src/tools/UBGraphicsProtractor.h
View file @
a6043930
...
...
@@ -28,7 +28,7 @@ class UBGraphicsScene;
class
UBGraphicsProtractor
:
public
UBAbstractDrawRuler
,
public
QGraphicsEllipseItem
,
public
UBItem
{
Q_OBJECT
;
Q_OBJECT
public
:
UBGraphicsProtractor
();
...
...
src/tools/UBGraphicsRuler.cpp
View file @
a6043930
...
...
@@ -46,7 +46,8 @@ UBGraphicsRuler::UBGraphicsRuler()
setData
(
UBGraphicsItemData
::
itemLayerType
,
QVariant
(
itemLayerType
::
CppTool
));
//Necessary to set if we want z value to be assigned correctly
updateResizeCursor
();
setFlag
(
QGraphicsItem
::
ItemIsSelectable
,
false
);
updateResizeCursor
();
}
void
UBGraphicsRuler
::
updateResizeCursor
()
...
...
src/tools/UBGraphicsTriangle.cpp
View file @
a6043930
...
...
@@ -55,6 +55,7 @@ UBGraphicsTriangle::UBGraphicsTriangle()
mRotateSvgItem
->
setData
(
UBGraphicsItemData
::
ItemLayerType
,
QVariant
(
UBItemLayerType
::
Control
));
setData
(
UBGraphicsItemData
::
itemLayerType
,
QVariant
(
itemLayerType
::
CppTool
));
//Necessary to set if we want z value to be assigned correctly
setFlag
(
QGraphicsItem
::
ItemIsSelectable
,
false
);
updateResizeCursor
();
}
...
...
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