diff options
author | Liang Qi <liang.qi@theqtcompany.com> | 2015-08-26 20:06:57 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@theqtcompany.com> | 2015-08-26 20:06:57 +0200 |
commit | afab1546a7665bac2a8d7a6452e6aea46bfd2127 (patch) | |
tree | d616a7559c54a40e35a12b464f606774c9b0475b /src/widgets | |
parent | 06b457c693f207e392d3021d77a0ab18cd78da92 (diff) | |
parent | 53ecaade10319ecc1d8115521ae6d8eba1ee55c1 (diff) |
Merge remote-tracking branch 'origin/5.5' into 5.6
Conflicts:
qmake/doc/snippets/code/doc_src_qmake-manual.pro
qmake/doc/src/qmake-manual.qdoc
src/corelib/io/qstorageinfo_unix.cpp
src/corelib/tools/qbytearray.cpp
src/widgets/kernel/qwidgetwindow.cpp
tests/auto/corelib/io/qprocess/tst_qprocess.cpp
tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp
tests/auto/network/access/qnetworkreply/BLACKLIST
Change-Id: I9efcd7e1cce1c394eed425c43aa6fce7d2edf31c
Diffstat (limited to 'src/widgets')
-rw-r--r-- | src/widgets/graphicsview/qgraphicsitem.cpp | 11 | ||||
-rw-r--r-- | src/widgets/itemviews/qtreeview.cpp | 3 | ||||
-rw-r--r-- | src/widgets/kernel/qapplication.cpp | 3 | ||||
-rw-r--r-- | src/widgets/kernel/qlayoutitem.cpp | 2 | ||||
-rw-r--r-- | src/widgets/kernel/qwidget.cpp | 11 | ||||
-rw-r--r-- | src/widgets/kernel/qwidgetwindow.cpp | 4 | ||||
-rw-r--r-- | src/widgets/styles/qmacstyle_mac.mm | 3 | ||||
-rw-r--r-- | src/widgets/styles/qstyle.cpp | 19 | ||||
-rw-r--r-- | src/widgets/widgets/qcombobox.cpp | 2 | ||||
-rw-r--r-- | src/widgets/widgets/qlineedit_p.cpp | 27 | ||||
-rw-r--r-- | src/widgets/widgets/qlineedit_p.h | 16 | ||||
-rw-r--r-- | src/widgets/widgets/qmenubar.cpp | 2 |
12 files changed, 77 insertions, 26 deletions
diff --git a/src/widgets/graphicsview/qgraphicsitem.cpp b/src/widgets/graphicsview/qgraphicsitem.cpp index 0259ce216b..5f5c402a4a 100644 --- a/src/widgets/graphicsview/qgraphicsitem.cpp +++ b/src/widgets/graphicsview/qgraphicsitem.cpp @@ -1425,10 +1425,13 @@ QGraphicsItem::~QGraphicsItem() QObjectPrivate *p = QObjectPrivate::get(o); p->wasDeleted = true; if (p->declarativeData) { - if (QAbstractDeclarativeData::destroyed) - QAbstractDeclarativeData::destroyed(p->declarativeData, o); - if (QAbstractDeclarativeData::destroyed_qml1) - QAbstractDeclarativeData::destroyed_qml1(p->declarativeData, o); + if (static_cast<QAbstractDeclarativeDataImpl*>(p->declarativeData)->ownedByQml1) { + if (QAbstractDeclarativeData::destroyed_qml1) + QAbstractDeclarativeData::destroyed_qml1(p->declarativeData, o); + } else { + if (QAbstractDeclarativeData::destroyed) + QAbstractDeclarativeData::destroyed(p->declarativeData, o); + } p->declarativeData = 0; } } diff --git a/src/widgets/itemviews/qtreeview.cpp b/src/widgets/itemviews/qtreeview.cpp index 9b3e270fdd..57092a7cdc 100644 --- a/src/widgets/itemviews/qtreeview.cpp +++ b/src/widgets/itemviews/qtreeview.cpp @@ -433,6 +433,9 @@ void QTreeView::setRootIsDecorated(bool show) The height is obtained from the first item in the view. It is updated when the data changes on that item. + \note If the editor size hint is bigger than the cell size hint, then the + size hint of the editor will be used. + By default, this property is \c false. */ bool QTreeView::uniformRowHeights() const diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index f82fac836a..d8c14de060 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -339,8 +339,7 @@ void QApplicationPrivate::createEventDispatcher() \li Miscellaneous \li closeAllWindows(), startingUp(), - closingDown(), - type(). + closingDown(). \endtable \sa QCoreApplication, QAbstractEventDispatcher, QEventLoop, QSettings diff --git a/src/widgets/kernel/qlayoutitem.cpp b/src/widgets/kernel/qlayoutitem.cpp index 3d444136e3..03988aab99 100644 --- a/src/widgets/kernel/qlayoutitem.cpp +++ b/src/widgets/kernel/qlayoutitem.cpp @@ -92,7 +92,7 @@ inline static QSize toLayoutItemSize(QWidgetPrivate *priv, const QSize &size) be expressed using hasHeightForWidth(), heightForWidth(), and minimumHeightForWidth(). For more explanation see the \e{Qt Quarterly} article - \l{http://doc.qt.digia.com/qq/qq04-height-for-width.html}{Trading + \l{http://doc.qt.io/archives/qq/qq04-height-for-width.html}{Trading Height for Width}. \sa QLayout diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index 91641db60d..32c52ade56 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -1634,10 +1634,13 @@ QWidget::~QWidget() } if (d->declarativeData) { - if (QAbstractDeclarativeData::destroyed) - QAbstractDeclarativeData::destroyed(d->declarativeData, this); - if (QAbstractDeclarativeData::destroyed_qml1) - QAbstractDeclarativeData::destroyed_qml1(d->declarativeData, this); + if (static_cast<QAbstractDeclarativeDataImpl*>(d->declarativeData)->ownedByQml1) { + if (QAbstractDeclarativeData::destroyed_qml1) + QAbstractDeclarativeData::destroyed_qml1(d->declarativeData, this); + } else { + if (QAbstractDeclarativeData::destroyed) + QAbstractDeclarativeData::destroyed(d->declarativeData, this); + } d->declarativeData = 0; // don't activate again in ~QObject } diff --git a/src/widgets/kernel/qwidgetwindow.cpp b/src/widgets/kernel/qwidgetwindow.cpp index 58436a7d92..deaac4e263 100644 --- a/src/widgets/kernel/qwidgetwindow.cpp +++ b/src/widgets/kernel/qwidgetwindow.cpp @@ -445,11 +445,11 @@ void QWidgetWindow::handleMouseEvent(QMouseEvent *event) receiver = popupChild; if (receiver != popup) widgetPos = receiver->mapFromGlobal(event->globalPos()); - QWidget *alien = m_widget->childAt(m_widget->mapFromGlobal(event->globalPos())); + QWidget *alien = receiver->childAt(receiver->mapFromGlobal(event->globalPos())); QMouseEvent e(event->type(), widgetPos, event->windowPos(), event->screenPos(), event->button(), event->buttons(), event->modifiers(), event->source()); e.setTimestamp(event->timestamp()); - QApplicationPrivate::sendMouseEvent(receiver, &e, alien, m_widget, &qt_button_down, qt_last_mouse_receiver); + QApplicationPrivate::sendMouseEvent(receiver, &e, alien, receiver->window(), &qt_button_down, qt_last_mouse_receiver); qt_last_mouse_receiver = receiver; } else { // close disabled popups when a mouse button is pressed or released diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm index aa1a783577..3219952f7f 100644 --- a/src/widgets/styles/qmacstyle_mac.mm +++ b/src/widgets/styles/qmacstyle_mac.mm @@ -4682,7 +4682,8 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter tdi.value = pb->progress; tdi.attributes = vertical ? 0 : kThemeTrackHorizontal; - if (isIndeterminate || tdi.value < tdi.max) { + const bool usingYosemiteOrLater = QSysInfo::MacintoshVersion > QSysInfo::MV_10_9; + if (isIndeterminate || (tdi.value < tdi.max && !usingYosemiteOrLater)) { if (QProgressStyleAnimation *animation = qobject_cast<QProgressStyleAnimation*>(d->animation(opt->styleObject))) tdi.trackInfo.progress.phase = animation->animationStep(); else if (opt->styleObject) diff --git a/src/widgets/styles/qstyle.cpp b/src/widgets/styles/qstyle.cpp index 5e51866d8f..b368477a39 100644 --- a/src/widgets/styles/qstyle.cpp +++ b/src/widgets/styles/qstyle.cpp @@ -541,17 +541,21 @@ QRect QStyle::itemPixmapRect(const QRect &rect, int alignment, const QPixmap &pi QRect result; int x, y, w, h; rect.getRect(&x, &y, &w, &h); + + const int pixmapWidth = pixmap.width()/pixmap.devicePixelRatio(); + const int pixmapHeight = pixmap.height()/pixmap.devicePixelRatio(); + if ((alignment & Qt::AlignVCenter) == Qt::AlignVCenter) - y += h/2 - pixmap.height()/2; + y += h/2 - pixmapHeight/2; else if ((alignment & Qt::AlignBottom) == Qt::AlignBottom) - y += h - pixmap.height(); + y += h - pixmapHeight; if ((alignment & Qt::AlignRight) == Qt::AlignRight) - x += w - pixmap.width(); + x += w - pixmapWidth; else if ((alignment & Qt::AlignHCenter) == Qt::AlignHCenter) - x += w/2 - pixmap.width()/2; + x += w/2 - pixmapWidth/2; else if ((alignment & Qt::AlignLeft) != Qt::AlignLeft && QApplication::isRightToLeft()) - x += w - pixmap.width(); - result = QRect(x, y, pixmap.width(), pixmap.height()); + x += w - pixmapWidth; + result = QRect(x, y, pixmapWidth, pixmapHeight); return result; } @@ -2263,8 +2267,9 @@ int QStyle::sliderValueFromPosition(int min, int max, int pos, int span, bool up standard palette is not used. In particular, the Windows XP, Vista, and Mac styles do not use the standard palette, but make use of native theme engines. With these styles, you should not set - the palette with QApplication::setStandardPalette(). + the palette with QApplication::setPalette(). + \sa QApplication::setPalette() */ QPalette QStyle::standardPalette() const { diff --git a/src/widgets/widgets/qcombobox.cpp b/src/widgets/widgets/qcombobox.cpp index af085747ec..af2a66a838 100644 --- a/src/widgets/widgets/qcombobox.cpp +++ b/src/widgets/widgets/qcombobox.cpp @@ -1772,6 +1772,8 @@ void QComboBox::setLineEdit(QLineEdit *edit) connect(d->lineEdit, SIGNAL(editingFinished()), this, SLOT(_q_editingFinished())); connect(d->lineEdit, SIGNAL(textChanged(QString)), this, SIGNAL(editTextChanged(QString))); connect(d->lineEdit, SIGNAL(textChanged(QString)), this, SIGNAL(currentTextChanged(QString))); + connect(d->lineEdit, SIGNAL(cursorPositionChanged(int,int)), this, SLOT(updateMicroFocus())); + connect(d->lineEdit, SIGNAL(selectionChanged()), this, SLOT(updateMicroFocus())); d->lineEdit->setFrame(false); d->lineEdit->setContextMenuPolicy(Qt::NoContextMenu); d->updateFocusPolicy(); diff --git a/src/widgets/widgets/qlineedit_p.cpp b/src/widgets/widgets/qlineedit_p.cpp index b798bca4d1..a68f5a41ed 100644 --- a/src/widgets/widgets/qlineedit_p.cpp +++ b/src/widgets/widgets/qlineedit_p.cpp @@ -188,6 +188,9 @@ void QLineEditPrivate::init(const QString& txt) QObject::connect(control, SIGNAL(selectionChanged()), q, SLOT(update())); + QObject::connect(control, SIGNAL(selectionChanged()), + q, SLOT(updateMicroFocus())); + QObject::connect(control, SIGNAL(displayTextChanged(QString)), q, SLOT(update())); @@ -321,6 +324,24 @@ void QLineEditIconButton::paintEvent(QPaintEvent *) painter.drawPixmap(pixmapRect, iconPixmap); } +void QLineEditIconButton::actionEvent(QActionEvent *e) +{ + switch (e->type()) { + case QEvent::ActionChanged: { + const QAction *action = e->action(); + if (isVisible() != action->isVisible()) { + setVisible(action->isVisible()); + if (QLineEdit *le = qobject_cast<QLineEdit *>(parentWidget())) + static_cast<QLineEditPrivate *>(qt_widget_private(le))->positionSideWidgets(); + } + } + break; + default: + break; + } + QToolButton::actionEvent(e); +} + void QLineEditIconButton::setOpacity(qreal value) { if (!qFuzzyCompare(m_opacity, value)) { @@ -412,12 +433,14 @@ void QLineEditPrivate::positionSideWidgets() QRect widgetGeometry(QPoint(QLineEditIconButton::IconMargin, (contentRect.height() - iconSize.height()) / 2), iconSize); foreach (const SideWidgetEntry &e, leftSideWidgetList()) { e.widget->setGeometry(widgetGeometry); - widgetGeometry.moveLeft(widgetGeometry.left() + delta); + if (e.widget->isVisible()) + widgetGeometry.moveLeft(widgetGeometry.left() + delta); } widgetGeometry.moveLeft(contentRect.width() - iconSize.width() - QLineEditIconButton::IconMargin); foreach (const SideWidgetEntry &e, rightSideWidgetList()) { e.widget->setGeometry(widgetGeometry); - widgetGeometry.moveLeft(widgetGeometry.left() - delta); + if (e.widget->isVisible()) + widgetGeometry.moveLeft(widgetGeometry.left() - delta); } } } diff --git a/src/widgets/widgets/qlineedit_p.h b/src/widgets/widgets/qlineedit_p.h index 57055757eb..b47866b827 100644 --- a/src/widgets/widgets/qlineedit_p.h +++ b/src/widgets/widgets/qlineedit_p.h @@ -61,6 +61,8 @@ #include "private/qwidgetlinecontrol_p.h" +#include <algorithm> + QT_BEGIN_NAMESPACE // QLineEditIconButton: This is a simple helper class that represents clickable icons that fade in with text @@ -81,6 +83,7 @@ public: #endif protected: + void actionEvent(QActionEvent *e) Q_DECL_OVERRIDE; void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE; private slots: @@ -227,14 +230,23 @@ private: }; Q_DECLARE_TYPEINFO(QLineEditPrivate::SideWidgetEntry, Q_PRIMITIVE_TYPE); +static bool isSideWidgetVisible(const QLineEditPrivate::SideWidgetEntry &e) +{ + return e.widget->isVisible(); +} + inline int QLineEditPrivate::effectiveLeftTextMargin() const { - return leftTextMargin + leftSideWidgetList().size() * (QLineEditIconButton::IconMargin + iconSize().width()); + return leftTextMargin + (QLineEditIconButton::IconMargin + iconSize().width()) + * int(std::count_if(leftSideWidgetList().constBegin(), leftSideWidgetList().constEnd(), + isSideWidgetVisible)); } inline int QLineEditPrivate::effectiveRightTextMargin() const { - return rightTextMargin + rightSideWidgetList().size() * (QLineEditIconButton::IconMargin + iconSize().width()); + return rightTextMargin + (QLineEditIconButton::IconMargin + iconSize().width()) + * int(std::count_if(rightSideWidgetList().constBegin(), rightSideWidgetList().constEnd(), + isSideWidgetVisible)); } #endif // QT_NO_LINEEDIT diff --git a/src/widgets/widgets/qmenubar.cpp b/src/widgets/widgets/qmenubar.cpp index 9e76ff082c..91775e3862 100644 --- a/src/widgets/widgets/qmenubar.cpp +++ b/src/widgets/widgets/qmenubar.cpp @@ -1044,8 +1044,8 @@ void QMenuBar::mousePressEvent(QMouseEvent *e) if(d->currentAction == action && d->popupState) { if(QMenu *menu = d->activeMenu) { d->activeMenu = 0; + menu->setAttribute(Qt::WA_NoMouseReplay); menu->hide(); - d->closePopupMode = 1; } } else { d->setCurrentAction(action, true); |