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
da8c496f
Commit
da8c496f
authored
Aug 15, 2012
by
Ilia Ryabokon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Flipping and rotating possibilities for UBGraphicsGroupContainerItem
parent
473b2515
Changes
18
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
98 additions
and
17 deletions
+98
-17
UB.h
src/core/UB.h
+3
-0
UBGraphicsGroupContainerItem.cpp
src/domain/UBGraphicsGroupContainerItem.cpp
+36
-1
UBGraphicsGroupContainerItemDelegate.cpp
src/domain/UBGraphicsGroupContainerItemDelegate.cpp
+3
-1
UBGraphicsItemDelegate.cpp
src/domain/UBGraphicsItemDelegate.cpp
+21
-1
UBGraphicsItemDelegate.h
src/domain/UBGraphicsItemDelegate.h
+3
-2
UBGraphicsMediaItem.cpp
src/domain/UBGraphicsMediaItem.cpp
+0
-1
UBGraphicsMediaItemDelegate.cpp
src/domain/UBGraphicsMediaItemDelegate.cpp
+5
-1
UBGraphicsPixmapItem.cpp
src/domain/UBGraphicsPixmapItem.cpp
+2
-2
UBGraphicsScene.cpp
src/domain/UBGraphicsScene.cpp
+4
-5
UBGraphicsStrokesGroup.cpp
src/domain/UBGraphicsStrokesGroup.cpp
+2
-0
UBGraphicsSvgItem.cpp
src/domain/UBGraphicsSvgItem.cpp
+1
-0
UBGraphicsTextItem.cpp
src/domain/UBGraphicsTextItem.cpp
+2
-0
UBGraphicsTextItemDelegate.cpp
src/domain/UBGraphicsTextItemDelegate.cpp
+1
-1
UBGraphicsWebView.cpp
src/domain/UBGraphicsWebView.cpp
+1
-1
UBItem.cpp
src/domain/UBItem.cpp
+10
-0
UBItem.h
src/domain/UBItem.h
+3
-0
UBFeaturesWidget.h
src/gui/UBFeaturesWidget.h
+0
-1
UBGraphicsCurtainItem.cpp
src/tools/UBGraphicsCurtainItem.cpp
+1
-0
No files found.
src/core/UB.h
View file @
da8c496f
...
...
@@ -117,6 +117,9 @@ struct UBGraphicsItemData
,
ItemOwnZValue
,
itemLayerType
//use instead of deprecated ItemLayerType
,
ItemUuid
//storing uuid in QGraphicsItem for fast finding operations
//Duplicating delegate's functions to make possible working with pure QGraphicsItem
,
ItemFlippable
// (bool)
,
ItemRotatable
// (bool)
};
};
...
...
src/domain/UBGraphicsGroupContainerItem.cpp
View file @
da8c496f
...
...
@@ -29,6 +29,7 @@ UBGraphicsGroupContainerItem::UBGraphicsGroupContainerItem(QGraphicsItem *parent
setData
(
UBGraphicsItemData
::
itemLayerType
,
QVariant
(
itemLayerType
::
ObjectItem
));
//Necessary to set if we want z value to be assigned correctly
}
void
UBGraphicsGroupContainerItem
::
addToGroup
(
QGraphicsItem
*
item
)
...
...
@@ -42,6 +43,19 @@ void UBGraphicsGroupContainerItem::addToGroup(QGraphicsItem *item)
return
;
}
//Check if group is allready rotatable or flippable
if
(
childItems
().
count
())
{
if
(
UBGraphicsItem
::
isFlippable
(
this
)
&&
!
UBGraphicsItem
::
isFlippable
(
item
))
{
mDelegate
->
setFlippable
(
false
);
}
if
(
UBGraphicsItem
::
isRotatable
(
this
)
&&
!
UBGraphicsItem
::
isRotatable
(
item
))
{
mDelegate
->
setRotatable
(
false
);
}
}
else
{
mDelegate
->
setFlippable
(
UBGraphicsItem
::
isFlippable
(
item
));
mDelegate
->
setRotatable
(
UBGraphicsItem
::
isRotatable
(
item
));
}
// COMBINE
bool
ok
;
QTransform
itemTransform
=
item
->
itemTransform
(
this
,
&
ok
);
...
...
@@ -80,7 +94,7 @@ void UBGraphicsGroupContainerItem::addToGroup(QGraphicsItem *item)
// ### Expensive, we could maybe use dirtySceneTransform bit for optimization
item
->
setTransform
(
newItemTransform
);
// item->d_func()->setIsMemberOfGroup(true);
// item->d_func()->setIsMemberOfGroup(true);
prepareGeometryChange
();
itemsBoundingRect
|=
itemTransform
.
mapRect
(
item
->
boundingRect
()
|
item
->
childrenBoundingRect
());
update
();
...
...
@@ -270,6 +284,27 @@ void UBGraphicsGroupContainerItem::pRemoveFromGroup(QGraphicsItem *item)
QGraphicsItem
*
newParent
=
parentItem
();
if
(
childItems
().
count
())
{
if
(
!
UBGraphicsItem
::
isFlippable
(
item
)
||
!
UBGraphicsItem
::
isRotatable
(
item
))
{
bool
flippableNow
=
true
;
bool
rotatableNow
=
true
;
foreach
(
QGraphicsItem
*
item
,
childItems
())
{
if
(
!
UBGraphicsItem
::
isFlippable
(
item
))
{
flippableNow
=
false
;
}
if
(
!
UBGraphicsItem
::
isRotatable
(
item
))
{
rotatableNow
=
false
;
}
if
(
!
rotatableNow
&&
!
flippableNow
)
{
break
;
}
}
mDelegate
->
setFlippable
(
flippableNow
);
mDelegate
->
setRotatable
(
rotatableNow
);
}
}
// COMBINE
bool
ok
;
QTransform
itemTransform
;
...
...
src/domain/UBGraphicsGroupContainerItemDelegate.cpp
View file @
da8c496f
...
...
@@ -16,7 +16,9 @@ UBGraphicsGroupContainerItemDelegate::UBGraphicsGroupContainerItemDelegate(QGrap
UBGraphicsItemDelegate
(
pDelegated
,
parent
,
true
,
false
,
false
),
mDestroyGroupButton
(
0
)
{
//Wrapper function. Use it to set correct data() to QGraphicsItem as well
setFlippable
(
false
);
setRotatable
(
false
);
}
UBGraphicsGroupContainerItem
*
UBGraphicsGroupContainerItemDelegate
::
delegated
()
...
...
src/domain/UBGraphicsItemDelegate.cpp
View file @
da8c496f
...
...
@@ -158,6 +158,10 @@ void UBGraphicsItemDelegate::init()
button
->
setFlag
(
QGraphicsItem
::
ItemIsSelectable
,
true
);
}
}
//Wrapper function. Use it to set correct data() to QGraphicsItem as well
setFlippable
(
false
);
setRotatable
(
false
);
}
...
...
@@ -410,7 +414,7 @@ void UBGraphicsItemDelegate::remove(bool canUndo)
}
bool
UBGraphicsItemDelegate
::
isLocked
()
bool
UBGraphicsItemDelegate
::
isLocked
()
const
{
return
mDelegated
->
data
(
UBGraphicsItemData
::
ItemLocked
).
toBool
();
}
...
...
@@ -598,6 +602,22 @@ void UBGraphicsItemDelegate::showMenu()
void
UBGraphicsItemDelegate
::
setFlippable
(
bool
flippable
)
{
mFlippable
=
flippable
;
Q_ASSERT
(
mDelegated
);
if
(
mDelegated
)
{
mDelegated
->
setData
(
UBGraphicsItemData
::
ItemFlippable
,
QVariant
(
flippable
));
}
}
void
UBGraphicsItemDelegate
::
setRotatable
(
bool
pCanRotate
)
{
mCanRotate
=
pCanRotate
;
Q_ASSERT
(
mDelegated
);
if
(
mDelegated
)
{
mDelegated
->
setData
(
UBGraphicsItemData
::
ItemRotatable
,
QVariant
(
pCanRotate
));
}
}
bool
UBGraphicsItemDelegate
::
isFlippable
()
...
...
src/domain/UBGraphicsItemDelegate.h
View file @
da8c496f
...
...
@@ -224,8 +224,8 @@ class UBGraphicsItemDelegate : public QObject
UBGraphicsDelegateFrame
*
frame
()
{
return
mFrame
;
}
bool
canRotate
()
{
return
mCanRotate
;
}
bool
isLocked
();
bool
canRotate
()
const
{
return
mCanRotate
;
}
bool
isLocked
()
const
;
bool
canDuplicate
()
{
return
mCanDuplicate
;
}
QMimeData
*
mimeData
(){
return
mMimeData
;
}
...
...
@@ -233,6 +233,7 @@ class UBGraphicsItemDelegate : public QObject
void
setDragPixmap
(
const
QPixmap
&
pix
)
{
mDragPixmap
=
pix
;}
void
setFlippable
(
bool
flippable
);
void
setRotatable
(
bool
pCanRotate
);
bool
isFlippable
();
void
setButtonsVisible
(
bool
visible
);
...
...
src/domain/UBGraphicsMediaItem.cpp
View file @
da8c496f
...
...
@@ -131,7 +131,6 @@ UBGraphicsMediaItem::UBGraphicsMediaItem(const QUrl& pMediaFileUrl, QGraphicsIte
connect
(
mDelegate
,
SIGNAL
(
showOnDisplayChanged
(
bool
)),
this
,
SLOT
(
showOnDisplayChanged
(
bool
)));
connect
(
mMediaObject
,
SIGNAL
(
hasVideoChanged
(
bool
)),
this
,
SLOT
(
hasMediaChanged
(
bool
)));
}
...
...
src/domain/UBGraphicsMediaItemDelegate.cpp
View file @
da8c496f
...
...
@@ -56,6 +56,10 @@ UBGraphicsMediaItemDelegate::UBGraphicsMediaItemDelegate(UBGraphicsMediaItem* pD
{
delegated
()
->
setMute
(
true
);
}
//Wrapper function. Use it to set correct data() to QGraphicsItem as well
setFlippable
(
false
);
setRotatable
(
false
);
}
bool
UBGraphicsMediaItemDelegate
::
mousePressEvent
(
QGraphicsSceneMouseEvent
*
event
)
...
...
@@ -269,4 +273,4 @@ void UBGraphicsMediaItemDelegate::updateTicker(qint64 time)
void
UBGraphicsMediaItemDelegate
::
totalTimeChanged
(
qint64
newTotalTime
)
{
mMediaControl
->
totalTimeChanged
(
newTotalTime
);
}
\ No newline at end of file
}
src/domain/UBGraphicsPixmapItem.cpp
View file @
da8c496f
...
...
@@ -28,10 +28,10 @@
UBGraphicsPixmapItem
::
UBGraphicsPixmapItem
(
QGraphicsItem
*
parent
)
:
QGraphicsPixmapItem
(
parent
)
{
mDelegate
=
new
UBGraphicsItemDelegate
(
this
,
0
,
true
,
true
,
false
);
mDelegate
=
new
UBGraphicsItemDelegate
(
this
,
0
,
true
);
mDelegate
->
init
();
mDelegate
->
setFlippable
(
true
);
mDelegate
->
setRotatable
(
true
);
setData
(
UBGraphicsItemData
::
ItemLayerType
,
UBItemLayerType
::
Object
);
setTransformationMode
(
Qt
::
SmoothTransformation
);
...
...
src/domain/UBGraphicsScene.cpp
View file @
da8c496f
...
...
@@ -308,9 +308,10 @@ UBGraphicsScene::~UBGraphicsScene()
void
UBGraphicsScene
::
selectionChangedProcessing
()
{
if
(
selectedItems
().
count
()){
qDebug
()
<<
"Selected item bounding rect: "
<<
selectedItems
().
first
()
->
boundingRect
();
UBApplication
::
showMessage
(
"ZValue is "
+
QString
::
number
(
selectedItems
().
first
()
->
zValue
(),
'f'
)
+
"own z value is "
+
QString
::
number
(
selectedItems
().
first
()
->
data
(
UBGraphicsItemData
::
ItemOwnZValue
).
toReal
(),
'f'
));
// UBApplication::showMessage("ZValue is " + QString::number(selectedItems().first()->zValue(), 'f') + "own z value is "
// + QString::number(selectedItems().first()->data(UBGraphicsItemData::ItemOwnZValue).toReal(), 'f'));
qDebug
()
<<
"flippable"
<<
selectedItems
().
first
()
->
data
(
UBGraphicsItemData
::
ItemFlippable
).
toBool
()
<<
endl
<<
"rotatable"
<<
selectedItems
().
first
()
->
data
(
UBGraphicsItemData
::
ItemRotatable
).
toBool
();
}
}
...
...
@@ -1998,8 +1999,6 @@ void UBGraphicsScene::moveMagnifier(QPoint newPos, bool forceGrab)
QPoint
dvZeroPoint
=
dView
->
mapToGlobal
(
QPoint
(
0
,
0
));
QRect
qcr
=
cView
->
geometry
();
QRect
qdr
=
dView
->
geometry
();
int
cvW
=
cView
->
width
();
int
dvW
=
dView
->
width
();
qreal
wCoeff
=
(
qreal
)
dvW
/
(
qreal
)
cvW
;
...
...
src/domain/UBGraphicsStrokesGroup.cpp
View file @
da8c496f
...
...
@@ -9,6 +9,8 @@ UBGraphicsStrokesGroup::UBGraphicsStrokesGroup(QGraphicsItem *parent):QGraphicsI
mDelegate
=
new
UBGraphicsItemDelegate
(
this
,
0
,
true
,
true
,
false
);
mDelegate
->
init
();
mDelegate
->
setFlippable
(
true
);
mDelegate
->
setRotatable
(
true
);
setData
(
UBGraphicsItemData
::
ItemLayerType
,
UBItemLayerType
::
Object
);
setUuid
(
QUuid
::
createUuid
());
...
...
src/domain/UBGraphicsSvgItem.cpp
View file @
da8c496f
...
...
@@ -56,6 +56,7 @@ void UBGraphicsSvgItem::init()
mDelegate
=
new
UBGraphicsItemDelegate
(
this
,
0
,
true
,
true
,
false
);
mDelegate
->
init
();
mDelegate
->
setFlippable
(
true
);
mDelegate
->
setRotatable
(
true
);
setFlag
(
QGraphicsItem
::
ItemSendsGeometryChanges
,
true
);
...
...
src/domain/UBGraphicsTextItem.cpp
View file @
da8c496f
...
...
@@ -38,6 +38,8 @@ UBGraphicsTextItem::UBGraphicsTextItem(QGraphicsItem * parent)
mDelegate
->
init
();
mDelegate
->
frame
()
->
setOperationMode
(
UBGraphicsDelegateFrame
::
Resizing
);
mDelegate
->
setFlippable
(
false
);
mDelegate
->
setRotatable
(
true
);
mTypeTextHereLabel
=
tr
(
"<Type Text Here>"
);
...
...
src/domain/UBGraphicsTextItemDelegate.cpp
View file @
da8c496f
...
...
@@ -402,4 +402,4 @@ void UBGraphicsTextItemDelegate::ChangeTextSize(qreal factor, textChangeMode cha
void
UBGraphicsTextItemDelegate
::
scaleTextSize
(
qreal
multiplyer
)
{
ChangeTextSize
(
multiplyer
,
scaleSize
);
}
\ No newline at end of file
}
src/domain/UBGraphicsWebView.cpp
View file @
da8c496f
...
...
@@ -28,7 +28,7 @@ UBGraphicsWebView::UBGraphicsWebView(QGraphicsItem* parent)
{
setData
(
UBGraphicsItemData
::
ItemLayerType
,
UBItemLayerType
::
Object
);
mDelegate
=
new
UBGraphicsItemDelegate
(
this
,
0
,
true
,
false
,
false
);
mDelegate
=
new
UBGraphicsItemDelegate
(
this
,
0
,
true
);
mDelegate
->
init
();
setFlag
(
QGraphicsItem
::
ItemSendsGeometryChanges
,
true
);
...
...
src/domain/UBItem.cpp
View file @
da8c496f
...
...
@@ -34,3 +34,13 @@ void UBGraphicsItem::assignZValue(QGraphicsItem *item, qreal value)
item
->
setZValue
(
value
);
item
->
setData
(
UBGraphicsItemData
::
ItemOwnZValue
,
value
);
}
bool
UBGraphicsItem
::
isFlippable
(
QGraphicsItem
*
item
)
{
return
item
->
data
(
UBGraphicsItemData
::
ItemFlippable
).
toBool
();
}
bool
UBGraphicsItem
::
isRotatable
(
QGraphicsItem
*
item
)
{
return
item
->
data
(
UBGraphicsItemData
::
ItemRotatable
).
toBool
();
}
src/domain/UBItem.h
View file @
da8c496f
...
...
@@ -105,6 +105,9 @@ protected:
public
:
static
void
assignZValue
(
QGraphicsItem
*
,
qreal
value
);
static
bool
isRotatable
(
QGraphicsItem
*
item
);
static
bool
isFlippable
(
QGraphicsItem
*
item
);
virtual
UBGraphicsItemDelegate
*
Delegate
()
const
=
0
;
virtual
void
remove
()
=
0
;
...
...
src/gui/UBFeaturesWidget.h
View file @
da8c496f
...
...
@@ -248,7 +248,6 @@ private slots:
void
setFileNameList
(
const
QStringList
&
pLst
);
void
reactOnTextChanged
(
const
QString
&
pStr
);
private
:
QLineEdit
*
mLineEdit
;
QRegExpValidator
*
mValidator
;
...
...
src/tools/UBGraphicsCurtainItem.cpp
View file @
da8c496f
...
...
@@ -39,6 +39,7 @@ UBGraphicsCurtainItem::UBGraphicsCurtainItem(QGraphicsItem* parent)
{
mDelegate
=
new
UBGraphicsCurtainItemDelegate
(
this
,
0
);
mDelegate
->
init
();
setFlag
(
QGraphicsItem
::
ItemIsMovable
,
true
);
setFlag
(
QGraphicsItem
::
ItemIsSelectable
,
true
);
...
...
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