Unsolved QComboBox returns incorrect rect on Mac
-
I am doing some custom painting inside a QComboBox. I call QComboBox::rect() to get the area to paint into inside paintEvent() in my derived class. This works fine on Windows. But is incorrect on Mac.
What I want:
What I get painting inside QComboBox::rect():
The QRect returned is 30 pixels high, but the actual QComboBox is only 20 pixels high. I can adjust the QRect by a few pixels to get the correct area, but I am worried this fudge won't work on all versions of macOS (past and present). Is there a reliable way get the QRect?I use a QItemDelegate to paint the customized drop-down menu for the QComboBox and that works fine (QStyleOptionViewItem::rect is correct). But there doesn't seem to be way to use the delegate to paint the unclicked state.
Any ideas?
--
Andy Brice
http://www.hyperplan.com -
@AndyBrice Just an idea: could it be related to High DPI scaling?
-
It might be related to high DPI. I am on a Mac Retina display.
--
Andy Brice
http://www.hyperplan.com -
Hi,
What version of Qt are you using ?
-
@SGaist I am using Qt 5.12.0 on Mac.
-
Did you check with a more recent version ?