Skip to content
Snippets Groups Projects
Commit 9febf1ed authored by Pospelov, Gennady's avatar Pospelov, Gennady
Browse files

Command line option to enable high-dpi support.

parent 115c4460
No related branches found
No related tags found
No related merge requests found
......@@ -22,6 +22,7 @@
namespace {
const char* geometry = "geometry";
const char* highdpi = "highdpi";
//! Converts string "1600x1000" to QSize(1600, 1000)
QSize windowSize(const QString& size_string) {
......@@ -49,6 +50,7 @@ ApplicationOptions::ApplicationOptions(int argc, char** argv) : m_options_is_con
m_options.add_options()("with-debug", "run application with debug printout");
m_options.add_options()("no-splash", "do not show splash screen");
m_options.add_options()(geometry, bpo::value<std::string>(), "Main window geometry, e.g. 1600x1000");
m_options.add_options()(highdpi, "Run with experimental high-dpi monitor support");
parseCommandLine(argc, argv);
......@@ -137,3 +139,8 @@ QSize ApplicationOptions::mainWindowSize() const
QString size_str = QString::fromStdString(m_variables_map[geometry].as<std::string>());
return windowSize(size_str);
}
bool ApplicationOptions::enableHighDPISupport()
{
return find(highdpi);
}
......@@ -61,6 +61,8 @@ public:
QSize mainWindowSize() const;
bool enableHighDPISupport();
private:
//! true if options are consistent (no conflicts, no --help request)
bool m_options_is_consistent;
......
......@@ -32,6 +32,9 @@ int main(int argc, char* argv[])
qRegisterMetaType<QVector<double>>("QVector<double>");
qRegisterMetaType<FitProgressInfo>("FitProgressInfo");
if( options.enableHighDPISupport())
QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
QApplication app(argc, argv);
if (!options.find("with-debug"))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment