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
288b21c1
Commit
288b21c1
authored
Oct 21, 2019
by
Clément Fauconnier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
improved behavior on font style changes
parent
88dee1f9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
9 deletions
+7
-9
UBGraphicsTextItemDelegate.cpp
src/domain/UBGraphicsTextItemDelegate.cpp
+7
-9
No files found.
src/domain/UBGraphicsTextItemDelegate.cpp
View file @
288b21c1
...
...
@@ -353,9 +353,6 @@ void UBGraphicsTextItemDelegate::pickFont()
delegated
()
->
setTextCursor
(
curCursor
);
if
(
curCursor
.
selectedText
().
length
()
==
0
)
delegated
()
->
setFont
(
selectedFont
);
delegated
()
->
setSelected
(
true
);
delegated
()
->
document
()
->
adjustSize
();
delegated
()
->
contentsChanged
();
...
...
@@ -378,7 +375,7 @@ void UBGraphicsTextItemDelegate::pickColor()
if
(
colorDialog
.
exec
())
{
QColor
selectedColor
=
colorDialog
.
selectedColor
();
delegated
()
->
setDefaultTextColor
(
selectedColor
);
QTextCursor
curCursor
=
delegated
()
->
textCursor
();
QTextCharFormat
format
;
...
...
@@ -386,8 +383,11 @@ void UBGraphicsTextItemDelegate::pickColor()
curCursor
.
mergeCharFormat
(
format
);
delegated
()
->
setTextCursor
(
curCursor
);
if
(
!
curCursor
.
hasSelection
())
if
(
!
curCursor
.
hasSelection
()
||
(
curCursor
.
selectedText
().
length
()
==
delegated
()
->
toPlainText
().
length
()))
{
delegated
()
->
setDefaultTextColor
(
selectedColor
);
UBGraphicsTextItem
::
lastUsedTextColor
=
selectedColor
;
}
delegated
()
->
setSelected
(
true
);
delegated
()
->
document
()
->
adjustSize
();
...
...
@@ -600,11 +600,9 @@ void UBGraphicsTextItemDelegate::ChangeTextSize(qreal factor, textChangeMode cha
int
anchorPos
=
cursor
.
anchor
();
int
cursorPos
=
cursor
.
position
();
if
(
0
==
anchorPos
-
cursorPos
)
if
(
!
cursor
.
hasSelection
()
)
{
// If nothing is selected, then we select all the text
cursor
.
setPosition
(
0
,
QTextCursor
::
MoveAnchor
);
cursor
.
setPosition
(
cursor
.
document
()
->
characterCount
()
-
1
,
QTextCursor
::
KeepAnchor
);
cursor
.
select
(
QTextCursor
::
Document
);
}
// Now we got the real start and stop positions
...
...
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