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
Joao Oliveira
Okular
Commits
238fa979
Commit
238fa979
authored
Aug 08, 2019
by
Albert Astals Cid
Browse files
Merge remote-tracking branch 'origin/Applications/19.08'
parents
0507bea4
5099b615
Changes
1
Hide whitespace changes
Inline
Side-by-side
ui/sidebar.cpp
View file @
238fa979
...
...
@@ -189,7 +189,7 @@ void SidebarDelegate::paint( QPainter *painter, const QStyleOptionViewItem &opti
if
(
m_showText
)
{
QString
text
=
index
.
data
(
Qt
::
DisplayRole
).
toString
();
QRect
fontBoundaries
=
QFontMetrics
(
option
.
font
).
boundingRect
(
text
);
QRect
fontBoundaries
=
QFontMetrics
(
option
.
font
).
boundingRect
(
QRect
(),
Qt
::
AlignCenter
,
text
);
QPoint
textPos
(
ITEM_MARGIN_LEFT
+
(
option
.
rect
.
width
()
-
ITEM_MARGIN_LEFT
-
ITEM_MARGIN_RIGHT
-
fontBoundaries
.
width
()
)
/
2
,
ITEM_MARGIN_TOP
+
option
.
decorationSize
.
height
()
+
ITEM_PADDING
...
...
@@ -207,7 +207,7 @@ QSize SidebarDelegate::sizeHint( const QStyleOptionViewItem &option, const QMode
QSize
baseSize
(
option
.
decorationSize
.
width
(),
option
.
decorationSize
.
height
()
);
if
(
m_showText
)
{
QRect
fontBoundaries
=
QFontMetrics
(
option
.
font
).
boundingRect
(
index
.
data
(
Qt
::
DisplayRole
).
toString
()
);
QRect
fontBoundaries
=
QFontMetrics
(
option
.
font
).
boundingRect
(
QRect
(),
Qt
::
AlignCenter
,
index
.
data
(
Qt
::
DisplayRole
).
toString
()
);
baseSize
.
setWidth
(
qMax
(
fontBoundaries
.
width
(),
baseSize
.
width
()
)
);
baseSize
.
setHeight
(
baseSize
.
height
()
+
fontBoundaries
.
height
()
+
ITEM_PADDING
);
}
...
...
Write
Preview
Supports
Markdown
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