summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-06-30 22:12:26 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-06-30 22:12:26 (GMT)
commitd3ae6c620876e08ed130606709c208f7352b2f81 (patch)
tree80162b139e7cbbed428b7391971199076a9454ab /src/gui
parent2a79ec7e2223257dd35fbdfd3c92d95c599a115e (diff)
parentec50421c7c592b2365a1f3d4c3dd251b145681e7 (diff)
downloadQt-d3ae6c620876e08ed130606709c208f7352b2f81.zip
Qt-d3ae6c620876e08ed130606709c208f7352b2f81.tar.gz
Qt-d3ae6c620876e08ed130606709c208f7352b2f81.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1 into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1: Reformat whitespace according to coding style QGraphicsView: Handle wheelEvents correctly with Qt::Popup widgets. QGraphicsProxyWidget: Fixes QComboBox popup closing issue.
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/graphicsview/qgraphicsscene.cpp22
-rw-r--r--src/gui/image/image.pri4
-rw-r--r--src/gui/image/qimagereader.cpp2
-rw-r--r--src/gui/widgets/qcombobox.cpp5
4 files changed, 28 insertions, 5 deletions
diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp
index ca3b56f..e5264da 100644
--- a/src/gui/graphicsview/qgraphicsscene.cpp
+++ b/src/gui/graphicsview/qgraphicsscene.cpp
@@ -885,8 +885,7 @@ void QGraphicsScenePrivate::removePopup(QGraphicsWidget *widget, bool itemIsDyin
ungrabKeyboard(static_cast<QGraphicsItem *>(widget), itemIsDying);
}
if (!itemIsDying && widget->isVisible()) {
- widget->hide();
- widget->QGraphicsItem::d_ptr->explicitlyHidden = 0;
+ widget->QGraphicsItem::d_ptr->setVisibleHelper(false, /* explicit = */ false);
}
}
}
@@ -4163,6 +4162,25 @@ void QGraphicsScene::wheelEvent(QGraphicsSceneWheelEvent *wheelEvent)
wheelEvent->scenePos(),
wheelEvent->widget());
+#ifdef Q_WS_MAC
+ // On Mac, ignore the event if the first item under the mouse is not the last opened
+ // popup (or one of its descendant)
+ if (!d->popupWidgets.isEmpty() && !wheelCandidates.isEmpty() && wheelCandidates.first() != d->popupWidgets.back() && !d->popupWidgets.back()->isAncestorOf(wheelCandidates.first())) {
+ wheelEvent->accept();
+ return;
+ }
+#else
+ // Find the first popup under the mouse (including the popup's descendants) starting from the last.
+ // Remove all popups after the one found, or all or them if no popup is under the mouse.
+ // Then continue with the event.
+ QList<QGraphicsWidget *>::const_iterator iter = d->popupWidgets.end();
+ while (--iter >= d->popupWidgets.begin() && !wheelCandidates.isEmpty()) {
+ if (wheelCandidates.first() == *iter || (*iter)->isAncestorOf(wheelCandidates.first()))
+ break;
+ d->removePopup(*iter);
+ }
+#endif
+
bool hasSetFocus = false;
foreach (QGraphicsItem *item, wheelCandidates) {
if (!hasSetFocus && item->isEnabled()
diff --git a/src/gui/image/image.pri b/src/gui/image/image.pri
index c4eac95..f5f1bc0 100644
--- a/src/gui/image/image.pri
+++ b/src/gui/image/image.pri
@@ -63,7 +63,7 @@ embedded {
}
x11 {
HEADERS += image/qpixmap_x11_p.h
- SOURCES += image/qpixmap_x11.cpp
+ SOURCES += image/qpixmap_x11.cpp
}
mac {
HEADERS += image/qpixmap_mac_p.h
@@ -96,7 +96,7 @@ SOURCES += \
unix|win32-g++*:LIBS_PRIVATE += -lpng
win32:!win32-g++*:LIBS += libpng.lib
} else {
- DEFINES *= QT_USE_BUNDLED_LIBPNG
+ DEFINES *= QT_USE_BUNDLED_LIBPNG
!isEqual(QT_ARCH, i386):!isEqual(QT_ARCH, x86_64):DEFINES += PNG_NO_ASSEMBLER_CODE
INCLUDEPATH += ../3rdparty/libpng
SOURCES += ../3rdparty/libpng/png.c \
diff --git a/src/gui/image/qimagereader.cpp b/src/gui/image/qimagereader.cpp
index 93d5cd3..af43e90 100644
--- a/src/gui/image/qimagereader.cpp
+++ b/src/gui/image/qimagereader.cpp
@@ -301,7 +301,7 @@ static QImageIOHandler *createReadHandlerHelper(QIODevice *device,
if (!handler && !testFormat.isEmpty()) {
if (false) {
#ifndef QT_NO_IMAGEFORMAT_PNG
- } else if (testFormat == "png") {
+ } else if (testFormat == "png") {
handler = new QPngHandler;
#endif
#ifndef QT_NO_IMAGEFORMAT_BMP
diff --git a/src/gui/widgets/qcombobox.cpp b/src/gui/widgets/qcombobox.cpp
index 1504066..dcc328f 100644
--- a/src/gui/widgets/qcombobox.cpp
+++ b/src/gui/widgets/qcombobox.cpp
@@ -704,6 +704,11 @@ void QComboBoxPrivateContainer::hideEvent(QHideEvent *)
{
emit resetButton();
combo->update();
+ // QGraphicsScenePrivate::removePopup closes the combo box popup, it hides it non-explicitly.
+ // Hiding/showing the QComboBox after this will unexpectedly show the popup as well.
+ // Re-hiding the popup container makes sure it is explicitly hidden.
+ if (QGraphicsProxyWidget *proxy = graphicsProxyWidget())
+ proxy->hide();
}
void QComboBoxPrivateContainer::mousePressEvent(QMouseEvent *e)