QMacStyle::sizeFromContents: don't do anything in CT_Menu case

In this case we can safely return the same QSize which we accept since
it is already contains the right size for the given menu and this size
will be bounded to screen geometry before QMenu will be displayed
anyway. We also get rid of one dependency on HITheme.

Change-Id: I7502a96d180fc4a41ce3dfabe8a200b886016348
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
This commit is contained in:
Oleg Yadrov 2017-02-17 11:23:46 -08:00
parent 6c9b558153
commit 10d0f4cba9

View File

@ -6759,12 +6759,7 @@ QSize QMacStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt,
break;
}
case CT_Menu: {
QStyleHintReturnMask menuMask;
QStyleOption myOption = *opt;
myOption.rect.setSize(sz);
if (proxy()->styleHint(SH_Menu_Mask, &myOption, widget, &menuMask)) {
sz = menuMask.region.boundingRect().size();
}
sz = csz;
break; }
case CT_HeaderSection:{
const QStyleOptionHeader *header = qstyleoption_cast<const QStyleOptionHeader *>(opt);