Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Plasma
Oxygen
Commits
cbc7d9c7
Commit
cbc7d9c7
authored
Jun 17, 2015
by
Hugo Pereira Da Costa
Browse files
Properly account for MenuItem text size when computing sizeFromContents
BUG: 349258
parent
d599d046
Changes
1
Hide whitespace changes
Inline
Side-by-side
kstyle/oxygenstyle.cpp
View file @
cbc7d9c7
...
...
@@ -2996,7 +2996,11 @@ namespace Oxygen
const
int
iconWidth
(
qMax
(
pixelMetric
(
PM_SmallIconSize
,
option
,
widget
),
menuItemOption
->
maxIconWidth
)
);
const
int
textHeight
(
menuItemOption
->
fontMetrics
.
height
()
);
if
(
!
menuItemOption
->
icon
.
isNull
()
)
size
.
setHeight
(
qMax
(
size
.
height
(),
iconWidth
)
);
if
(
!
menuItemOption
->
text
.
isEmpty
()
)
size
.
setHeight
(
qMax
(
size
.
height
(),
textHeight
)
);
if
(
!
menuItemOption
->
text
.
isEmpty
()
)
{
size
.
setHeight
(
qMax
(
size
.
height
(),
textHeight
)
);
size
.
setWidth
(
qMax
(
size
.
width
(),
menuItemOption
->
fontMetrics
.
width
(
menuItemOption
->
text
)
)
);
}
return
sizeFromContents
(
CT_ToolButton
,
&
toolButtonOption
,
size
,
widget
);
...
...
@@ -8511,7 +8515,7 @@ namespace Oxygen
toolButtonOption
.
subControls
=
SC_ToolButton
;
toolButtonOption
.
icon
=
menuItemOption
->
icon
;
int
iconWidth
(
pixelMetric
(
PM_SmallIconSize
,
menuItemOption
,
widget
)
);
const
int
iconWidth
(
pixelMetric
(
PM_SmallIconSize
,
menuItemOption
,
widget
)
);
toolButtonOption
.
iconSize
=
QSize
(
iconWidth
,
iconWidth
);
toolButtonOption
.
text
=
menuItemOption
->
text
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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