summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms
diff options
context:
space:
mode:
authorSergio Martins <sergio.martins.qnx@kdab.com>2012-12-07 10:49:19 +0000
committerThe Qt Project <gerrit-noreply@qt-project.org>2012-12-10 13:23:51 +0100
commit1eabbc0908160de7879a9ee7fa43916f0f9f8d49 (patch)
tree04b6ae7fde5dec8a013352f35dac250c825ab5bd /src/plugins/platforms
parentaa3a75ce145b6402578fc5b527d8a7c6a57cf765 (diff)
Blackberry: Fix crash when opening file dialog without parent.
If parent is null, we now use qqnxintegration->primaryScreen() This simplifies ctors of QQnxTheme and QQnxFileDialogHelper which now receive a QQnxIntegration pointer instead of receiving a font database and a bps event filter. Change-Id: I3b1ed4d99f738b980a4f19a98618341a14e0c222 Reviewed-by: Kevin Krammer <kevin.krammer@kdab.com> Reviewed-by: Rafael Roquetto <rafael.roquetto@kdab.com> Reviewed-by: Thomas McGuire <thomas.mcguire@kdab.com>
Diffstat (limited to 'src/plugins/platforms')
-rw-r--r--src/plugins/platforms/qnx/qqnxfiledialoghelper.cpp15
-rw-r--r--src/plugins/platforms/qnx/qqnxfiledialoghelper.h6
-rw-r--r--src/plugins/platforms/qnx/qqnxintegration.cpp2
-rw-r--r--src/plugins/platforms/qnx/qqnxintegration.h2
-rw-r--r--src/plugins/platforms/qnx/qqnxtheme.cpp14
-rw-r--r--src/plugins/platforms/qnx/qqnxtheme.h9
6 files changed, 25 insertions, 23 deletions
diff --git a/src/plugins/platforms/qnx/qqnxfiledialoghelper.cpp b/src/plugins/platforms/qnx/qqnxfiledialoghelper.cpp
index 262bdb16f4..79d7c7d9ca 100644
--- a/src/plugins/platforms/qnx/qqnxfiledialoghelper.cpp
+++ b/src/plugins/platforms/qnx/qqnxfiledialoghelper.cpp
@@ -43,6 +43,7 @@
#include "qqnxbpseventfilter.h"
#include "qqnxscreen.h"
+#include "qqnxintegration.h"
#include <QDebug>
#include <QEventLoop>
@@ -58,9 +59,9 @@
QT_BEGIN_NAMESPACE
-QQnxFileDialogHelper::QQnxFileDialogHelper(QQnxBpsEventFilter *eventFilter)
+QQnxFileDialogHelper::QQnxFileDialogHelper(const QQnxIntegration *integration)
: QPlatformFileDialogHelper(),
- m_eventFilter(eventFilter),
+ m_integration(integration),
m_dialog(0),
m_acceptMode(QFileDialogOptions::AcceptOpen),
m_selectedFilter(),
@@ -144,8 +145,9 @@ bool QQnxFileDialogHelper::show(Qt::WindowFlags flags, Qt::WindowModality modali
Q_UNUSED(flags);
qFileDialogHelperDebug() << Q_FUNC_INFO;
+ QQnxBpsEventFilter *eventFilter = m_integration->bpsEventFilter();
// We *really* need the bps event filter ;)
- if (!m_eventFilter)
+ if (!eventFilter)
return false;
// Native dialogs can only handle application modal use cases so far
@@ -208,12 +210,15 @@ bool QQnxFileDialogHelper::show(Qt::WindowFlags flags, Qt::WindowModality modali
m_acceptMode = opts->acceptMode();
// Set the libscreen window group and common properties
- QQnxScreen *nativeScreen = static_cast<QQnxScreen *>(parent->screen()->handle());
+
+ QQnxScreen *nativeScreen = parent ? static_cast<QQnxScreen *>(parent->screen()->handle()) :
+ m_integration->primaryDisplay();
+ Q_ASSERT(nativeScreen);
dialog_set_group_id(m_dialog, nativeScreen->windowGroupName());
dialog_set_title_text(m_dialog, opts->windowTitle().toLocal8Bit().constData());
// Register ourselves for dialog domain events from bps
- m_eventFilter->registerForDialogEvents(this);
+ eventFilter->registerForDialogEvents(this);
// Show the dialog
dialog_show(m_dialog);
diff --git a/src/plugins/platforms/qnx/qqnxfiledialoghelper.h b/src/plugins/platforms/qnx/qqnxfiledialoghelper.h
index 352709c763..e17ea80501 100644
--- a/src/plugins/platforms/qnx/qqnxfiledialoghelper.h
+++ b/src/plugins/platforms/qnx/qqnxfiledialoghelper.h
@@ -48,13 +48,13 @@
QT_BEGIN_NAMESPACE
-class QQnxBpsEventFilter;
+class QQnxIntegration;
class QQnxFileDialogHelper : public QPlatformFileDialogHelper
{
Q_OBJECT
public:
- explicit QQnxFileDialogHelper(QQnxBpsEventFilter *eventFilter);
+ explicit QQnxFileDialogHelper(const QQnxIntegration *);
~QQnxFileDialogHelper();
bool handleEvent(bps_event_t *event);
@@ -81,7 +81,7 @@ Q_SIGNALS:
private:
void setNameFilter(const QString &filter);
- QQnxBpsEventFilter *m_eventFilter;
+ const QQnxIntegration *m_integration;
dialog_instance_t m_dialog;
QFileDialogOptions::AcceptMode m_acceptMode;
QString m_selectedFilter;
diff --git a/src/plugins/platforms/qnx/qqnxintegration.cpp b/src/plugins/platforms/qnx/qqnxintegration.cpp
index e594ea952d..bff4dbdc2a 100644
--- a/src/plugins/platforms/qnx/qqnxintegration.cpp
+++ b/src/plugins/platforms/qnx/qqnxintegration.cpp
@@ -406,7 +406,7 @@ QPlatformTheme *QQnxIntegration::createPlatformTheme(const QString &name) const
{
qIntegrationDebug() << Q_FUNC_INFO << "name =" << name;
if (name == QQnxTheme::name())
- return new QQnxTheme(m_fontDatabase, m_bpsEventFilter);
+ return new QQnxTheme(this);
return QPlatformIntegration::createPlatformTheme(name);
}
#endif
diff --git a/src/plugins/platforms/qnx/qqnxintegration.h b/src/plugins/platforms/qnx/qqnxintegration.h
index 97a5e631e8..e3eb9e06ba 100644
--- a/src/plugins/platforms/qnx/qqnxintegration.h
+++ b/src/plugins/platforms/qnx/qqnxintegration.h
@@ -128,10 +128,10 @@ public:
void createDisplay(screen_display_t display, bool isPrimary);
void removeDisplay(QQnxScreen *screen);
+ QQnxScreen *primaryDisplay() const;
private:
void createDisplays();
void destroyDisplays();
- QQnxScreen *primaryDisplay() const;
static void addWindow(screen_window_t qnxWindow, QWindow *window);
static void removeWindow(screen_window_t qnxWindow);
diff --git a/src/plugins/platforms/qnx/qqnxtheme.cpp b/src/plugins/platforms/qnx/qqnxtheme.cpp
index be62c3e410..ae9acd845e 100644
--- a/src/plugins/platforms/qnx/qqnxtheme.cpp
+++ b/src/plugins/platforms/qnx/qqnxtheme.cpp
@@ -43,13 +43,11 @@
#include "qqnxfiledialoghelper.h"
#include "qqnxsystemsettings.h"
+#include "qqnxintegration.h"
QT_BEGIN_NAMESPACE
-QQnxTheme::QQnxTheme(QPlatformFontDatabase *fontDatabase,
- QQnxBpsEventFilter *eventFilter)
- : m_fontDatabase(fontDatabase),
- m_eventFilter(eventFilter)
+QQnxTheme::QQnxTheme(const QQnxIntegration *integration) : m_integration(integration)
{
}
@@ -77,7 +75,7 @@ QPlatformDialogHelper *QQnxTheme::createPlatformDialogHelper(DialogType type) co
{
switch (type) {
case QPlatformTheme::FileDialog:
- return new QQnxFileDialogHelper(m_eventFilter);
+ return new QQnxFileDialogHelper(m_integration);
#ifndef QT_NO_COLORDIALOG
case QPlatformTheme::ColorDialog:
#endif
@@ -91,8 +89,10 @@ QPlatformDialogHelper *QQnxTheme::createPlatformDialogHelper(DialogType type) co
const QFont *QQnxTheme::font(Font type) const
{
- if (m_fonts.isEmpty() && m_fontDatabase)
- m_fonts = qt_qnx_createRoleFonts(m_fontDatabase);
+ QPlatformFontDatabase *fontDatabase = m_integration->fontDatabase();
+
+ if (fontDatabase && m_fonts.isEmpty())
+ m_fonts = qt_qnx_createRoleFonts(fontDatabase);
return m_fonts.value(type, 0);
}
diff --git a/src/plugins/platforms/qnx/qqnxtheme.h b/src/plugins/platforms/qnx/qqnxtheme.h
index ea44d1cee2..17b2eab142 100644
--- a/src/plugins/platforms/qnx/qqnxtheme.h
+++ b/src/plugins/platforms/qnx/qqnxtheme.h
@@ -51,14 +51,12 @@
QT_BEGIN_NAMESPACE
-class QQnxBpsEventFilter;
-
-class QPlatformFontDatabase;
+class QQnxIntegration;
class QQnxTheme : public QPlatformTheme
{
public:
- QQnxTheme(QPlatformFontDatabase *fontDatabase, QQnxBpsEventFilter *eventFilter);
+ explicit QQnxTheme(const QQnxIntegration *);
~QQnxTheme();
static QString name() { return QStringLiteral("blackberry"); }
@@ -69,9 +67,8 @@ public:
const QFont *font(Font type = SystemFont) const;
private:
- QPlatformFontDatabase *m_fontDatabase;
- QQnxBpsEventFilter *m_eventFilter;
mutable QHash<QPlatformTheme::Font, QFont*> m_fonts;
+ const QQnxIntegration *m_integration;
};
QT_END_NAMESPACE