From 7d12ef183ee6b7909c451a3042ecf8b1fc20f87f Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Fri, 18 Nov 2016 14:10:35 +0100 Subject: Clean up style selection code Turn styles into proper features and test for them using qtConfig/QT_CONFIG. Change-Id: I7e28785a46723364b90d8aa286f4d6e5ab085651 Reviewed-by: Oswald Buddenhagen --- src/widgets/widgets/qmdisubwindow.cpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'src/widgets/widgets/qmdisubwindow.cpp') diff --git a/src/widgets/widgets/qmdisubwindow.cpp b/src/widgets/widgets/qmdisubwindow.cpp index 2fff2fc729..a627c86871 100644 --- a/src/widgets/widgets/qmdisubwindow.cpp +++ b/src/widgets/widgets/qmdisubwindow.cpp @@ -158,7 +158,7 @@ #include #include #include -#if defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC) +#if QT_CONFIG(style_mac) #include #endif #include @@ -295,7 +295,7 @@ static void showToolTip(QHelpEvent *helpEvent, QWidget *widget, const QStyleOpti Q_ASSERT(helpEvent->type() == QEvent::ToolTip); Q_ASSERT(widget); -#if defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC) +#if QT_CONFIG(style_mac) // Native Mac windows don't show tool tip. if (qobject_cast(widget->style())) return; @@ -1076,7 +1076,7 @@ void QMdiSubWindowPrivate::updateCursor() { #ifndef QT_NO_CURSOR Q_Q(QMdiSubWindow); -#if defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC) +#if QT_CONFIG(style_mac) if (qobject_cast(q->style())) return; #endif @@ -1504,7 +1504,7 @@ void QMdiSubWindowPrivate::processClickedSubControl() q->showNormal(); break; case QStyle::SC_TitleBarMinButton: -#if defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC) +#if QT_CONFIG(style_mac) if (qobject_cast(q->style())) { if (q->isMinimized()) q->showNormal(); @@ -1521,7 +1521,7 @@ void QMdiSubWindowPrivate::processClickedSubControl() q->showNormal(); break; case QStyle::SC_TitleBarMaxButton: -#if defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC) +#if QT_CONFIG(style_mac) if (qobject_cast(q->style())) { if (q->isMaximized()) q->showNormal(); @@ -1568,7 +1568,7 @@ QRegion QMdiSubWindowPrivate::getRegion(Operation operation) const } QRegion region; -#if defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC) +#if QT_CONFIG(style_mac) if (qobject_cast(q->style())) return region; #endif @@ -1775,7 +1775,7 @@ bool QMdiSubWindowPrivate::drawTitleBarWhenMaximized() const if (isChildOfTabbedQMdiArea(q)) return false; -#if defined(Q_OS_DARWIN) && !defined(QT_NO_STYLE_MAC) +#if QT_CONFIG(style_mac) Q_UNUSED(isChildOfQMdiSubWindow); return true; #else @@ -2191,7 +2191,7 @@ void QMdiSubWindowPrivate::setSizeGrip(QSizeGrip *newSizeGrip) return; newSizeGrip->setFixedSize(newSizeGrip->sizeHint()); bool putSizeGripInLayout = layout ? true : false; -#if defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC) +#if QT_CONFIG(style_mac) if (qobject_cast(q->style())) putSizeGripInLayout = false; #endif @@ -2843,7 +2843,7 @@ bool QMdiSubWindow::event(QEvent *event) d->isMaximizeMode = false; d->isWidgetHiddenByUs = false; if (!parent()) { -#if !defined(QT_NO_SIZEGRIP) && defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC) +#if !defined(QT_NO_SIZEGRIP) && QT_CONFIG(style_mac) if (qobject_cast(style())) delete d->sizeGrip; #endif @@ -2938,7 +2938,7 @@ void QMdiSubWindow::showEvent(QShowEvent *showEvent) return; } -#if !defined(QT_NO_SIZEGRIP) && defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC) +#if !defined(QT_NO_SIZEGRIP) && QT_CONFIG(style_mac) if (qobject_cast(style()) && !d->sizeGrip && !(windowFlags() & Qt::FramelessWindowHint)) { d->setSizeGrip(new QSizeGrip(this)); @@ -3333,7 +3333,7 @@ void QMdiSubWindow::mouseMoveEvent(QMouseEvent *mouseEvent) hoverRegion += style()->subControlRect(QStyle::CC_TitleBar, &options, d->hoveredSubControl, this); } -#if defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC) +#if QT_CONFIG(style_mac) if (qobject_cast(style()) && !hoverRegion.isEmpty()) hoverRegion += QRegion(0, 0, width(), d->titleBarHeight(options)); #endif @@ -3543,7 +3543,7 @@ QSize QMdiSubWindow::minimumSizeHint() const int sizeGripHeight = 0; if (d->sizeGrip && d->sizeGrip->isVisibleTo(const_cast(this))) sizeGripHeight = d->sizeGrip->height(); -#if defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC) +#if QT_CONFIG(style_mac) else if (parent() && qobject_cast(style()) && !d->sizeGrip) sizeGripHeight = style()->pixelMetric(QStyle::PM_SizeGripSize, 0, this); #endif -- cgit v1.2.3