summaryrefslogtreecommitdiffstats
path: root/src/widgets/styles/qcommonstyle.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/widgets/styles/qcommonstyle.cpp')
-rw-r--r--src/widgets/styles/qcommonstyle.cpp44
1 files changed, 39 insertions, 5 deletions
diff --git a/src/widgets/styles/qcommonstyle.cpp b/src/widgets/styles/qcommonstyle.cpp
index 69c9230b4b..752e385aa5 100644
--- a/src/widgets/styles/qcommonstyle.cpp
+++ b/src/widgets/styles/qcommonstyle.cpp
@@ -48,8 +48,14 @@
#include <qcache.h>
#include <qdockwidget.h>
#include <qdrawutil.h>
+#if QT_CONFIG(dialogbuttonbox)
#include <qdialogbuttonbox.h>
+#endif
+#if QT_CONFIG(formlayout)
#include <qformlayout.h>
+#else
+#include <qlayout.h>
+#endif
#include <qgroupbox.h>
#include <qmath.h>
#include <qmenu.h>
@@ -410,6 +416,8 @@ void QCommonStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, Q
proxy()->drawItemPixmap(p, opt->rect, Qt::AlignCenter, pixmap);
break;
}
+#else
+ Q_UNUSED(d);
#endif // QT_NO_TABBAR
case PE_FrameTabWidget:
case PE_FrameWindow:
@@ -1099,7 +1107,7 @@ void QCommonStylePrivate::tabLayout(const QStyleOptionTab *opt, const QWidget *w
|| opt->shape == QTabBar::TriangularEast
|| opt->shape == QTabBar::TriangularWest;
if (verticalTabs)
- tr.setRect(0, 0, tr.height(), tr.width()); //0, 0 as we will have a translate transform
+ tr.setRect(0, 0, tr.height(), tr.width()); // 0, 0 as we will have a translate transform
int verticalShift = proxyStyle->pixelMetric(QStyle::PM_TabBarTabShiftVertical, opt, widget);
int horizontalShift = proxyStyle->pixelMetric(QStyle::PM_TabBarTabShiftHorizontal, opt, widget);
@@ -1122,7 +1130,7 @@ void QCommonStylePrivate::tabLayout(const QStyleOptionTab *opt, const QWidget *w
// right widget
if (!opt->rightButtonSize.isEmpty()) {
tr.setRight(tr.right() - 4 -
- (verticalTabs ? opt->rightButtonSize.height() : opt->rightButtonSize.width()));
+ (verticalTabs ? opt->rightButtonSize.height() : opt->rightButtonSize.width()));
}
// icon
@@ -1134,12 +1142,12 @@ void QCommonStylePrivate::tabLayout(const QStyleOptionTab *opt, const QWidget *w
}
QSize tabIconSize = opt->icon.actualSize(iconSize,
(opt->state & QStyle::State_Enabled) ? QIcon::Normal : QIcon::Disabled,
- (opt->state & QStyle::State_Selected) ? QIcon::On : QIcon::Off );
- // High-dpi icons do not need adjustmet; make sure tabIconSize is not larger than iconSize
+ (opt->state & QStyle::State_Selected) ? QIcon::On : QIcon::Off);
+ // High-dpi icons do not need adjustment; make sure tabIconSize is not larger than iconSize
tabIconSize = QSize(qMin(tabIconSize.width(), iconSize.width()), qMin(tabIconSize.height(), iconSize.height()));
*iconRect = QRect(tr.left(), tr.center().y() - tabIconSize.height() / 2,
- tabIconSize.width(), tabIconSize .height());
+ tabIconSize.width(), tabIconSize.height());
if (!verticalTabs)
*iconRect = proxyStyle->visualRect(opt->direction, opt->rect, *iconRect);
tr.setLeft(tr.left() + tabIconSize.width() + 4);
@@ -2309,6 +2317,9 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
default:
break;
}
+#if !QT_CONFIG(tabbar) && !QT_CONFIG(itemviews)
+ Q_UNUSED(d);
+#endif
}
/*!
@@ -3053,6 +3064,9 @@ QRect QCommonStyle::subElementRect(SubElement sr, const QStyleOption *opt,
break;
}
return r;
+#if !QT_CONFIG(tabwidget) && !QT_CONFIG(itemviews)
+ Q_UNUSED(d);
+#endif
}
#ifndef QT_NO_DIAL
@@ -4358,6 +4372,9 @@ QRect QCommonStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex
default:
qWarning("QCommonStyle::subControlRect: Case %d not handled", cc);
}
+#if !QT_CONFIG(slider) && !QT_CONFIG(spinbox) && !QT_CONFIG(toolbutton) && !QT_CONFIG(groupbox)
+ Q_UNUSED(widget);
+#endif
return ret;
}
@@ -4879,8 +4896,12 @@ QSize QCommonStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt,
QRect decorationRect, displayRect, checkRect;
d->viewItemLayout(vopt, &checkRect, &decorationRect, &displayRect, true);
sz = (decorationRect|displayRect|checkRect).size();
+ if (decorationRect.isValid() && sz.height() == decorationRect.height())
+ sz.rheight() += 2; // Prevent icons from overlapping.
}
break;
+#else
+ Q_UNUSED(d);
#endif // QT_NO_ITEMVIEWS
#ifndef QT_NO_SPINBOX
case CT_SpinBox:
@@ -4927,9 +4948,11 @@ int QCommonStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget
case SH_ScrollBar_ContextMenu:
ret = true;
break;
+#if QT_CONFIG(dialogbuttonbox)
case SH_DialogButtons_DefaultButton: // This value not used anywhere.
ret = QDialogButtonBox::AcceptRole;
break;
+#endif
#ifndef QT_NO_GROUPBOX
case SH_GroupBox_TextLabelVerticalAlignment:
ret = Qt::AlignVCenter;
@@ -5117,11 +5140,13 @@ int QCommonStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget
case SH_TabBar_ElideMode:
ret = Qt::ElideNone;
break;
+#if QT_CONFIG(dialogbuttonbox)
case SH_DialogButtonLayout:
ret = QDialogButtonBox::WinLayout;
if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme())
ret = theme->themeHint(QPlatformTheme::DialogButtonBoxLayout).toInt();
break;
+#endif
case SH_ComboBox_PopupFrameStyle:
ret = QFrame::StyledPanel | QFrame::Plain;
break;
@@ -5167,12 +5192,14 @@ int QCommonStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget
ret = QWizard::ClassicStyle;
break;
#endif
+#if QT_CONFIG(formlayout)
case SH_FormLayoutWrapPolicy:
ret = QFormLayout::DontWrapRows;
break;
case SH_FormLayoutFieldGrowthPolicy:
ret = QFormLayout::AllNonFixedFieldsGrow;
break;
+#endif
case SH_FormLayoutFormAlignment:
ret = Qt::AlignLeft | Qt::AlignTop;
break;
@@ -5244,6 +5271,7 @@ int QCommonStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget
return ret;
}
+#if QT_CONFIG(imageformat_xpm)
static QPixmap cachedPixmapFromXPM(const char * const *xpm)
{
QPixmap result;
@@ -5256,6 +5284,7 @@ static QPixmap cachedPixmapFromXPM(const char * const *xpm)
}
static inline QPixmap titleBarMenuCachedPixmapFromXPM() { return cachedPixmapFromXPM(qt_menu_xpm); }
+#endif // QT_CONFIG(imageformat_xpm)
#ifndef QT_NO_IMAGEFORMAT_PNG
static inline QString clearText16IconPath()
@@ -5264,6 +5293,7 @@ static inline QString clearText16IconPath()
}
#endif // !QT_NO_IMAGEFORMAT_PNG
+#if defined(Q_OS_WIN) || QT_CONFIG(imageformat_png)
static QIcon clearTextIcon(bool rtl)
{
const QString directionalThemeName = rtl
@@ -5287,6 +5317,7 @@ static QIcon clearTextIcon(bool rtl)
#endif // !QT_NO_IMAGEFORMAT_PNG
return icon;
}
+#endif
/*! \reimp */
QPixmap QCommonStyle::standardPixmap(StandardPixmap sp, const QStyleOption *option,
@@ -5631,6 +5662,9 @@ QPixmap QCommonStyle::standardPixmap(StandardPixmap sp, const QStyleOption *opti
}
#endif //QT_NO_IMAGEFORMAT_XPM
+#if !QT_CONFIG(imageformat_png) && !QT_CONFIG(imageformat_xpm) && !QT_CONFIG(imageformat_png)
+ Q_UNUSED(rtl);
+#endif
return QPixmap();
}