diff --git a/examples/gallery/content/Controls.qml b/examples/gallery/content/Controls.qml index c0c1ff58598690650968df7bda70fcf978cff498..7650cab10f059772627df4df6078c0e67b2cad1f 100644 --- a/examples/gallery/content/Controls.qml +++ b/examples/gallery/content/Controls.qml @@ -66,13 +66,13 @@ Item { Button { id: button1 text: "Button 1" - width: 96 + width: 97 tooltip:"This is an interesting tool tip" } Button { id:button2 text:"Button 2" - width:96 + width:97 } } ComboBox { diff --git a/src/private/qstyleitem.cpp b/src/private/qstyleitem.cpp index 58827316e3e37e6e605644938f9df535f7ab0d8e..12270498487a240e2a62825152042cdc2e3b5474 100644 --- a/src/private/qstyleitem.cpp +++ b/src/private/qstyleitem.cpp @@ -721,6 +721,12 @@ QSize QStyleItem::sizeFromContents(int width, int height) int newWidth = qMax(width, btn->fontMetrics.width(btn->text)); int newHeight = qMax(height, btn->fontMetrics.height()); size = qApp->style()->sizeFromContents(QStyle::CT_PushButton, m_styleoption, QSize(newWidth, newHeight)); } +#ifdef Q_OS_MAC + if (style() == "mac") { + // Cancel out QMacStylePrivate::PushButton*Offset, or part of it + size -= QSize(7, 6); + } +#endif break; case ComboBox: { QStyleOptionComboBox *btn = qstyleoption_cast<QStyleOptionComboBox*>(m_styleoption); @@ -1063,6 +1069,12 @@ void QStyleItem::paint(QPainter *painter) switch (m_itemType) { case Button: +#ifdef Q_OS_MAC + if (style() == "mac") { + // Add back what was substracted in sizeFromContents() + m_styleoption->rect.adjust(-4, -2, 3, 4); + } +#endif qApp->style()->drawControl(QStyle::CE_PushButton, m_styleoption, painter); break; case ItemRow :{