diff options
author | Liang Qi <liang.qi@theqtcompany.com> | 2016-04-07 10:47:20 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@theqtcompany.com> | 2016-04-07 10:47:20 +0200 |
commit | ee0951d69b38f766e67262487be95b88501aa4a5 (patch) | |
tree | 116c334060500be340d4d61c99026316b0df3ce9 /src/widgets/widgets | |
parent | 0bb645b1ccc5a9d57b21cf0b2c4306b8e48c611c (diff) | |
parent | d37239aa419ee4adff4b0a8d5c1403cadff72319 (diff) |
Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts:
src/network/access/qftp.cpp
src/widgets/itemviews/qheaderview.cpp
src/widgets/itemviews/qlistview.cpp
tests/auto/network/access/qftp/tst_qftp.cpp
Change-Id: I9f928f25d45d8944dd60bb583f649fc1615bc5d9
Diffstat (limited to 'src/widgets/widgets')
-rw-r--r-- | src/widgets/widgets/qabstractslider.cpp | 10 | ||||
-rw-r--r-- | src/widgets/widgets/qlabel.cpp | 6 | ||||
-rw-r--r-- | src/widgets/widgets/qtoolbutton.cpp | 9 | ||||
-rw-r--r-- | src/widgets/widgets/qtoolbutton.h | 1 | ||||
-rw-r--r-- | src/widgets/widgets/qwidgetlinecontrol.cpp | 2 |
5 files changed, 23 insertions, 5 deletions
diff --git a/src/widgets/widgets/qabstractslider.cpp b/src/widgets/widgets/qabstractslider.cpp index 8cd35495e9..3f6185b4e7 100644 --- a/src/widgets/widgets/qabstractslider.cpp +++ b/src/widgets/widgets/qabstractslider.cpp @@ -731,8 +731,16 @@ bool QAbstractSliderPrivate::scrollByDelta(Qt::Orientation orientation, Qt::Keyb stepsToScroll = int(offset_accumulated); #endif offset_accumulated -= int(offset_accumulated); - if (stepsToScroll == 0) + if (stepsToScroll == 0) { + // We moved less than a line, but might still have accumulated partial scroll, + // unless we already are at one of the ends. + if (offset_accumulated > 0.f && value < maximum) + return true; + if (offset_accumulated < 0.f && value > minimum) + return true; + offset_accumulated = 0; return false; + } } if (invertedControls) diff --git a/src/widgets/widgets/qlabel.cpp b/src/widgets/widgets/qlabel.cpp index d2d7af145c..5db1013fd2 100644 --- a/src/widgets/widgets/qlabel.cpp +++ b/src/widgets/widgets/qlabel.cpp @@ -1095,14 +1095,16 @@ void QLabel::paintEvent(QPaintEvent *) if (d->pixmap && !d->pixmap->isNull()) { QPixmap pix; if (d->scaledcontents) { - if (!d->scaledpixmap || d->scaledpixmap->size() != cr.size()) { + QSize scaledSize = cr.size() * devicePixelRatioF(); + if (!d->scaledpixmap || d->scaledpixmap->size() != scaledSize) { if (!d->cachedimage) d->cachedimage = new QImage(d->pixmap->toImage()); delete d->scaledpixmap; QImage scaledImage = - d->cachedimage->scaled(cr.size() * devicePixelRatioF(), + d->cachedimage->scaled(scaledSize, Qt::IgnoreAspectRatio, Qt::SmoothTransformation); d->scaledpixmap = new QPixmap(QPixmap::fromImage(scaledImage)); + d->scaledpixmap->setDevicePixelRatio(devicePixelRatioF()); } pix = *d->scaledpixmap; } else diff --git a/src/widgets/widgets/qtoolbutton.cpp b/src/widgets/widgets/qtoolbutton.cpp index 664aec9a53..aef4634a9a 100644 --- a/src/widgets/widgets/qtoolbutton.cpp +++ b/src/widgets/widgets/qtoolbutton.cpp @@ -68,6 +68,7 @@ public: void init(); #ifndef QT_NO_MENU void _q_buttonPressed(); + void _q_buttonReleased(); void popupTimerDone(); void _q_updateButtonDown(); void _q_menuTriggered(QAction *); @@ -217,6 +218,7 @@ void QToolButtonPrivate::init() #ifndef QT_NO_MENU QObject::connect(q, SIGNAL(pressed()), q, SLOT(_q_buttonPressed())); + QObject::connect(q, SIGNAL(released()), q, SLOT(_q_buttonReleased())); #endif setLayoutItemMargins(QStyle::SE_ToolButtonLayoutItem); @@ -704,12 +706,17 @@ void QToolButtonPrivate::_q_buttonPressed() return; // no menu to show if (popupMode == QToolButton::MenuButtonPopup) return; - else if (delay > 0 && !popupTimer.isActive() && popupMode == QToolButton::DelayedPopup) + else if (delay > 0 && popupMode == QToolButton::DelayedPopup) popupTimer.start(delay, q); else if (delay == 0 || popupMode == QToolButton::InstantPopup) q->showMenu(); } +void QToolButtonPrivate::_q_buttonReleased() +{ + popupTimer.stop(); +} + void QToolButtonPrivate::popupTimerDone() { Q_Q(QToolButton); diff --git a/src/widgets/widgets/qtoolbutton.h b/src/widgets/widgets/qtoolbutton.h index d9bfed4c47..7b6114b5c1 100644 --- a/src/widgets/widgets/qtoolbutton.h +++ b/src/widgets/widgets/qtoolbutton.h @@ -125,6 +125,7 @@ private: Q_DECLARE_PRIVATE(QToolButton) #ifndef QT_NO_MENU Q_PRIVATE_SLOT(d_func(), void _q_buttonPressed()) + Q_PRIVATE_SLOT(d_func(), void _q_buttonReleased()) Q_PRIVATE_SLOT(d_func(), void _q_updateButtonDown()) Q_PRIVATE_SLOT(d_func(), void _q_menuTriggered(QAction*)) #endif diff --git a/src/widgets/widgets/qwidgetlinecontrol.cpp b/src/widgets/widgets/qwidgetlinecontrol.cpp index 7fab2c1de5..af8e5a8b42 100644 --- a/src/widgets/widgets/qwidgetlinecontrol.cpp +++ b/src/widgets/widgets/qwidgetlinecontrol.cpp @@ -118,7 +118,7 @@ void QWidgetLineControl::updateDisplayText(bool forceUpdate) // characters) QChar* uc = str.data(); for (int i = 0; i < (int)str.length(); ++i) { - if ((uc[i] < 0x20 && uc[i] != 0x09) + if ((uc[i].unicode() < 0x20 && uc[i].unicode() != 0x09) || uc[i] == QChar::LineSeparator || uc[i] == QChar::ParagraphSeparator || uc[i] == QChar::ObjectReplacementCharacter) |