Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Graphics
Okular
Commits
45702f22
Commit
45702f22
authored
Sep 24, 2020
by
Albert Astals Cid
Browse files
Port deprecated QFontMetrics::width -> horizontalAdvance
parent
78d983ee
Pipeline
#36047
passed with stage
in 17 minutes and 34 seconds
Changes
3
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
generators/xps/generator_xps.cpp
View file @
45702f22
...
...
@@ -880,7 +880,7 @@ void XpsHandler::processGlyph(XpsRenderNode &node)
if
(
advanceWidth
>
0.0
)
{
originAdvance
.
rx
()
+=
advanceWidth
;
}
else
{
originAdvance
.
rx
()
+=
metrics
.
width
(
thisChar
);
originAdvance
.
rx
()
+=
metrics
.
horizontalAdvance
(
thisChar
);
}
}
// qCWarning(OkularXpsDebug) << "Glyphs: " << atts.value("Fill") << ", " << atts.value("FontUri");
...
...
@@ -1607,7 +1607,7 @@ Okular::TextPage *XpsPage::textPage()
int
lastWidth
=
0
;
for
(
int
i
=
0
;
i
<
text
.
length
();
i
++
)
{
int
width
=
metrics
.
width
(
text
,
i
+
1
);
const
int
width
=
metrics
.
horizontalAdvance
(
text
,
i
+
1
);
Okular
::
NormalizedRect
*
rect
=
new
Okular
::
NormalizedRect
((
origin
.
x
()
+
lastWidth
)
/
m_pageSize
.
width
(),
(
origin
.
y
()
-
metrics
.
height
())
/
m_pageSize
.
height
(),
(
origin
.
x
()
+
width
)
/
m_pageSize
.
width
(),
origin
.
y
()
/
m_pageSize
.
height
());
...
...
ui/minibar.cpp
View file @
45702f22
...
...
@@ -285,7 +285,7 @@ void MiniBar::slotToolBarIconSizeChanged()
void
MiniBar
::
resizeForPage
(
int
pages
)
{
int
numberWidth
=
10
+
fontMetrics
().
width
(
QString
::
number
(
pages
));
const
int
numberWidth
=
10
+
fontMetrics
().
horizontalAdvance
(
QString
::
number
(
pages
));
m_pageNumberEdit
->
setMinimumWidth
(
numberWidth
);
m_pageNumberEdit
->
setMaximumWidth
(
2
*
numberWidth
);
m_pageLabelEdit
->
setMinimumWidth
(
numberWidth
);
...
...
ui/presentationwidget.cpp
View file @
45702f22
...
...
@@ -184,7 +184,7 @@ PresentationWidget::PresentationWidget(QWidget *parent, Okular::Document *doc, D
QFontMetrics
fm
(
m_pagesEdit
->
font
());
QStyleOptionFrame
option
;
option
.
initFrom
(
m_pagesEdit
);
m_pagesEdit
->
setMaximumWidth
(
fm
.
width
(
QString
::
number
(
m_document
->
pages
()))
+
2
*
style
()
->
pixelMetric
(
QStyle
::
PM_DefaultFrameWidth
,
&
option
,
m_pagesEdit
)
+
m_pagesEdit
->
setMaximumWidth
(
fm
.
horizontalAdvance
(
QString
::
number
(
m_document
->
pages
()))
+
2
*
style
()
->
pixelMetric
(
QStyle
::
PM_DefaultFrameWidth
,
&
option
,
m_pagesEdit
)
+
4
);
// the 4 comes from 2*horizontalMargin, horizontalMargin being a define in qlineedit.cpp
QIntValidator
*
validator
=
new
QIntValidator
(
1
,
m_document
->
pages
(),
m_pagesEdit
);
m_pagesEdit
->
setValidator
(
validator
);
...
...
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