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
0d2565c2
Commit
0d2565c2
authored
Jan 19, 2012
by
Aleksei Kanash
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SANKORE-466. Mechanism of text resizing improvement.
parent
484968fe
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
13 deletions
+38
-13
UBGraphicsTextItemDelegate.cpp
src/domain/UBGraphicsTextItemDelegate.cpp
+38
-13
No files found.
src/domain/UBGraphicsTextItemDelegate.cpp
View file @
0d2565c2
...
...
@@ -301,27 +301,52 @@ void UBGraphicsTextItemDelegate::ChangeTextSize(int delta)
int
startPos
=
qMin
(
cursor
.
anchor
(),
cursor
.
position
());
int
endPos
=
qMax
(
cursor
.
anchor
(),
cursor
.
position
());
for
(
int
i
=
startPos
;
i
<
endPos
;
i
++
)
{
// selecting single symbol
cursor
.
setPosition
(
i
,
QTextCursor
::
MoveAnchor
);
cursor
.
setPosition
(
i
+
1
,
QTextCursor
::
KeepAnchor
);
QFont
curFont
;
bool
bEndofTheSameBlock
;
int
iBlockLen
;
int
iPointSize
;
int
inewPointSize
;
int
iCursorPos
=
startPos
;
//setting new parameners
QFont
curFont
=
cursor
.
charFormat
().
font
();
// we search continuous blocks of the text with the same PointSize and allpy new settings for them.
while
(
iCursorPos
<
endPos
)
{
bEndofTheSameBlock
=
false
;
iBlockLen
=
0
;
cursor
.
setPosition
(
iCursorPos
+
1
,
QTextCursor
::
KeepAnchor
);
iPointSize
=
cursor
.
charFormat
().
font
().
pointSize
();
cursor
.
setPosition
(
iCursorPos
,
QTextCursor
::
KeepAnchor
);
curFont
=
cursor
.
charFormat
().
font
();
do
{
iBlockLen
++
;
cursor
.
setPosition
(
iCursorPos
+
iBlockLen
+
1
,
QTextCursor
::
KeepAnchor
);
inewPointSize
=
cursor
.
charFormat
().
font
().
pointSize
();
cursor
.
setPosition
(
iCursorPos
+
iBlockLen
,
QTextCursor
::
KeepAnchor
);
if
((
iPointSize
!=
inewPointSize
)
||
(
iCursorPos
+
iBlockLen
>=
endPos
))
bEndofTheSameBlock
=
true
;
int
pointSize
=
curFont
.
pointSize
()
+
delta
;
}
while
(
!
bEndofTheSameBlock
)
;
curFont
.
setPointSize
(
pointSize
);
//setting new parameners
curFont
.
setPointSize
(
iPointSize
+
delta
);
textFormat
.
setFont
(
curFont
);
cursor
.
mergeCharFormat
(
textFormat
);
delegated
()
->
setTextCursor
(
cursor
);
UBSettings
::
settings
()
->
setFontPointSize
(
pointSize
);
delegated
()
->
document
()
->
adjustSize
()
;
delegated
()
->
setFont
(
curFont
);
iCursorPos
+=
iBlockLen
;
cursor
.
setPosition
(
iCursorPos
,
QTextCursor
::
MoveAnchor
);
}
delegated
()
->
document
()
->
adjustSize
();
delegated
()
->
setFont
(
curFont
);
UBSettings
::
settings
()
->
setFontPointSize
(
iPointSize
);
//returning initial selection
cursor
.
setPosition
(
anchorPos
,
QTextCursor
::
MoveAnchor
);
cursor
.
setPosition
(
cursorPos
,
QTextCursor
::
KeepAnchor
);
...
...
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