mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-17 19:05:31 +08:00
Fixed samples:
* use QGuiApplication in main so GUI metadata are available * parent for thread sample, otherwise ASSERT Remark: some issue are Qt 5.4 update related
This commit is contained in:
@@ -7,7 +7,7 @@
|
|||||||
* contained in the LICENSE file.
|
* contained in the LICENSE file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <QCoreApplication>
|
#include <QGuiApplication>
|
||||||
#include "sampleschangeobject.h"
|
#include "sampleschangeobject.h"
|
||||||
#include "samplesmetadata.h"
|
#include "samplesmetadata.h"
|
||||||
#include "samplescontainer.h"
|
#include "samplescontainer.h"
|
||||||
@@ -21,12 +21,12 @@
|
|||||||
using namespace BlackMisc;
|
using namespace BlackMisc;
|
||||||
using namespace BlackMiscTest;
|
using namespace BlackMiscTest;
|
||||||
|
|
||||||
/*!
|
//! Sample tests
|
||||||
* Sample tests
|
|
||||||
*/
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
QCoreApplication a(argc, argv);;
|
// I use QGuiApplication and not core application
|
||||||
|
// otherwise no QPixmap metadata (metadata sample)
|
||||||
|
QGuiApplication a(argc, argv);
|
||||||
Q_UNUSED(a);
|
Q_UNUSED(a);
|
||||||
|
|
||||||
QTextStream qtout(stdout);
|
QTextStream qtout(stdout);
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
#include "samplesconcurrent.h"
|
#include "samplesconcurrent.h"
|
||||||
#include "blackmisc/algorithm.h"
|
#include "blackmisc/algorithm.h"
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QCoreApplication>
|
#include <QGuiApplication>
|
||||||
#include <QtConcurrent/QtConcurrent>
|
#include <QtConcurrent/QtConcurrent>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
||||||
@@ -25,11 +25,11 @@ namespace BlackMiscTest
|
|||||||
Q_UNUSED(type);
|
Q_UNUSED(type);
|
||||||
|
|
||||||
out << "Main thread id: " << QThread::currentThreadId() << endl;
|
out << "Main thread id: " << QThread::currentThreadId() << endl;
|
||||||
CThreadOutput b1("b1");
|
CThreadOutput b1("b1", QGuiApplication::instance());
|
||||||
b1.start();
|
b1.start();
|
||||||
CThreadOutput b2("b2");
|
CThreadOutput b2("b2", QGuiApplication::instance());
|
||||||
b2.start();
|
b2.start();
|
||||||
CThreadOutput b3("b3");
|
CThreadOutput b3("b3", QGuiApplication::instance());
|
||||||
b3.start();
|
b3.start();
|
||||||
QThread::msleep(10 * 1000);
|
QThread::msleep(10 * 1000);
|
||||||
b1.stop();
|
b1.stop();
|
||||||
|
|||||||
@@ -11,7 +11,6 @@
|
|||||||
#include "blackmisc/blackmiscfreefunctions.h"
|
#include "blackmisc/blackmiscfreefunctions.h"
|
||||||
#include "blackmisc/aviation/atcstationlist.h"
|
#include "blackmisc/aviation/atcstationlist.h"
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QGuiApplication>
|
|
||||||
#include <QMetaType>
|
#include <QMetaType>
|
||||||
|
|
||||||
using namespace BlackMisc::Aviation;
|
using namespace BlackMisc::Aviation;
|
||||||
@@ -21,17 +20,10 @@ using namespace BlackMisc::Network;
|
|||||||
|
|
||||||
namespace BlackMiscTest
|
namespace BlackMiscTest
|
||||||
{
|
{
|
||||||
|
|
||||||
/*
|
|
||||||
* Samples
|
|
||||||
*/
|
|
||||||
int CSamplesMetadata::samples()
|
int CSamplesMetadata::samples()
|
||||||
{
|
{
|
||||||
int argv = 0;
|
|
||||||
QTextStream cin(stdin);
|
QTextStream cin(stdin);
|
||||||
QTextStream cout(stdout);
|
QTextStream cout(stdout);
|
||||||
QGuiApplication dummy(argv, nullptr); // otherwise no QPixmap metadata
|
|
||||||
Q_UNUSED(dummy);
|
|
||||||
BlackMisc::registerMetadata();
|
BlackMisc::registerMetadata();
|
||||||
BlackMisc::displayAllUserMetatypesTypes(cout);
|
BlackMisc::displayAllUserMetatypesTypes(cout);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user