aboutsummaryrefslogtreecommitdiff
path: root/plainqt/style/qtmaemo6teststyle.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'plainqt/style/qtmaemo6teststyle.cpp')
-rw-r--r--plainqt/style/qtmaemo6teststyle.cpp30
1 files changed, 16 insertions, 14 deletions
diff --git a/plainqt/style/qtmaemo6teststyle.cpp b/plainqt/style/qtmaemo6teststyle.cpp
index b50a334d..26519afb 100644
--- a/plainqt/style/qtmaemo6teststyle.cpp
+++ b/plainqt/style/qtmaemo6teststyle.cpp
@@ -36,24 +36,26 @@ QtMaemo6TestStyleEventFilter::QtMaemo6TestStyleEventFilter(QtMaemo6TestStyle *pa
bool QtMaemo6TestStyleEventFilter::eventFilter(QObject *obj, QEvent *event)
{
QWidget *widget = qobject_cast<QWidget *>(obj);
- QWidget *parent = qobject_cast<QWidget *>(widget->parent());
-
- switch (event->type()) {
- case QEvent::Show: {
- if (NULL != widget && (qobject_cast<QMainWindow *>(widget) || qobject_cast<QDialog *>(widget))) {
- //QMainWindow* main_window(qobject_cast<QMainWindow*>(widget));
- //if (NULL != main_window) {
- if (widget->windowFlags() & Qt::Window) {
- if (!parent || !qobject_cast<QtMaemo6WindowDecoration *>(parent)) {
- parent = m_style->m_windowDecoration = new QtMaemo6WindowDecoration(widget);
+ if (widget) {
+ QWidget *parent = qobject_cast<QWidget *>(widget->parent());
+
+ switch (event->type()) {
+ case QEvent::Show: {
+ if (NULL != widget && (qobject_cast<QMainWindow *>(widget) || qobject_cast<QDialog *>(widget))) {
+ //QMainWindow* main_window(qobject_cast<QMainWindow*>(widget));
+ //if (NULL != main_window) {
+ if (widget->windowFlags() & Qt::Window) {
+ if (!parent || !qobject_cast<QtMaemo6WindowDecoration *>(parent)) {
+ parent = m_style->m_windowDecoration = new QtMaemo6WindowDecoration(widget);
+ }
+ parent->showMaximized();
}
- parent->showMaximized();
}
}
- }
- break;
- default:
break;
+ default:
+ break;
+ }
}
// standard event processing
return QObject::eventFilter(obj, event);