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
e9f745b1
Commit
e9f745b1
authored
Sep 20, 2013
by
Didier Clerc
Committed by
Claudio Valerio
Oct 09, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed the color issue on text item when modifying the text size
parent
552de996
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
5 deletions
+7
-5
UBGraphicsTextItem.cpp
src/domain/UBGraphicsTextItem.cpp
+0
-1
UBGraphicsTextItemDelegate.cpp
src/domain/UBGraphicsTextItemDelegate.cpp
+7
-4
No files found.
src/domain/UBGraphicsTextItem.cpp
View file @
e9f745b1
...
...
@@ -61,7 +61,6 @@ UBGraphicsTextItem::UBGraphicsTextItem(QGraphicsItem * parent) :
setData
(
UBGraphicsItemData
::
ItemLayerType
,
UBItemLayerType
::
Object
);
setData
(
UBGraphicsItemData
::
itemLayerType
,
QVariant
(
itemLayerType
::
ObjectItem
));
//Necessary to set if we want z value to be assigned correctly
setFlag
(
QGraphicsItem
::
ItemIsSelectable
,
true
);
setFlag
(
QGraphicsItem
::
ItemSendsGeometryChanges
,
true
);
...
...
src/domain/UBGraphicsTextItemDelegate.cpp
View file @
e9f745b1
...
...
@@ -367,8 +367,6 @@ void UBGraphicsTextItemDelegate::ChangeTextSize(qreal factor, textChangeMode cha
int
startPos
=
qMin
(
cursor
.
anchor
(),
cursor
.
position
());
int
endPos
=
qMax
(
cursor
.
anchor
(),
cursor
.
position
());
qDebug
()
<<
"start: "
<<
startPos
<<
", stop: "
<<
endPos
;
QFont
curFont
;
QFont
nextCharFont
;
bool
bEndofTheSameBlock
;
...
...
@@ -376,6 +374,8 @@ void UBGraphicsTextItemDelegate::ChangeTextSize(qreal factor, textChangeMode cha
int
iPointSize
;
int
iNextPointSize
;
int
iCursorPos
=
startPos
;
QBrush
curBrush
;
QBrush
nextCharBrush
;
// we search continuous blocks of the text with the same PointSize and allpy new settings for them.
cursor
.
setPosition
(
startPos
,
QTextCursor
::
MoveAnchor
);
...
...
@@ -387,6 +387,7 @@ void UBGraphicsTextItemDelegate::ChangeTextSize(qreal factor, textChangeMode cha
// Here we get the point size of the first character
cursor
.
setPosition
(
iCursorPos
+
1
,
QTextCursor
::
KeepAnchor
);
curFont
=
cursor
.
charFormat
().
font
();
curBrush
=
cursor
.
charFormat
().
foreground
();
iPointSize
=
curFont
.
pointSize
();
// Then we position the end cursor to the start cursor position
...
...
@@ -397,9 +398,10 @@ void UBGraphicsTextItemDelegate::ChangeTextSize(qreal factor, textChangeMode cha
// Get the next character font size
cursor
.
setPosition
(
iCursorPos
+
iBlockLen
+
1
,
QTextCursor
::
KeepAnchor
);
nextCharFont
=
cursor
.
charFormat
().
font
();
nextCharBrush
=
cursor
.
charFormat
().
foreground
();
iNextPointSize
=
nextCharFont
.
pointSize
();
if
((
iPointSize
!=
iNextPointSize
)
||
(
iCursorPos
+
iBlockLen
>=
endPos
)
||
(
0
!=
curFont
.
family
().
compare
(
nextCharFont
.
family
()))){
if
((
iPointSize
!=
iNextPointSize
)
||
(
iCursorPos
+
iBlockLen
>=
endPos
)
||
(
0
!=
curFont
.
family
().
compare
(
nextCharFont
.
family
()))
||
(
curBrush
!=
nextCharBrush
)
){
bEndofTheSameBlock
=
true
;
break
;
}
...
...
@@ -409,11 +411,12 @@ void UBGraphicsTextItemDelegate::ChangeTextSize(qreal factor, textChangeMode cha
}
while
(
!
bEndofTheSameBlock
);
//setting new parame
n
ers
//setting new parame
t
ers
QFont
tmpFont
=
curFont
;
int
iNewPointSize
=
(
changeSize
==
changeMode
)
?
(
iPointSize
+
factor
)
:
(
iPointSize
*
factor
);
tmpFont
.
setPointSize
(
(
iNewPointSize
>
0
)
?
iNewPointSize
:
1
);
textFormat
.
setFont
(
tmpFont
);
textFormat
.
setForeground
(
curBrush
);
cursor
.
setPosition
(
iCursorPos
+
iBlockLen
,
QTextCursor
::
KeepAnchor
);
cursor
.
setCharFormat
(
textFormat
);
...
...
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