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
f47733ee
Commit
f47733ee
authored
Jun 21, 2013
by
Ilia Ryabokon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rotation transformations
parent
004a1366
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
61 additions
and
11 deletions
+61
-11
UBFeaturesController.cpp
src/board/UBFeaturesController.cpp
+2
-2
UBGraphicsItemDelegate.cpp
src/domain/UBGraphicsItemDelegate.cpp
+1
-0
UBGraphicsScene.cpp
src/domain/UBGraphicsScene.cpp
+8
-2
UBSelectionFrame.cpp
src/domain/UBSelectionFrame.cpp
+48
-6
UBSelectionFrame.h
src/domain/UBSelectionFrame.h
+2
-1
No files found.
src/board/UBFeaturesController.cpp
View file @
f47733ee
...
...
@@ -59,8 +59,8 @@ const QString UBFeaturesController::webSearchPath = rootPath + "/Web search";
void
UBFeaturesComputingThread
::
scanFS
(
const
QUrl
&
currentPath
,
const
QString
&
currVirtualPath
,
const
QSet
<
QUrl
>
&
pFavoriteSet
)
{
// Q_ASSERT(QFileInfo(currentPath.toLocalFile()).exists());
if
(
QFileInfo
(
currentPath
.
toLocalFile
()).
exists
())
return
;
//
if(QFileInfo(currentPath.toLocalFile()).exists())
//
return;
QFileInfoList
fileInfoList
=
UBFileSystemUtils
::
allElementsInDirectory
(
currentPath
.
toLocalFile
());
...
...
src/domain/UBGraphicsItemDelegate.cpp
View file @
f47733ee
...
...
@@ -316,6 +316,7 @@ void UBGraphicsItemDelegate::postpaint(QPainter *painter, const QStyleOptionGrap
painter
->
setPen
(
Qt
::
NoPen
);
painter
->
setBrush
(
QColor
(
0x88
,
0x88
,
0x88
,
0x77
));
painter
->
drawRect
(
option
->
rect
);
painter
->
restore
();
}
}
...
...
src/domain/UBGraphicsScene.cpp
View file @
f47733ee
...
...
@@ -249,9 +249,15 @@ qreal UBZLayerController::changeZLevelTo(QGraphicsItem *item, moveDestination de
item
->
scene
()
->
clearSelection
();
item
->
setSelected
(
true
);
foreach
(
QGraphicsItem
*
iitem
,
sortedItems
.
values
())
{
if
(
iitem
)
iitem
!=
item
?
qDebug
()
<<
"current value"
<<
iitem
->
zValue
()
:
qDebug
()
<<
"marked value"
<<
QString
::
number
(
iitem
->
zValue
(),
'f'
);
}
//Return new z value assigned to item
return
item
->
data
(
UBGraphicsItemData
::
ItemOwnZValue
).
toReal
();
}
itemLayerType
::
Enum
UBZLayerController
::
typeForData
(
QGraphicsItem
*
item
)
const
...
...
@@ -317,7 +323,7 @@ UBGraphicsScene::UBGraphicsScene(UBDocumentProxy* parent, bool enableUndoRedoSta
}
// Just for debug. Do not delete please
//
connect(this, SIGNAL(selectionChanged()), this, SLOT(selectionChangedProcessing()));
connect
(
this
,
SIGNAL
(
selectionChanged
()),
this
,
SLOT
(
selectionChangedProcessing
()));
connect
(
this
,
SIGNAL
(
selectionChanged
()),
this
,
SLOT
(
updateGroupButtonState
()));
connect
(
UBApplication
::
undoStack
.
data
(),
SIGNAL
(
indexChanged
(
int
)),
this
,
SLOT
(
updateSelectionFrameWrapper
(
int
)));
}
...
...
src/domain/UBSelectionFrame.cpp
View file @
f47733ee
...
...
@@ -9,6 +9,7 @@
#include "gui/UBResources.h"
#include "core/UBApplication.h"
#include "domain/UBGraphicsScene.h"
#include "board/UBBoardView.h"
UBSelectionFrame
::
UBSelectionFrame
()
:
mThickness
(
UBSettings
::
settings
()
->
objectFrameWidth
)
...
...
@@ -125,6 +126,7 @@ void UBSelectionFrame::mousePressEvent(QGraphicsSceneMouseEvent *event)
{
mPressedPos
=
mLastMovedPos
=
event
->
pos
();
mLastTranslateOffset
=
QPointF
();
mRotationAngle
=
0
;
if
(
scene
()
->
itemAt
(
event
->
scenePos
())
==
mRotateButton
)
{
mOperationMode
=
om_rotating
;
...
...
@@ -142,6 +144,7 @@ void UBSelectionFrame::mousePressEvent(QGraphicsSceneMouseEvent *event)
void
UBSelectionFrame
::
mouseMoveEvent
(
QGraphicsSceneMouseEvent
*
event
)
{
QPointF
dp
=
event
->
pos
()
-
mPressedPos
;
QPointF
rotCenter
=
mapToScene
(
rect
().
center
());
foreach
(
UBGraphicsItemDelegate
*
curDelegate
,
mEnclosedtems
)
{
...
...
@@ -174,17 +177,24 @@ void UBSelectionFrame::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
QGraphicsItem
*
item
=
curDelegate
->
delegated
();
QTransform
ownTransform
=
item
->
transform
();
qreal
cntrX
=
item
->
boundingRect
().
center
().
x
();
qreal
cntrY
=
item
->
boundingRect
().
center
().
y
();
QPointF
nextRotCenter
=
item
->
mapFromScene
(
rotCenter
);
qreal
cntrX
=
nextRotCenter
.
x
();
qreal
cntrY
=
nextRotCenter
.
y
();
ownTransform
.
translate
(
cntrX
,
cntrY
);
mRotationAngle
-=
dAngle
;
ownTransform
.
rotate
(
mRotation
Angle
);
ownTransform
.
rotate
(
-
d
Angle
);
ownTransform
.
translate
(
-
cntrX
,
-
cntrY
);
item
->
setTransform
(
ownTransform
);
item
->
update
();
item
->
setTransform
(
ownTransform
,
false
);
int
resultAngle
=
(
int
)
mRotationAngle
%
360
;
// setCursorFromAngle(QString::number(resultAngle));
qDebug
()
<<
"curAngle"
<<
d
Angle
;
qDebug
()
<<
"curAngle"
<<
mRotation
Angle
;
}
break
;
}
...
...
@@ -356,6 +366,38 @@ inline UBGraphicsScene *UBSelectionFrame::ubscene()
return
qobject_cast
<
UBGraphicsScene
*>
(
scene
());
}
void
UBSelectionFrame
::
setCursorFromAngle
(
QString
angle
)
{
QWidget
*
controlViewport
=
UBApplication
::
boardController
->
controlView
()
->
viewport
();
QSize
cursorSize
(
45
,
30
);
QImage
mask_img
(
cursorSize
,
QImage
::
Format_Mono
);
mask_img
.
fill
(
0xff
);
QPainter
mask_ptr
(
&
mask_img
);
mask_ptr
.
setBrush
(
QBrush
(
QColor
(
0
,
0
,
0
)
)
);
mask_ptr
.
drawRoundedRect
(
0
,
0
,
cursorSize
.
width
()
-
1
,
cursorSize
.
height
()
-
1
,
6
,
6
);
QBitmap
bmpMask
=
QBitmap
::
fromImage
(
mask_img
);
QPixmap
pixCursor
(
cursorSize
);
pixCursor
.
fill
(
QColor
(
Qt
::
white
));
QPainter
painter
(
&
pixCursor
);
painter
.
setRenderHints
(
QPainter
::
Antialiasing
|
QPainter
::
SmoothPixmapTransform
);
painter
.
setBrush
(
QBrush
(
Qt
::
white
));
painter
.
setPen
(
QPen
(
QColor
(
Qt
::
black
)));
painter
.
drawRoundedRect
(
1
,
1
,
cursorSize
.
width
()
-
2
,
cursorSize
.
height
()
-
2
,
6
,
6
);
painter
.
setFont
(
QFont
(
"Arial"
,
10
));
painter
.
drawText
(
1
,
1
,
cursorSize
.
width
(),
cursorSize
.
height
(),
Qt
::
AlignCenter
,
angle
.
append
(
QChar
(
176
)));
painter
.
end
();
pixCursor
.
setMask
(
bmpMask
);
controlViewport
->
setCursor
(
pixCursor
);
}
QList
<
QGraphicsItem
*>
UBSelectionFrame
::
sortedByZ
(
const
QList
<
QGraphicsItem
*>
&
pItems
)
{
//select only items wiht the same z-level as item's one and push it to sortedItems QMultiMap
...
...
@@ -394,7 +436,7 @@ QList<DelegateButton*> UBSelectionFrame::buttonsForFlags(UBGraphicsFlags fls) {
if
(
!
mZOrderUpButton
)
{
mZOrderUpButton
=
new
DelegateButton
(
":/images/z_layer_up.svg"
,
this
,
0
,
Qt
::
BottomLeftSection
);
mZOrderUpButton
->
setShowProgressIndicator
(
true
);
connect
(
mZOrderUpButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
increaseZl
rf
evelUp
()));
connect
(
mZOrderUpButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
increaseZlevelUp
()));
connect
(
mZOrderUpButton
,
SIGNAL
(
longClicked
()),
this
,
SLOT
(
increaseZlevelTop
()));
}
...
...
src/domain/UBSelectionFrame.h
View file @
f47733ee
...
...
@@ -15,7 +15,7 @@ class UBSelectionFrame : public QObject, public QGraphicsRectItem
public
:
enum
{
om_idle
,
om_moving
,
om_rotating
}
mOperationMode
;
enum
{
Type
=
UBGraphicsItemType
::
PixmapItem
Type
};
enum
{
Type
=
UBGraphicsItemType
::
SelectionFrame
Type
};
UBSelectionFrame
();
...
...
@@ -54,6 +54,7 @@ private:
void
clearButtons
();
inline
int
adjThickness
()
const
{
return
mThickness
*
mAntiscaleRatio
;}
inline
UBGraphicsScene
*
ubscene
();
void
setCursorFromAngle
(
QString
angle
);
QList
<
QGraphicsItem
*>
sortedByZ
(
const
QList
<
QGraphicsItem
*>
&
pItems
);
QList
<
DelegateButton
*>
buttonsForFlags
(
UBGraphicsFlags
fls
);
...
...
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