2018-02-13 19:00:58 +08:00
|
|
|
#include <MainWindow.h>
|
2017-04-12 05:26:33 +08:00
|
|
|
#include <QString>
|
|
|
|
#include <QFile>
|
|
|
|
#include <QApplication>
|
|
|
|
#include <QDebug>
|
|
|
|
|
|
|
|
#include <memory>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void myMessageOutput(QtMsgType type, const QMessageLogContext &context, const QString &msg)
|
|
|
|
{
|
|
|
|
QByteArray localMsg = msg.toLocal8Bit();
|
|
|
|
switch (type) {
|
|
|
|
case QtDebugMsg:
|
|
|
|
fprintf(stdout, "Debug: %s (%s:%u, %s)\n", localMsg.constData(), context.file, context.line, context.function);
|
|
|
|
break;
|
|
|
|
case QtInfoMsg:
|
|
|
|
fprintf(stdout, "Info: %s (%s:%u, %s)\n", localMsg.constData(), context.file, context.line, context.function);
|
|
|
|
break;
|
|
|
|
case QtWarningMsg:
|
|
|
|
fprintf(stderr, "Warning: %s (%s:%u, %s)\n", localMsg.constData(), context.file, context.line, context.function);
|
|
|
|
break;
|
|
|
|
case QtCriticalMsg:
|
|
|
|
fprintf(stderr, "Critical: %s (%s:%u, %s)\n", localMsg.constData(), context.file, context.line, context.function);
|
|
|
|
break;
|
|
|
|
case QtFatalMsg:
|
|
|
|
fprintf(stderr, "Fatal: %s (%s:%u, %s)\n", localMsg.constData(), context.file, context.line, context.function);
|
|
|
|
abort();
|
|
|
|
}
|
|
|
|
|
|
|
|
fflush(stderr);
|
|
|
|
fflush(stdout);
|
|
|
|
}
|
|
|
|
|
|
|
|
int main(int argc, char *argv[])
|
|
|
|
{
|
2021-01-03 03:29:59 +08:00
|
|
|
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
2018-11-02 16:19:53 +08:00
|
|
|
QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
|
2019-01-14 15:59:37 +08:00
|
|
|
#if QT_VERSION >= 0x050600
|
2018-11-02 16:19:53 +08:00
|
|
|
QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
2021-01-03 03:29:59 +08:00
|
|
|
#endif
|
2019-01-14 15:59:37 +08:00
|
|
|
#endif
|
2017-04-12 05:26:33 +08:00
|
|
|
std::shared_ptr<int> b;
|
|
|
|
QApplication a(argc, argv);
|
2020-04-27 14:58:50 +08:00
|
|
|
a.setApplicationName("Advanced Docking System Demo");
|
2017-04-12 05:26:33 +08:00
|
|
|
a.setQuitOnLastWindowClosed(true);
|
2020-02-06 16:15:13 +08:00
|
|
|
|
2018-11-09 17:07:56 +08:00
|
|
|
qInstallMessageHandler(myMessageOutput);
|
2017-04-12 05:26:33 +08:00
|
|
|
qDebug() << "Message handler test";
|
|
|
|
|
2018-02-13 19:00:58 +08:00
|
|
|
CMainWindow mw;
|
2017-04-12 05:26:33 +08:00
|
|
|
mw.show();
|
2022-10-25 15:11:10 +08:00
|
|
|
|
|
|
|
QFile StyleSheetFile(":/adsdemo/app.css");
|
|
|
|
StyleSheetFile.open(QIODevice::ReadOnly);
|
|
|
|
QTextStream StyleSheetStream(&StyleSheetFile);
|
|
|
|
a.setStyleSheet(StyleSheetStream.readAll());
|
|
|
|
StyleSheetFile.close();
|
2017-04-12 05:26:33 +08:00
|
|
|
return a.exec();
|
|
|
|
}
|