From 78d7192338e2cbba0c9b53c429d35b9437b7e1cd Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 27 Aug 2013 11:58:34 +0200 Subject: Close menu on 2nd click on QMenuBar. Task-number: QTBUG-32807 Change-Id: I0c3c25c6acf92bc30c1bcfc09003209b572ec777 Reviewed-by: Joerg Bornemann --- src/widgets/widgets/qmenubar.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/widgets') diff --git a/src/widgets/widgets/qmenubar.cpp b/src/widgets/widgets/qmenubar.cpp index f22c48b26f..a7cad28df3 100644 --- a/src/widgets/widgets/qmenubar.cpp +++ b/src/widgets/widgets/qmenubar.cpp @@ -1054,6 +1054,7 @@ void QMenuBar::mousePressEvent(QMouseEvent *e) if(QMenu *menu = d->activeMenu) { d->activeMenu = 0; menu->hide(); + d->closePopupMode = 1; } } else { d->setCurrentAction(action, true); -- cgit v1.2.3 From 198d2f6d3e1f622e1f168ff7e6aea7d1f05b80ed Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Mon, 26 Aug 2013 17:54:32 +0200 Subject: Activate Qt::WidgetWithChildrenShortcut shortcuts in MDI subwindows If a MDI subwindow is focused and an ancestor has a QShortCut set with the Qt::WidgetWithChildrenShortcut flag, it should trigger, as MDI subwindows are not top-level widgets. Task-number: QTBUG-32788 Change-Id: I7ec76d493b827ae6678209a56015ab6b432c1ed9 Reviewed-by: Friedemann Kleint --- src/widgets/kernel/qshortcut.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/widgets') diff --git a/src/widgets/kernel/qshortcut.cpp b/src/widgets/kernel/qshortcut.cpp index 471b054a99..678e6f25d1 100644 --- a/src/widgets/kernel/qshortcut.cpp +++ b/src/widgets/kernel/qshortcut.cpp @@ -158,7 +158,7 @@ static bool correctWidgetContext(Qt::ShortcutContext context, QWidget *w, QWidge if (context == Qt::WidgetWithChildrenShortcut) { const QWidget *tw = QApplication::focusWidget(); - while (tw && tw != w && (tw->windowType() == Qt::Widget || tw->windowType() == Qt::Popup)) + while (tw && tw != w && (tw->windowType() == Qt::Widget || tw->windowType() == Qt::Popup || tw->windowType() == Qt::SubWindow)) tw = tw->parentWidget(); return tw == w; } -- cgit v1.2.3 From 4ffa60e03a6ef1a7b8c8458377697b25c07eda8b Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Thu, 29 Aug 2013 12:40:47 +0200 Subject: Update QLineEdit::placeholderText property documentation eeb31ad10a1c1b26233f383de6d1b2b217cde08f changed the behavior and allowed the placeholder text to stay visible even if the lineedit has focus. Task-number: QTBUG-33237 Change-Id: I733331be1d3225eb28390b21eb9a7e4971bfdc31 Reviewed-by: Olivier Goffart --- src/widgets/widgets/qlineedit.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/widgets') diff --git a/src/widgets/widgets/qlineedit.cpp b/src/widgets/widgets/qlineedit.cpp index 70083d7267..816e7be8fd 100644 --- a/src/widgets/widgets/qlineedit.cpp +++ b/src/widgets/widgets/qlineedit.cpp @@ -333,8 +333,7 @@ void QLineEdit::setText(const QString& text) \brief the line edit's placeholder text Setting this property makes the line edit display a grayed-out - placeholder text as long as the text() is empty and the widget doesn't - have focus. + placeholder text as long as the text() is empty. By default, this property contains an empty string. -- cgit v1.2.3 From cdbf8dd276a2b6f3544a4e67e1216a1b8ca9f29e Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Mon, 26 Aug 2013 12:05:54 +0200 Subject: Ensure the timer is killed when appropriate before starting a new one When the mouse moves while the sloppy menu timer is still running then it would end up just creating a new one and the old one would continue to run. If the action that it is relevant for is different then it should restart the timer, otherwise it should just ignore the mouse move and let the other timer continue. Change-Id: Id03014fa05596bd6ede887fa917e21ca5a7690d8 Reviewed-by: Friedemann Kleint --- src/widgets/widgets/qmenu.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/widgets') diff --git a/src/widgets/widgets/qmenu.cpp b/src/widgets/widgets/qmenu.cpp index 4df89a5ede..c305748c7d 100644 --- a/src/widgets/widgets/qmenu.cpp +++ b/src/widgets/widgets/qmenu.cpp @@ -2864,8 +2864,15 @@ void QMenu::mouseMoveEvent(QMouseEvent *e) d->mouseDown = this; } if (d->sloppyRegion.contains(e->pos())) { - d->sloppyAction = action; - QMenuPrivate::sloppyDelayTimer = startTimer(style()->styleHint(QStyle::SH_Menu_SubMenuPopupDelay, 0, this)*6); + // If the timer is already running then don't start a new one unless the action is the same + if (d->sloppyAction != action && QMenuPrivate::sloppyDelayTimer != 0) { + killTimer(QMenuPrivate::sloppyDelayTimer); + QMenuPrivate::sloppyDelayTimer = 0; + } + if (QMenuPrivate::sloppyDelayTimer == 0) { + d->sloppyAction = action; + QMenuPrivate::sloppyDelayTimer = startTimer(style()->styleHint(QStyle::SH_Menu_SubMenuPopupDelay, 0, this) * 6); + } } else if (action != d->currentAction) { d->setCurrentAction(action, style()->styleHint(QStyle::SH_Menu_SubMenuPopupDelay, 0, this)); } -- cgit v1.2.3 From 5236f74942f0df8a74b696f133cbbac763e6950e Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Tue, 3 Sep 2013 13:44:34 +0200 Subject: Fix regression in QListView The fix was originally applied to Qt 4.8 (4c64464), but missed Qt 5 which had already been branched at that point of time. Task-number: QTBUG-33089 Task-number: QTBUG-21433 Change-Id: Ia3cd35d29dbdc70ba55b6f0840c4082e232c24ae Reviewed-by: Jens Bache-Wiig --- src/widgets/itemviews/qlistview.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/widgets') diff --git a/src/widgets/itemviews/qlistview.cpp b/src/widgets/itemviews/qlistview.cpp index 8ccb0557cb..3690b15650 100644 --- a/src/widgets/itemviews/qlistview.cpp +++ b/src/widgets/itemviews/qlistview.cpp @@ -1456,7 +1456,7 @@ void QListView::doItemsLayout() void QListView::updateGeometries() { Q_D(QListView); - if (d->model->rowCount(d->root) <= 0 || d->model->columnCount(d->root) <= 0) { + if (geometry().isEmpty() || d->model->rowCount(d->root) <= 0 || d->model->columnCount(d->root) <= 0) { horizontalScrollBar()->setRange(0, 0); verticalScrollBar()->setRange(0, 0); } else { @@ -1471,15 +1471,15 @@ void QListView::updateGeometries() // if the scroll bars are turned off, we resize the contents to the viewport if (d->movement == Static && !d->isWrapping()) { - const QSize maxSize = maximumViewportSize(); + d->layoutChildren(); // we need the viewport size to be updated if (d->flow == TopToBottom) { if (horizontalScrollBarPolicy() == Qt::ScrollBarAlwaysOff) { - d->setContentsSize(maxSize.width(), contentsSize().height()); + d->setContentsSize(viewport()->width(), contentsSize().height()); horizontalScrollBar()->setRange(0, 0); // we see all the contents anyway } } else { // LeftToRight if (verticalScrollBarPolicy() == Qt::ScrollBarAlwaysOff) { - d->setContentsSize(contentsSize().width(), maxSize.height()); + d->setContentsSize(contentsSize().width(), viewport()->height()); verticalScrollBar()->setRange(0, 0); // we see all the contents anyway } } -- cgit v1.2.3 From 730bc064a070e886e10950ccfd59780e8976f5fd Mon Sep 17 00:00:00 2001 From: Marcel Krems Date: Sat, 31 Aug 2013 16:42:43 +0200 Subject: Forward QGraphicsView::mouseDoubleClickEvent Do the same as in mousePressEvent. Otherwise it is not possible to handle the event in one of the graphics views parents. Task-number: QTBUG-8061 Change-Id: I67c7635361a9ed595c513c28ea016e6253fa2101 Reviewed-by: Andreas Aardal Hanssen --- src/widgets/graphicsview/qgraphicsview.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/widgets') diff --git a/src/widgets/graphicsview/qgraphicsview.cpp b/src/widgets/graphicsview/qgraphicsview.cpp index 846858ab31..a39c084798 100644 --- a/src/widgets/graphicsview/qgraphicsview.cpp +++ b/src/widgets/graphicsview/qgraphicsview.cpp @@ -3221,6 +3221,13 @@ void QGraphicsView::mouseDoubleClickEvent(QMouseEvent *event) qt_sendSpontaneousEvent(d->scene, &mouseEvent); else QApplication::sendEvent(d->scene, &mouseEvent); + + // Update the original mouse event accepted state. + const bool isAccepted = mouseEvent.isAccepted(); + event->setAccepted(isAccepted); + + // Update the last mouse event accepted state. + d->lastMouseEvent.setAccepted(isAccepted); } /*! -- cgit v1.2.3