diff options
Diffstat (limited to 'src/widgets')
-rw-r--r-- | src/widgets/dialogs/qmessagebox.cpp | 2 | ||||
-rw-r--r-- | src/widgets/itemviews/qheaderview.cpp | 12 | ||||
-rw-r--r-- | src/widgets/kernel/qapplication.cpp | 21 | ||||
-rw-r--r-- | src/widgets/kernel/qapplication_p.h | 7 | ||||
-rw-r--r-- | src/widgets/kernel/qstandardgestures.cpp | 2 | ||||
-rw-r--r-- | src/widgets/kernel/qwidget.cpp | 8 | ||||
-rw-r--r-- | src/widgets/kernel/qwidget_p.h | 2 | ||||
-rw-r--r-- | src/widgets/kernel/qwidgetbackingstore.cpp | 3 | ||||
-rw-r--r-- | src/widgets/styles/qcommonstyle.cpp | 7 | ||||
-rw-r--r-- | src/widgets/styles/qwindowsvistastyle.cpp | 13 | ||||
-rw-r--r-- | src/widgets/widgets/qdialogbuttonbox.cpp | 3 |
11 files changed, 62 insertions, 18 deletions
diff --git a/src/widgets/dialogs/qmessagebox.cpp b/src/widgets/dialogs/qmessagebox.cpp index dcddc693c8..3350a926f0 100644 --- a/src/widgets/dialogs/qmessagebox.cpp +++ b/src/widgets/dialogs/qmessagebox.cpp @@ -2565,8 +2565,10 @@ void QMessageBox::setDetailedText(const QString &text) d->detailsText->hide(); } if (!d->detailsButton) { + const bool autoAddOkButton = d->autoAddOkButton; // QTBUG-39334, addButton() clears the flag. d->detailsButton = new DetailButton(this); addButton(d->detailsButton, QMessageBox::ActionRole); + d->autoAddOkButton = autoAddOkButton; } d->detailsText->setText(text); } diff --git a/src/widgets/itemviews/qheaderview.cpp b/src/widgets/itemviews/qheaderview.cpp index f1bdfc8709..eac25d3833 100644 --- a/src/widgets/itemviews/qheaderview.cpp +++ b/src/widgets/itemviews/qheaderview.cpp @@ -2762,15 +2762,9 @@ QSize QHeaderView::sectionSizeFromContents(int logicalIndex) const opt.icon = qvariant_cast<QIcon>(variant); if (opt.icon.isNull()) opt.icon = qvariant_cast<QPixmap>(variant); - QSize size = style()->sizeFromContents(QStyle::CT_HeaderSection, &opt, QSize(), this); - if (isSortIndicatorShown()) { - int margin = style()->pixelMetric(QStyle::PM_HeaderMargin, &opt, this); - if (d->orientation == Qt::Horizontal) - size.rwidth() += size.height() + margin; - else - size.rheight() += size.width() + margin; - } - return size; + if (isSortIndicatorShown()) + opt.sortIndicator = QStyleOptionHeader::SortDown; + return style()->sizeFromContents(QStyle::CT_HeaderSection, &opt, QSize(), this); } /*! diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index edb9e9036c..94fcee4553 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -152,6 +152,20 @@ static void clearSystemPalette() QApplicationPrivate::sys_pal = 0; } +static QByteArray get_style_class_name() +{ + QScopedPointer<QStyle> s(QStyleFactory::create(QApplicationPrivate::desktopStyleKey())); + if (!s.isNull()) + return s->metaObject()->className(); + return QByteArray(); +} + +static QByteArray nativeStyleClassName() +{ + static QByteArray name = get_style_class_name(); + return name; +} + #ifdef Q_OS_WINCE int QApplicationPrivate::autoMaximizeThreshold = -1; bool QApplicationPrivate::autoSipEnabled = false; @@ -392,6 +406,8 @@ void qt_init_tooltip_palette(); void qt_cleanup(); QStyle *QApplicationPrivate::app_style = 0; // default application style +bool QApplicationPrivate::overrides_native_style = false; // whether native QApplication style is + // overridden, i.e. not native QString QApplicationPrivate::styleOverride; // style override #ifndef QT_NO_STYLE_STYLESHEET @@ -1153,6 +1169,8 @@ QStyle *QApplication::style() Q_ASSERT(!"No styles available!"); return 0; } + QApplicationPrivate::overrides_native_style = + app_style->objectName() != QApplicationPrivate::desktopStyleKey(); } // take ownership of the style QApplicationPrivate::app_style->setParent(qApp); @@ -1217,6 +1235,9 @@ void QApplication::setStyle(QStyle *style) QStyle *old = QApplicationPrivate::app_style; // save + QApplicationPrivate::overrides_native_style = + nativeStyleClassName() == QByteArray(style->metaObject()->className()); + #ifndef QT_NO_STYLE_STYLESHEET if (!QApplicationPrivate::styleSheet.isEmpty() && !qobject_cast<QStyleSheetStyle *>(style)) { // we have a stylesheet already and a new style is being set diff --git a/src/widgets/kernel/qapplication_p.h b/src/widgets/kernel/qapplication_p.h index 0284a613d4..d5efb62dda 100644 --- a/src/widgets/kernel/qapplication_p.h +++ b/src/widgets/kernel/qapplication_p.h @@ -150,6 +150,12 @@ public: bool canQuit(); #endif + //style + static bool usesNativeStyle() + { + return !overrides_native_style; + } + bool notify_helper(QObject *receiver, QEvent * e); void construct( @@ -184,6 +190,7 @@ public: static QSize app_strut; static QWidgetList *popupWidgets; static QStyle *app_style; + static bool overrides_native_style; static int app_cspec; static QPalette *sys_pal; static QPalette *set_pal; diff --git a/src/widgets/kernel/qstandardgestures.cpp b/src/widgets/kernel/qstandardgestures.cpp index 64ab68257a..e57c3285d2 100644 --- a/src/widgets/kernel/qstandardgestures.cpp +++ b/src/widgets/kernel/qstandardgestures.cpp @@ -331,7 +331,7 @@ QGestureRecognizer::Result QSwipeGestureRecognizer::recognize(QGesture *state, int elapsedTime = d->time.restart(); if (!elapsedTime) elapsedTime = 1; - d->velocityValue = 0.9 * d->velocityValue + distance / elapsedTime; + d->velocityValue = 0.9 * d->velocityValue + (qreal) distance / elapsedTime; d->swipeAngle = QLineF(p1.startScreenPos(), p1.screenPos()).angle(); static const int MoveThreshold = 50; diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index 7c5def5bd6..3f915264c8 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -357,11 +357,11 @@ void QWidgetPrivate::scrollChildren(int dx, int dy) } } -void QWidgetPrivate::setWSGeometry(bool dontShow, const QRect &oldRect) +void QWidgetPrivate::setWSGeometry() { - Q_UNUSED(dontShow); - Q_UNUSED(oldRect); - // XXX + Q_Q(QWidget); + if (QWindow *window = q->windowHandle()) + window->setGeometry(data.crect); } void QWidgetPrivate::updateWidgetTransform(QEvent *event) diff --git a/src/widgets/kernel/qwidget_p.h b/src/widgets/kernel/qwidget_p.h index e7ffb75891..14831efca8 100644 --- a/src/widgets/kernel/qwidget_p.h +++ b/src/widgets/kernel/qwidget_p.h @@ -609,7 +609,7 @@ public: } } - void setWSGeometry(bool dontShow=false, const QRect &oldRect = QRect()); + void setWSGeometry(); inline QPoint mapToWS(const QPoint &p) const { return p - data.wrect.topLeft(); } diff --git a/src/widgets/kernel/qwidgetbackingstore.cpp b/src/widgets/kernel/qwidgetbackingstore.cpp index 221e6825ed..9d024fd359 100644 --- a/src/widgets/kernel/qwidgetbackingstore.cpp +++ b/src/widgets/kernel/qwidgetbackingstore.cpp @@ -168,6 +168,9 @@ static void showYellowThing_win(QWidget *widget, const QRegion ®ion, int msec void QWidgetBackingStore::showYellowThing(QWidget *widget, const QRegion &toBePainted, int msec, bool unclipped) { +#ifdef Q_OS_WINRT + Q_UNUSED(msec) +#endif QRegion paintRegion = toBePainted; QRect widgetRect = widget->rect(); diff --git a/src/widgets/styles/qcommonstyle.cpp b/src/widgets/styles/qcommonstyle.cpp index 4a9852108c..94498f48c9 100644 --- a/src/widgets/styles/qcommonstyle.cpp +++ b/src/widgets/styles/qcommonstyle.cpp @@ -4783,6 +4783,13 @@ QSize QCommonStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt, sz.setHeight(margin + qMax(iconSize, txt.height()) + margin); sz.setWidth((nullIcon ? 0 : margin) + iconSize + (hdr->text.isNull() ? 0 : margin) + txt.width() + margin); + if (hdr->sortIndicator != QStyleOptionHeader::None) { + int margin = proxy()->pixelMetric(QStyle::PM_HeaderMargin, hdr, widget); + if (hdr->orientation == Qt::Horizontal) + sz.rwidth() += sz.height() + margin; + else + sz.rheight() += sz.width() + margin; + } } break; case CT_TabWidget: diff --git a/src/widgets/styles/qwindowsvistastyle.cpp b/src/widgets/styles/qwindowsvistastyle.cpp index 1d75894cd6..e3699da7ef 100644 --- a/src/widgets/styles/qwindowsvistastyle.cpp +++ b/src/widgets/styles/qwindowsvistastyle.cpp @@ -1968,6 +1968,19 @@ QSize QWindowsVistaStyle::sizeFromContents(ContentsType type, const QStyleOption sz -= QSize(2*border, 2*border); } return sz; + case CT_HeaderSection: + { + // When there is a sort indicator it adds to the width but it is shown + // above the text natively and not on the side + if (QStyleOptionHeader *hdr = qstyleoption_cast<QStyleOptionHeader *>(const_cast<QStyleOption *>(option))) { + QStyleOptionHeader::SortIndicator sortInd = hdr->sortIndicator; + hdr->sortIndicator = QStyleOptionHeader::None; + sz = QWindowsXPStyle::sizeFromContents(type, hdr, size, widget); + hdr->sortIndicator = sortInd; + return sz; + } + break; + } default: break; } diff --git a/src/widgets/widgets/qdialogbuttonbox.cpp b/src/widgets/widgets/qdialogbuttonbox.cpp index 3acd4f0701..86fc6fff5d 100644 --- a/src/widgets/widgets/qdialogbuttonbox.cpp +++ b/src/widgets/widgets/qdialogbuttonbox.cpp @@ -211,9 +211,6 @@ void QDialogButtonBoxPrivate::initLayout() q->setSizePolicy(sp); q->setAttribute(Qt::WA_WState_OwnSizePolicy, false); } - - // ### move to a real init() function - q->setFocusPolicy(Qt::TabFocus); } void QDialogButtonBoxPrivate::resetLayout() |