summaryrefslogtreecommitdiffstats
path: root/src/widgets
diff options
context:
space:
mode:
Diffstat (limited to 'src/widgets')
-rw-r--r--src/widgets/kernel/qlayout.cpp2
-rw-r--r--src/widgets/kernel/qwidget.cpp2
-rw-r--r--src/widgets/styles/qcommonstyle.cpp23
-rw-r--r--src/widgets/styles/qfusionstyle.cpp15
-rw-r--r--src/widgets/styles/qpixmapstyle.cpp17
-rw-r--r--src/widgets/styles/qstylehelper.cpp2
-rw-r--r--src/widgets/styles/qstylesheetstyle.cpp4
-rw-r--r--src/widgets/styles/qwindowsstyle.cpp2
-rw-r--r--src/widgets/widgets/qabstractspinbox.cpp2
-rw-r--r--src/widgets/widgets/qdatetimeedit.cpp1
-rw-r--r--src/widgets/widgets/qeffects.cpp1
-rw-r--r--src/widgets/widgets/qmenu.cpp4
-rw-r--r--src/widgets/widgets/qtabbar.cpp5
-rw-r--r--src/widgets/widgets/qtoolbar.cpp2
-rw-r--r--src/widgets/widgets/qwidgetlinecontrol.cpp1
15 files changed, 72 insertions, 11 deletions
diff --git a/src/widgets/kernel/qlayout.cpp b/src/widgets/kernel/qlayout.cpp
index b90be2b4f1..f88ed350c7 100644
--- a/src/widgets/kernel/qlayout.cpp
+++ b/src/widgets/kernel/qlayout.cpp
@@ -581,7 +581,7 @@ void QLayoutPrivate::doResize(const QSize &r)
QWidget *mw = q->parentWidget();
QRect rect = mw->testAttribute(Qt::WA_LayoutOnEntireRect) ? mw->rect() : mw->contentsRect();
const int mbTop = rect.top();
- rect.setTop(rect.top() + mbh);
+ rect.setTop(mbTop + mbh);
q->setGeometry(rect);
#ifndef QT_NO_MENUBAR
if (menubar)
diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp
index ad82e5eb2a..19e4a9a737 100644
--- a/src/widgets/kernel/qwidget.cpp
+++ b/src/widgets/kernel/qwidget.cpp
@@ -6763,12 +6763,12 @@ void QWidget::clearFocus()
bool QWidget::focusNextPrevChild(bool next)
{
- Q_D(QWidget);
QWidget* p = parentWidget();
bool isSubWindow = (windowType() == Qt::SubWindow);
if (!isWindow() && !isSubWindow && p)
return p->focusNextPrevChild(next);
#ifndef QT_NO_GRAPHICSVIEW
+ Q_D(QWidget);
if (d->extra && d->extra->proxyWidget)
return d->extra->proxyWidget->focusNextPrevChild(next);
#endif
diff --git a/src/widgets/styles/qcommonstyle.cpp b/src/widgets/styles/qcommonstyle.cpp
index 851b7a33c8..477d180a2b 100644
--- a/src/widgets/styles/qcommonstyle.cpp
+++ b/src/widgets/styles/qcommonstyle.cpp
@@ -416,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:
@@ -2315,6 +2317,9 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
default:
break;
}
+#if !QT_CONFIG(tabbar) && !QT_CONFIG(itemviews)
+ Q_UNUSED(d);
+#endif
}
/*!
@@ -3014,6 +3019,7 @@ QRect QCommonStyle::subElementRect(SubElement sr, const QStyleOption *opt,
r = subElementRect(SE_CheckBoxIndicator, opt, widget);
break;
}
+ Q_FALLTHROUGH();
case SE_ItemViewItemDecoration:
case SE_ItemViewItemText:
case SE_ItemViewItemFocusRect:
@@ -3058,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
@@ -4186,11 +4195,13 @@ QRect QCommonStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex
case SC_TitleBarContextHelpButton:
if (tb->titleBarFlags & Qt::WindowContextHelpButtonHint)
offset += delta;
+ Q_FALLTHROUGH();
case SC_TitleBarMinButton:
if (!isMinimized && (tb->titleBarFlags & Qt::WindowMinimizeButtonHint))
offset += delta;
else if (sc == SC_TitleBarMinButton)
break;
+ Q_FALLTHROUGH();
case SC_TitleBarNormalButton:
if (isMinimized && (tb->titleBarFlags & Qt::WindowMinimizeButtonHint))
offset += delta;
@@ -4198,21 +4209,25 @@ QRect QCommonStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex
offset += delta;
else if (sc == SC_TitleBarNormalButton)
break;
+ Q_FALLTHROUGH();
case SC_TitleBarMaxButton:
if (!isMaximized && (tb->titleBarFlags & Qt::WindowMaximizeButtonHint))
offset += delta;
else if (sc == SC_TitleBarMaxButton)
break;
+ Q_FALLTHROUGH();
case SC_TitleBarShadeButton:
if (!isMinimized && (tb->titleBarFlags & Qt::WindowShadeButtonHint))
offset += delta;
else if (sc == SC_TitleBarShadeButton)
break;
+ Q_FALLTHROUGH();
case SC_TitleBarUnshadeButton:
if (isMinimized && (tb->titleBarFlags & Qt::WindowShadeButtonHint))
offset += delta;
else if (sc == SC_TitleBarUnshadeButton)
break;
+ Q_FALLTHROUGH();
case SC_TitleBarCloseButton:
if (tb->titleBarFlags & Qt::WindowSystemMenuHint)
offset += delta;
@@ -4357,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;
}
@@ -5278,6 +5296,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
@@ -5301,6 +5320,7 @@ static QIcon clearTextIcon(bool rtl)
#endif // !QT_NO_IMAGEFORMAT_PNG
return icon;
}
+#endif
/*! \reimp */
QPixmap QCommonStyle::standardPixmap(StandardPixmap sp, const QStyleOption *option,
@@ -5645,6 +5665,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();
}
diff --git a/src/widgets/styles/qfusionstyle.cpp b/src/widgets/styles/qfusionstyle.cpp
index 98d45587f0..c874b12e45 100644
--- a/src/widgets/styles/qfusionstyle.cpp
+++ b/src/widgets/styles/qfusionstyle.cpp
@@ -908,8 +908,6 @@ void QFusionStyle::drawPrimitive(PrimitiveElement elem,
return;
}
- BEGIN_STYLE_PIXMAPCACHE(QString::fromLatin1("pushbutton-%1").arg(isDefault))
- r = rect.adjusted(0, 1, -1, 0);
bool isEnabled = option->state & State_Enabled;
bool hasFocus = (option->state & State_HasFocus && option->state & State_KeyboardFocusChange);
@@ -923,6 +921,9 @@ void QFusionStyle::drawPrimitive(PrimitiveElement elem,
if (isDefault)
buttonColor = mergedColors(buttonColor, highlightedOutline.lighter(130), 90);
+ BEGIN_STYLE_PIXMAPCACHE(QStringLiteral("pushbutton-") + buttonColor.name(QColor::HexArgb))
+ r = rect.adjusted(0, 1, -1, 0);
+
p->setRenderHint(QPainter::Antialiasing, true);
p->translate(0.5, -0.5);
@@ -1953,9 +1954,13 @@ void QFusionStyle::drawComplexControl(ComplexControl control, const QStyleOption
Q_D (const QFusionStyle);
+#if QT_CONFIG(spinbox) || QT_CONFIG(slider)
QColor buttonColor = d->buttonColor(option->palette);
+#endif
+#if QT_CONFIG(slider)
QColor gradientStartColor = buttonColor.lighter(118);
QColor gradientStopColor = buttonColor;
+#endif
QColor outline = d->outline(option->palette);
QColor alphaCornerColor;
@@ -3575,11 +3580,13 @@ QRect QFusionStyle::subControlRect(ComplexControl control, const QStyleOptionCom
case SC_TitleBarContextHelpButton:
if (tb->titleBarFlags & Qt::WindowContextHelpButtonHint)
offset += delta;
+ Q_FALLTHROUGH();
case SC_TitleBarMinButton:
if (!isMinimized && (tb->titleBarFlags & Qt::WindowMinimizeButtonHint))
offset += delta;
else if (sc == SC_TitleBarMinButton)
break;
+ Q_FALLTHROUGH();
case SC_TitleBarNormalButton:
if (isMinimized && (tb->titleBarFlags & Qt::WindowMinimizeButtonHint))
offset += delta;
@@ -3587,21 +3594,25 @@ QRect QFusionStyle::subControlRect(ComplexControl control, const QStyleOptionCom
offset += delta;
else if (sc == SC_TitleBarNormalButton)
break;
+ Q_FALLTHROUGH();
case SC_TitleBarMaxButton:
if (!isMaximized && (tb->titleBarFlags & Qt::WindowMaximizeButtonHint))
offset += delta;
else if (sc == SC_TitleBarMaxButton)
break;
+ Q_FALLTHROUGH();
case SC_TitleBarShadeButton:
if (!isMinimized && (tb->titleBarFlags & Qt::WindowShadeButtonHint))
offset += delta;
else if (sc == SC_TitleBarShadeButton)
break;
+ Q_FALLTHROUGH();
case SC_TitleBarUnshadeButton:
if (isMinimized && (tb->titleBarFlags & Qt::WindowShadeButtonHint))
offset += delta;
else if (sc == SC_TitleBarUnshadeButton)
break;
+ Q_FALLTHROUGH();
case SC_TitleBarCloseButton:
if (tb->titleBarFlags & Qt::WindowSystemMenuHint)
offset += delta;
diff --git a/src/widgets/styles/qpixmapstyle.cpp b/src/widgets/styles/qpixmapstyle.cpp
index 19f4cc3617..de99b6ce7b 100644
--- a/src/widgets/styles/qpixmapstyle.cpp
+++ b/src/widgets/styles/qpixmapstyle.cpp
@@ -205,6 +205,9 @@ void QPixmapStyle::polish(QWidget *widget)
if (qobject_cast<QScrollBar*>(widget))
widget->setAttribute(Qt::WA_OpaquePaintEvent, false);
#endif
+#if !QT_CONFIG(progressbar) && !QT_CONFIG(combobox)
+ Q_UNUSED(d);
+#endif
QCommonStyle::polish(widget);
}
@@ -929,6 +932,10 @@ void QPixmapStyle::drawSlider(const QStyleOptionComplex *option,
painter->drawPixmap(handle, d->pixmaps.value(pix).pixmap);
}
}
+#else
+ Q_UNUSED(option);
+ Q_UNUSED(painter);
+ Q_UNUSED(widget);
#endif // QT_CONFIG(slider)
}
@@ -968,6 +975,10 @@ void QPixmapStyle::drawScrollBar(const QStyleOptionComplex *option,
? SB_Horizontal : SB_Vertical;
drawCachedPixmap(control, rect, painter);
}
+#else
+ Q_UNUSED(option);
+ Q_UNUSED(painter);
+ Q_UNUSED(widget);
#endif // QT_CONFIG(slider)
}
@@ -1044,6 +1055,9 @@ QSize QPixmapStyle::sliderSizeFromContents(const QStyleOption *option,
else
return QSize(desc.size.width(), result.height());
#else // QT_CONFIG(slider)
+ Q_UNUSED(option);
+ Q_UNUSED(contentsSize);
+ Q_UNUSED(widget);
return QSize();
#endif // QT_CONFIG(slider)
}
@@ -1160,6 +1174,9 @@ QRect QPixmapStyle::scrollBarSubControlRect(const QStyleOptionComplex *option,
}
}
}
+#else
+ Q_UNUSED(option);
+ Q_UNUSED(sc);
#endif // QT_CONFIG(slider)
return QRect();
}
diff --git a/src/widgets/styles/qstylehelper.cpp b/src/widgets/styles/qstylehelper.cpp
index b315c14858..6a5a27ed6d 100644
--- a/src/widgets/styles/qstylehelper.cpp
+++ b/src/widgets/styles/qstylehelper.cpp
@@ -415,6 +415,8 @@ QColor backgroundColor(const QPalette &pal, const QWidget* widget)
if (qobject_cast<const QScrollBar *>(widget) && widget->parent() &&
qobject_cast<const QAbstractScrollArea *>(widget->parent()->parent()))
return widget->parentWidget()->parentWidget()->palette().color(QPalette::Base);
+#else
+ Q_UNUSED(widget);
#endif
return pal.color(QPalette::Base);
}
diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp
index 260a660bf9..c6615a1945 100644
--- a/src/widgets/styles/qstylesheetstyle.cpp
+++ b/src/widgets/styles/qstylesheetstyle.cpp
@@ -4376,7 +4376,7 @@ void QStyleSheetStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *op
break;
}
#endif
- //fall tghought
+ Q_FALLTHROUGH();
case PE_PanelMenu:
case PE_PanelStatusBar:
if(rule.hasDrawable()) {
@@ -4935,7 +4935,7 @@ QSize QStyleSheetStyle::sizeFromContents(ContentsType ct, const QStyleOption *op
case CT_ToolButton:
if (rule.hasBox() || !rule.hasNativeBorder() || !rule.baseStyleCanDraw())
sz += QSize(3, 3); // ### broken QToolButton
- //fall thought
+ Q_FALLTHROUGH();
case CT_ComboBox:
case CT_PushButton:
if (rule.hasBox() || !rule.hasNativeBorder()) {
diff --git a/src/widgets/styles/qwindowsstyle.cpp b/src/widgets/styles/qwindowsstyle.cpp
index 0ce8dde74c..b537931f49 100644
--- a/src/widgets/styles/qwindowsstyle.cpp
+++ b/src/widgets/styles/qwindowsstyle.cpp
@@ -1734,6 +1734,8 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai
step = (animation->animationStep() / 3) % chunkCount;
else
d->startAnimation(new QProgressStyleAnimation(d->animationFps, opt->styleObject));
+#else
+ Q_UNUSED(d);
#endif
int chunksInRow = 5;
int myY = pbBits.rect.y();
diff --git a/src/widgets/widgets/qabstractspinbox.cpp b/src/widgets/widgets/qabstractspinbox.cpp
index 7ee53587e6..501d9560d9 100644
--- a/src/widgets/widgets/qabstractspinbox.cpp
+++ b/src/widgets/widgets/qabstractspinbox.cpp
@@ -980,6 +980,7 @@ void QAbstractSpinBox::keyPressEvent(QKeyEvent *event)
case Qt::Key_PageDown:
steps *= 10;
isPgUpOrDown = true;
+ Q_FALLTHROUGH();
case Qt::Key_Up:
case Qt::Key_Down: {
#ifdef QT_KEYPAD_NAVIGATION
@@ -2115,6 +2116,7 @@ int QAbstractSpinBoxPrivate::variantCompare(const QVariant &arg1, const QVariant
case QVariant::Invalid:
if (arg2.type() == QVariant::Invalid)
return 0;
+ Q_FALLTHROUGH();
default:
Q_ASSERT_X(0, "QAbstractSpinBoxPrivate::variantCompare",
qPrintable(QString::fromLatin1("Internal error 3 (%1 %2)").
diff --git a/src/widgets/widgets/qdatetimeedit.cpp b/src/widgets/widgets/qdatetimeedit.cpp
index cebfb9316a..0eaa110bee 100644
--- a/src/widgets/widgets/qdatetimeedit.cpp
+++ b/src/widgets/widgets/qdatetimeedit.cpp
@@ -1113,6 +1113,7 @@ void QDateTimeEdit::keyPressEvent(QKeyEvent *event)
&& !(event->modifiers() & ~(Qt::ShiftModifier|Qt::KeypadModifier));
break;
}
+ Q_FALLTHROUGH();
case Qt::Key_Left:
case Qt::Key_Right:
if (event->key() == Qt::Key_Left || event->key() == Qt::Key_Right) {
diff --git a/src/widgets/widgets/qeffects.cpp b/src/widgets/widgets/qeffects.cpp
index ecd85c2ca7..736f2599fe 100644
--- a/src/widgets/widgets/qeffects.cpp
+++ b/src/widgets/widgets/qeffects.cpp
@@ -196,6 +196,7 @@ bool QAlphaWidget::eventFilter(QObject *o, QEvent *e)
case QEvent::Close:
if (o != widget)
break;
+ Q_FALLTHROUGH();
case QEvent::MouseButtonPress:
case QEvent::MouseButtonDblClick:
showWidget = false;
diff --git a/src/widgets/widgets/qmenu.cpp b/src/widgets/widgets/qmenu.cpp
index 4e55f0b132..88d1e16bd8 100644
--- a/src/widgets/widgets/qmenu.cpp
+++ b/src/widgets/widgets/qmenu.cpp
@@ -3457,7 +3457,9 @@ void QMenu::actionEvent(QActionEvent *e)
QObject::connect(menuItem, SIGNAL(activated()), e->action(), SLOT(trigger()));
QObject::connect(menuItem, SIGNAL(hovered()), e->action(), SIGNAL(hovered()));
copyActionToPlatformItem(e->action(), menuItem, d->platformMenu);
- QPlatformMenuItem* beforeItem = d->platformMenu->menuItemForTag(reinterpret_cast<quintptr>(e->before()));
+ QPlatformMenuItem *beforeItem = e->before()
+ ? d->platformMenu->menuItemForTag(reinterpret_cast<quintptr>(e->before()))
+ : nullptr;
d->platformMenu->insertMenuItem(menuItem, beforeItem);
} else if (e->type() == QEvent::ActionRemoved) {
QPlatformMenuItem *menuItem = d->platformMenu->menuItemForTag(reinterpret_cast<quintptr>(e->action()));
diff --git a/src/widgets/widgets/qtabbar.cpp b/src/widgets/widgets/qtabbar.cpp
index eeece1a42a..d2bd7285ca 100644
--- a/src/widgets/widgets/qtabbar.cpp
+++ b/src/widgets/widgets/qtabbar.cpp
@@ -176,11 +176,10 @@ void QTabBarPrivate::initBasicStyleOption(QStyleOptionTab *option, int tabIndex)
if (tab.textColor.isValid())
option->palette.setColor(q->foregroundRole(), tab.textColor);
-#ifdef Q_OS_MACOS
- else if (isCurrent && !documentMode && q->isActiveWindow()) {
+ else if (q->style()->inherits("QMacStyle")
+ && isCurrent && !documentMode && q->isActiveWindow()) {
option->palette.setColor(QPalette::WindowText, Qt::white);
}
-#endif
option->icon = tab.icon;
option->iconSize = q->iconSize(); // Will get the default value then.
diff --git a/src/widgets/widgets/qtoolbar.cpp b/src/widgets/widgets/qtoolbar.cpp
index 2a0912df0a..48fa88b7a0 100644
--- a/src/widgets/widgets/qtoolbar.cpp
+++ b/src/widgets/widgets/qtoolbar.cpp
@@ -1143,7 +1143,7 @@ bool QToolBar::event(QEvent *event)
case QEvent::Hide:
if (!isHidden())
break;
- // fallthrough intended
+ Q_FALLTHROUGH();
case QEvent::Show:
d->toggleViewAction->setChecked(event->type() == QEvent::Show);
#ifdef Q_OS_OSX
diff --git a/src/widgets/widgets/qwidgetlinecontrol.cpp b/src/widgets/widgets/qwidgetlinecontrol.cpp
index a862274a3d..363e7157ac 100644
--- a/src/widgets/widgets/qwidgetlinecontrol.cpp
+++ b/src/widgets/widgets/qwidgetlinecontrol.cpp
@@ -1030,6 +1030,7 @@ void QWidgetLineControl::parseInputMask(const QString &maskFields)
break;
case '\\':
escape = true;
+ Q_FALLTHROUGH();
default:
s = true;
break;