diff options
author | Frederik Gladhorn <frederik.gladhorn@theqtcompany.com> | 2014-11-27 18:28:12 +0100 |
---|---|---|
committer | Frederik Gladhorn <frederik.gladhorn@theqtcompany.com> | 2014-11-27 18:28:12 +0100 |
commit | ce6990c3e742e0833df0561246554cf07a888efb (patch) | |
tree | 412380582040f5bb314eb90ae029b41a883aa439 /src/widgets | |
parent | 09e674849a40f5eb7e9f95fd2a952c621aec86d1 (diff) | |
parent | fa9bde7d3a12ede956339c570f7b32f95d231e57 (diff) |
Merge remote-tracking branch 'origin/5.4' into dev
Change-Id: Id20053d261b4fbbcc0ac8ba49dd3ef2253fa4b95
Diffstat (limited to 'src/widgets')
-rw-r--r-- | src/widgets/kernel/qgesturemanager.cpp | 2 | ||||
-rw-r--r-- | src/widgets/kernel/qwidget.cpp | 4 | ||||
-rw-r--r-- | src/widgets/kernel/qwidgetwindow.cpp | 31 | ||||
-rw-r--r-- | src/widgets/styles/qfusionstyle.cpp | 6 | ||||
-rw-r--r-- | src/widgets/styles/qgtkstyle.cpp | 6 | ||||
-rw-r--r-- | src/widgets/widgets/qlineedit.cpp | 5 | ||||
-rw-r--r-- | src/widgets/widgets/qtabbar.cpp | 2 |
7 files changed, 53 insertions, 3 deletions
diff --git a/src/widgets/kernel/qgesturemanager.cpp b/src/widgets/kernel/qgesturemanager.cpp index c9af3062d3..f0aceaacf7 100644 --- a/src/widgets/kernel/qgesturemanager.cpp +++ b/src/widgets/kernel/qgesturemanager.cpp @@ -63,6 +63,7 @@ QT_BEGIN_NAMESPACE +#if !defined(Q_OS_OSX) static inline int panTouchPoints() { // Override by environment variable for testing. @@ -80,6 +81,7 @@ static inline int panTouchPoints() // correctly. return 2; } +#endif QGestureManager::QGestureManager(QObject *parent) : QObject(parent), state(NotGesture), m_lastCustomGestureId(Qt::CustomGesture) diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index ed59e40bb6..143293b589 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -9406,9 +9406,11 @@ void QWidget::focusOutEvent(QFocusEvent *) if (focusPolicy() != Qt::NoFocus || !isWindow()) update(); - // automatically hide the SIP +#ifndef Q_OS_IOS + // FIXME: revisit autoSIP logic, QTBUG-42906 if (qApp->autoSipEnabled() && testAttribute(Qt::WA_InputMethodEnabled)) qApp->inputMethod()->hide(); +#endif } /*! diff --git a/src/widgets/kernel/qwidgetwindow.cpp b/src/widgets/kernel/qwidgetwindow.cpp index de8f11e5ec..4bca0eab4a 100644 --- a/src/widgets/kernel/qwidgetwindow.cpp +++ b/src/widgets/kernel/qwidgetwindow.cpp @@ -33,6 +33,7 @@ #include "private/qwindow_p.h" #include "qwidgetwindow_p.h" +#include "qlayout.h" #include "private/qwidget_p.h" #include "private/qapplication_p.h" @@ -79,8 +80,38 @@ public: widget->focusWidget()->clearFocus(); } + QRectF closestAcceptableGeometry(const QRectF &rect) const Q_DECL_OVERRIDE; }; +QRectF QWidgetWindowPrivate::closestAcceptableGeometry(const QRectF &rect) const +{ + Q_Q(const QWidgetWindow); + const QWidget *widget = q->widget(); + if (!widget->isWindow() || !widget->hasHeightForWidth()) + return QRect(); + const QSize oldSize = rect.size().toSize(); + const QSize newSize = QLayout::closestAcceptableSize(widget, oldSize); + if (newSize == oldSize) + return QRectF(); + const int dw = newSize.width() - oldSize.width(); + const int dh = newSize.height() - oldSize.height(); + QRectF result = rect; + const QRectF currentGeometry(widget->geometry()); + const qreal topOffset = result.top() - currentGeometry.top(); + const qreal bottomOffset = result.bottom() - currentGeometry.bottom(); + if (qAbs(topOffset) > qAbs(bottomOffset)) + result.setTop(result.top() - dh); // top edge drag + else + result.setBottom(result.bottom() + dh); // bottom edge drag + const qreal leftOffset = result.left() - currentGeometry.left(); + const qreal rightOffset = result.right() - currentGeometry.right(); + if (qAbs(leftOffset) > qAbs(rightOffset)) + result.setLeft(result.left() - dw); // left edge drag + else + result.setRight(result.right() + dw); // right edge drag + return result; +} + QWidgetWindow::QWidgetWindow(QWidget *widget) : QWindow(*new QWidgetWindowPrivate(), 0) , m_widget(widget) diff --git a/src/widgets/styles/qfusionstyle.cpp b/src/widgets/styles/qfusionstyle.cpp index 817f16b297..c4f78b9998 100644 --- a/src/widgets/styles/qfusionstyle.cpp +++ b/src/widgets/styles/qfusionstyle.cpp @@ -1403,7 +1403,9 @@ void QFusionStyle::drawControl(ControlElement element, const QStyleOption *optio painter->drawRoundedRect(progressBar.adjusted(1, 1, -1, -1), 1, 1); if (!indeterminate) { +#ifndef QT_NO_ANIMATION (const_cast<QFusionStylePrivate*>(d))->stopAnimation(option->styleObject); +#endif } else { highlightedGradientStartColor.setAlpha(120); painter->setPen(QPen(highlightedGradientStartColor, 9.0)); @@ -2431,6 +2433,7 @@ void QFusionStyle::drawComplexControl(ComplexControl control, const QStyleOption styleObject->setProperty("_q_stylestate", static_cast<int>(scrollBar->state)); styleObject->setProperty("_q_stylecontrols", static_cast<uint>(scrollBar->activeSubControls)); +#ifndef QT_NO_ANIMATION QScrollbarStyleAnimation *anim = qobject_cast<QScrollbarStyleAnimation *>(d->animation(styleObject)); if (transient) { if (!anim) { @@ -2444,8 +2447,10 @@ void QFusionStyle::drawComplexControl(ComplexControl control, const QStyleOption } else if (anim && anim->mode() == QScrollbarStyleAnimation::Deactivating) { d->stopAnimation(styleObject); } +#endif // !QT_NO_ANIMATION } +#ifndef QT_NO_ANIMATION QScrollbarStyleAnimation *anim = qobject_cast<QScrollbarStyleAnimation *>(d->animation(styleObject)); if (anim && anim->mode() == QScrollbarStyleAnimation::Deactivating) { // once a scrollbar was active (hovered/pressed), it retains @@ -2474,6 +2479,7 @@ void QFusionStyle::drawComplexControl(ComplexControl control, const QStyleOption } } painter->setOpacity(opacity); +#endif // !QT_NO_ANIMATION } bool transient = proxy()->styleHint(SH_ScrollBar_Transient, option, widget); diff --git a/src/widgets/styles/qgtkstyle.cpp b/src/widgets/styles/qgtkstyle.cpp index 6f2a2046b7..f87af6cd93 100644 --- a/src/widgets/styles/qgtkstyle.cpp +++ b/src/widgets/styles/qgtkstyle.cpp @@ -1049,7 +1049,7 @@ void QGtkStyle::drawPrimitive(PrimitiveElement element, // The reason for this is that a lot of code that relies on custom item delegates will look odd having // a gradient on the branch but a flat shaded color on the item itself. QCommonStyle::drawPrimitive(element, option, painter, widget); - if (!option->state & State_Selected) { + if (!(option->state & State_Selected)) { break; } else { if (const QAbstractItemView *view = qobject_cast<const QAbstractItemView*>(widget)) { @@ -3514,15 +3514,19 @@ void QGtkStyle::drawControl(ControlElement element, progressBar.setRect(rect.left(), rect.top(), width, rect.height()); else progressBar.setRect(rect.right() - width, rect.top(), width, rect.height()); +#ifndef QT_NO_ANIMATION d->stopAnimation(option->styleObject); +#endif } else { Q_D(const QGtkStyle); int slideWidth = ((rect.width() - 4) * 2) / 3; int step = 0; +#ifndef QT_NO_ANIMATION if (QProgressStyleAnimation *animation = qobject_cast<QProgressStyleAnimation*>(d->animation(option->styleObject))) step = animation->progressStep(slideWidth); else d->startAnimation(new QProgressStyleAnimation(d->animationFps, option->styleObject)); +#endif progressBar.setRect(rect.left() + step, rect.top(), slideWidth / 2, rect.height()); } diff --git a/src/widgets/widgets/qlineedit.cpp b/src/widgets/widgets/qlineedit.cpp index 3db7781acc..5a504a880c 100644 --- a/src/widgets/widgets/qlineedit.cpp +++ b/src/widgets/widgets/qlineedit.cpp @@ -712,8 +712,11 @@ QSize QLineEdit::minimumSizeHint() const ensurePolished(); QFontMetrics fm = fontMetrics(); int h = fm.height() + qMax(2*d->verticalMargin, fm.leading()) + + d->topTextMargin + d->bottomTextMargin + d->topmargin + d->bottommargin; - int w = fm.maxWidth() + d->leftmargin + d->rightmargin; + int w = fm.maxWidth() + + d->effectiveLeftTextMargin() + d->effectiveRightTextMargin() + + d->leftmargin + d->rightmargin; QStyleOptionFrame opt; initStyleOption(&opt); return (style()->sizeFromContents(QStyle::CT_LineEdit, &opt, QSize(w, h). diff --git a/src/widgets/widgets/qtabbar.cpp b/src/widgets/widgets/qtabbar.cpp index 982cc40b3d..871bf1eba1 100644 --- a/src/widgets/widgets/qtabbar.cpp +++ b/src/widgets/widgets/qtabbar.cpp @@ -2480,6 +2480,7 @@ void CloseButton::paintEvent(QPaintEvent *) style()->drawPrimitive(QStyle::PE_IndicatorTabClose, &opt, &p, this); } +#ifndef QT_NO_ANIMATION void QTabBarPrivate::Tab::TabBarAnimation::updateCurrentValue(const QVariant ¤t) { priv->moveTab(priv->tabList.indexOf(*tab), current.toInt()); @@ -2489,6 +2490,7 @@ void QTabBarPrivate::Tab::TabBarAnimation::updateState(QAbstractAnimation::State { if (newState == Stopped) priv->moveTabFinished(priv->tabList.indexOf(*tab)); } +#endif QT_END_NAMESPACE |