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
d5ec11fa
Commit
d5ec11fa
authored
Dec 11, 2013
by
Ilia Ryabokon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Text delegate algn buttons
parent
5d686fff
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
334 additions
and
27 deletions
+334
-27
UBGraphicsItemZLevelUndoCommand.cpp
src/domain/UBGraphicsItemZLevelUndoCommand.cpp
+1
-1
UBGraphicsTextItemDelegate.cpp
src/domain/UBGraphicsTextItemDelegate.cpp
+249
-20
UBGraphicsTextItemDelegate.h
src/domain/UBGraphicsTextItemDelegate.h
+84
-6
No files found.
src/domain/UBGraphicsItemZLevelUndoCommand.cpp
View file @
d5ec11fa
...
...
@@ -59,7 +59,7 @@ void UBGraphicsItemZLevelUndoCommand::undo(){
if
(
mDest
==
UBZLayerController
::
down
||
mDest
==
UBZLayerController
::
bottom
){
// Move up
QList
<
QGraphicsItem
*>::
iterator
downIt
=
mItems
.
end
();
for
(
downIt
;
downIt
>=
mItems
.
begin
();
downIt
--
){
for
(;
downIt
>=
mItems
.
begin
();
downIt
--
){
for
(
int
i
=
0
;
i
<
zDiff
;
i
++
)
mpScene
->
changeZLevelTo
(
*
downIt
,
UBZLayerController
::
up
);
}
...
...
src/domain/UBGraphicsTextItemDelegate.cpp
View file @
d5ec11fa
This diff is collapsed.
Click to expand it.
src/domain/UBGraphicsTextItemDelegate.h
View file @
d5ec11fa
...
...
@@ -37,6 +37,64 @@
class
UBGraphicsTextItem
;
class
AlignTextButton
:
public
DelegateButton
{
Q_OBJECT
public
:
static
const
int
MAX_KIND
=
3
;
enum
kind_t
{
k_left
=
0
,
k_center
,
k_right
,
k_mixed
};
AlignTextButton
(
const
QString
&
fileName
,
QGraphicsItem
*
pDelegated
,
QGraphicsItem
*
parent
=
0
,
Qt
::
WindowFrameSection
section
=
Qt
::
TopLeftSection
);
virtual
~
AlignTextButton
();
void
setKind
(
int
pKind
);
int
kind
()
{
return
mKind
;}
void
setNextKind
();
int
nextKind
()
const
;
void
setMixedButtonVisible
(
bool
v
=
true
)
{
mHideMixed
=
!
v
;}
bool
isMixedButtonVisible
()
{
return
!
mHideMixed
;}
private
:
QSvgRenderer
*
rndFromKind
(
int
pknd
)
{
switch
(
pknd
)
{
case
k_left
:
return
lft
;
break
;
case
k_center
:
return
cntr
;
break
;
case
k_right
:
return
rght
;
break
;
case
k_mixed
:
return
mxd
;
break
;
}
return
0
;
}
QSvgRenderer
*
curRnd
()
{
return
rndFromKind
(
mKind
);}
QPointer
<
QSvgRenderer
>
lft
;
QPointer
<
QSvgRenderer
>
cntr
;
QPointer
<
QSvgRenderer
>
rght
;
QPointer
<
QSvgRenderer
>
mxd
;
int
mKind
;
bool
mHideMixed
;
};
class
UBGraphicsTextItemDelegate
:
public
UBGraphicsItemDelegate
{
Q_OBJECT
...
...
@@ -67,8 +125,11 @@ class UBGraphicsTextItemDelegate : public UBGraphicsItemDelegate
virtual
void
positionHandles
();
private
:
virtual
bool
mousePressEvent
(
QGraphicsSceneMouseEvent
*
event
);
virtual
bool
mouseMoveEvent
(
QGraphicsSceneMouseEvent
*
event
);
virtual
bool
mouseReleaseEvent
(
QGraphicsSceneMouseEvent
*
event
);
private
:
UBGraphicsTextItem
*
delegated
();
DelegateButton
*
mFontButton
;
...
...
@@ -76,10 +137,7 @@ class UBGraphicsTextItemDelegate : public UBGraphicsItemDelegate
DelegateButton
*
mDecreaseSizeButton
;
DelegateButton
*
mIncreaseSizeButton
;
DelegateButton
*
mAlignLeftButton
;
DelegateButton
*
mAlignCenterButton
;
DelegateButton
*
mAlignRightButton
;
DelegateButton
*
mAlighMixed
;
DelegateButton
*
mAlignButton
;
int
mLastFontPixelSize
;
...
...
@@ -89,9 +147,26 @@ class UBGraphicsTextItemDelegate : public UBGraphicsItemDelegate
private
:
void
customize
(
QFontDialog
&
fontDialog
);
void
ChangeTextSize
(
qreal
factor
,
textChangeMode
changeMode
);
void
updateAlighButtonState
();
bool
oneBlockSelection
();
void
saveTextCursorFormats
();
void
restoreTextCursorFormats
();
QFont
createDefaultFont
();
QAction
*
mEditableAction
;
struct
selectionData_t
{
selectionData_t
()
:
mButtonIsPressed
(
false
)
{}
bool
mButtonIsPressed
;
int
position
;
int
anchor
;
QString
html
;
QTextDocumentFragment
selection
;
QList
<
QTextBlockFormat
>
fmts
;
}
mSelectionData
;
private
slots
:
...
...
@@ -101,9 +176,12 @@ class UBGraphicsTextItemDelegate : public UBGraphicsItemDelegate
void
decreaseSize
();
void
increaseSize
();
void
alignButtonProcess
();
void
onCursorPositionChanged
(
const
QTextCursor
&
cursor
);
void
onModificationChanged
(
bool
ch
);
private
:
const
int
delta
;
};
#endif
/* UBGRAPHICSTEXTITEMDELEGATE_H_ */
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