mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-12 23:35:33 +08:00
refs #204 workaround an unexplained bug when casting QApplication
by using inherits() and static_cast instead of qobject_cast
This commit is contained in:
committed by
Klaus Basan
parent
f1345d7b6f
commit
ae507a54cd
@@ -9,6 +9,7 @@
|
|||||||
#include <XPLM/XPLMDefs.h>
|
#include <XPLM/XPLMDefs.h>
|
||||||
#include <XPLM/XPLMPlugin.h>
|
#include <XPLM/XPLMPlugin.h>
|
||||||
#include <XPLM/XPLMProcessing.h>
|
#include <XPLM/XPLMProcessing.h>
|
||||||
|
#include <XPLM/XPLMUtilities.h>
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QSharedPointer>
|
#include <QSharedPointer>
|
||||||
|
|
||||||
@@ -46,7 +47,11 @@ public:
|
|||||||
static char *argv[] = { "X-Plane" };
|
static char *argv[] = { "X-Plane" };
|
||||||
new QSharedApplication(ptr, argc, argv);
|
new QSharedApplication(ptr, argc, argv);
|
||||||
}
|
}
|
||||||
return qobject_cast<QSharedApplication*>(instance())->m_weakptr;
|
if (! instance()->inherits("QSharedApplication"))
|
||||||
|
{
|
||||||
|
XPLMDebugString("Error: there is an unshared QApplication in another plugin\n");
|
||||||
|
}
|
||||||
|
return static_cast<QSharedApplication*>(instance())->m_weakptr;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user