diff options
author | Bernd Lamecker <bernd.lamecker@basyskom.de> | 2010-03-30 13:02:01 +0200 |
---|---|---|
committer | Torsten Rahn <Torsten.Rahn@basyskom.de> | 2010-04-09 11:59:16 +0200 |
commit | 6171093441d4a734ea11af1d27f617ddc4790869 (patch) | |
tree | 6d2ed6778c9780faf50a1dc3c8cddfd0259fc150 /plainqt | |
parent | 3e510185ef63aa62ba677ce9246f9b0710b17d45 (diff) |
Fixes : NB#162495 - QtMaemo6Style treats a QWidget's hide() same as
close()
RevBy: TrustMe
Diffstat (limited to 'plainqt')
-rw-r--r-- | plainqt/style/qtmaemo6dialogproxy.cpp | 12 | ||||
-rw-r--r-- | plainqt/style/qtmaemo6dialogproxy.h | 1 | ||||
-rw-r--r-- | plainqt/style/qtmaemo6style.cpp | 1 | ||||
-rw-r--r-- | plainqt/style/qtmaemo6styleeventfilter.cpp | 10 | ||||
-rw-r--r-- | plainqt/style/qtmaemo6window.cpp | 13 | ||||
-rw-r--r-- | plainqt/style/qtmaemo6windowdecoration.cpp | 4 |
6 files changed, 29 insertions, 12 deletions
diff --git a/plainqt/style/qtmaemo6dialogproxy.cpp b/plainqt/style/qtmaemo6dialogproxy.cpp index a4ee2e8c..506a56ae 100644 --- a/plainqt/style/qtmaemo6dialogproxy.cpp +++ b/plainqt/style/qtmaemo6dialogproxy.cpp @@ -26,6 +26,7 @@ #include <QApplication> #include <QCloseEvent> #include <QDialog> +#include <QDebug> #include "qtmaemo6dialogtitle.h" #include "qtmaemo6style_p.h" @@ -54,6 +55,8 @@ QtMaemo6DialogProxy::QtMaemo6DialogProxy(QWidget *mw, QWidget *parent) //only works if mw is a QDialog, otherwise the connect simply fails connect(m_dialogTitle, SIGNAL(closeRequest()), mw, SLOT(reject())); + + mw->installEventFilter(this); } QtMaemo6DialogProxy::~QtMaemo6DialogProxy() @@ -69,3 +72,12 @@ void QtMaemo6DialogProxy::setPixmap(const QPixmap &icon) { m_dialogTitle->setPixmap(icon); } + +bool QtMaemo6DialogProxy::eventFilter(QObject *obj, QEvent *event) { + //in dialog case, also close the decoration on hide event, because the + //dialogs are only hidden, not closed by default + if(obj == widget() && event->type() == QEvent::Hide) { + close(); + } + return QtMaemo6Window::eventFilter(obj, event); +} diff --git a/plainqt/style/qtmaemo6dialogproxy.h b/plainqt/style/qtmaemo6dialogproxy.h index 57b5b522..8c691bd1 100644 --- a/plainqt/style/qtmaemo6dialogproxy.h +++ b/plainqt/style/qtmaemo6dialogproxy.h @@ -56,6 +56,7 @@ protected: /*! \reimp */ //bool eventFilter(QObject* watched, QEvent* ev); //void closeEvent(QCloseEvent* event); + bool eventFilter(QObject *obj, QEvent *event); /*! \reimp_end */ private: diff --git a/plainqt/style/qtmaemo6style.cpp b/plainqt/style/qtmaemo6style.cpp index ca98f019..6348121c 100644 --- a/plainqt/style/qtmaemo6style.cpp +++ b/plainqt/style/qtmaemo6style.cpp @@ -820,7 +820,6 @@ void QtMaemo6Style::polish(QApplication *app) { if(app->dynamicPropertyNames().contains(Dui::NoDuiStyle)) return; - QtMaemo6TestStyle::polish(app); } diff --git a/plainqt/style/qtmaemo6styleeventfilter.cpp b/plainqt/style/qtmaemo6styleeventfilter.cpp index 675c6834..0eb6dd72 100644 --- a/plainqt/style/qtmaemo6styleeventfilter.cpp +++ b/plainqt/style/qtmaemo6styleeventfilter.cpp @@ -84,10 +84,12 @@ bool QtMaemo6StyleEventFilter::eventFilter(QObject *obj, QEvent *event) QtMaemo6StylePrivate::drawWindowBackground(decoration); } else if (!qobject_cast<QtMaemo6Window *>(widget) && !widget->inherits("QTipLabel")) { //don't create a new window for every tooltip! - m_style->m_windowDecoration = new QtMaemo6WindowDecoration(widget); - m_style->m_windowDecoration->showFastMaximized(); - QtMaemo6StylePrivate::drawWindowBackground(m_style->m_windowDecoration); - return true; + if(0 == qobject_cast<QtMaemo6WindowDecoration*>(widget->parent())) { + m_style->m_windowDecoration = new QtMaemo6WindowDecoration(widget); + m_style->m_windowDecoration->showFastMaximized(); + QtMaemo6StylePrivate::drawWindowBackground(m_style->m_windowDecoration); + return true; + } } } // Unfortunately this can't be safely done in polish: diff --git a/plainqt/style/qtmaemo6window.cpp b/plainqt/style/qtmaemo6window.cpp index 3ba0af31..646149b6 100644 --- a/plainqt/style/qtmaemo6window.cpp +++ b/plainqt/style/qtmaemo6window.cpp @@ -67,19 +67,24 @@ QSize QtMaemo6Window::maxViewportSize() const void QtMaemo6Window::closeEvent(QCloseEvent *event) { //prevent deleting the original Widget by Qt + QWidget* w = 0; if (m_scrollArea) - m_scrollArea->takeWidget(); + w = m_scrollArea->takeWidget(); + if(!w) { + w = m_window; + layout()->removeWidget(w); + } //this must be set back to dialog, so that the dialog can be shown again! - m_window->setWindowFlags(m_originalFlags); - m_window->hide(); + w->setParent(0); + w->setAttribute(Qt::WA_DeleteOnClose, false); + w->setWindowFlags(m_originalFlags); QWidget::closeEvent(event); } bool QtMaemo6Window::eventFilter(QObject *obj, QEvent *event) { switch (event->type()) { - case QEvent::Hide: //intended fall trough case QEvent::Close: if (!m_closeFromChild) { m_closeFromChild = true; diff --git a/plainqt/style/qtmaemo6windowdecoration.cpp b/plainqt/style/qtmaemo6windowdecoration.cpp index 973230bb..9f1d7e51 100644 --- a/plainqt/style/qtmaemo6windowdecoration.cpp +++ b/plainqt/style/qtmaemo6windowdecoration.cpp @@ -46,7 +46,7 @@ QtMaemo6WindowDecoration::QtMaemo6WindowDecoration(QWidget *mw, QWidget *parent m_windowLayout->addWidget(centralWidget(), 1, 1); connect(m_titleBar, SIGNAL(closeButtonClicked()), this, SLOT(close())); - connect(m_titleBar, SIGNAL(minimizeButtonClicked()), this, SLOT(hide())); + connect(m_titleBar, SIGNAL(minimizeButtonClicked()), this, SLOT(showMinimized())); connect(m_titleBar, SIGNAL(menuLabelClicked()), this, SLOT(showMenuBar())); } @@ -101,8 +101,6 @@ bool QtMaemo6WindowDecoration::eventFilter(QObject *watched, QEvent *event) { if (event->type() == QEvent::WindowTitleChange) { m_titleBar->setTitle(widget()->windowTitle()); - } else if (event->type() == QEvent::Close) { - hide(); } return QtMaemo6Window::eventFilter(watched, event); |