PDF4QT/Pdf4QtViewerProfi/main.cpp

35 lines
1.2 KiB
C++
Raw Normal View History

2018-11-21 19:30:15 +01:00
#include "pdfviewermainwindow.h"
#include <QApplication>
2019-01-27 17:55:22 +01:00
#include <QCommandLineParser>
2018-11-21 19:30:15 +01:00
int main(int argc, char *argv[])
{
2019-12-22 16:33:50 +01:00
QApplication::setAttribute(Qt::AA_CompressHighFrequencyEvents, true);
QApplication::setAttribute(Qt::AA_DisableHighDpiScaling, true);
2020-02-09 16:06:29 +01:00
QApplication::setAttribute(Qt::AA_DontCheckOpenGLContextThreadAffinity, true);
2019-01-27 17:55:22 +01:00
QApplication application(argc, argv);
QCoreApplication::setOrganizationName("MelkaJ");
2020-12-20 16:36:07 +01:00
QCoreApplication::setApplicationName("PDF4QT Viewer Profi");
2020-09-25 18:08:39 +02:00
QCoreApplication::setApplicationVersion("1.0.0");
2020-12-20 16:36:07 +01:00
QApplication::setApplicationDisplayName(QApplication::translate("Application", "PDF4QT Viewer Profi"));
2019-01-27 17:55:22 +01:00
QCommandLineParser parser;
parser.setApplicationDescription(QCoreApplication::applicationName());
parser.addHelpOption();
parser.addVersionOption();
parser.addPositionalArgument("file", "The PDF file to open.");
parser.process(application);
pdfviewer::PDFViewerMainWindow mainWindow;
mainWindow.show();
2018-11-21 19:30:15 +01:00
QStringList arguments = application.arguments();
if (arguments.size() > 1)
{
2020-12-20 16:36:07 +01:00
mainWindow.getProgramController()->openDocument(arguments[1]);
}
2019-01-27 17:55:22 +01:00
return application.exec();
2018-11-21 19:30:15 +01:00
}