Skip to content

Commit

Permalink
lightpreview: enable highdpi support, set larger default window size
Browse files Browse the repository at this point in the history
  • Loading branch information
ericwa committed Oct 2, 2023
1 parent a287eb0 commit 7abfec9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
8 changes: 8 additions & 0 deletions lightpreview/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ See file, 'COPYING', for details.
#include <QSurfaceFormat>
#include <QSettings>
#include <QCoreApplication>
#include <QGuiApplication>
#include <QtGlobal>

int main(int argc, char *argv[])
{
Expand All @@ -30,6 +32,12 @@ int main(int argc, char *argv[])
QCoreApplication::setOrganizationName("ericw-tools");
QCoreApplication::setApplicationName("lightpreview");

QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling, true);
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
// allow non-integer monitor scaling
QGuiApplication::setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::PassThrough);
#endif

QApplication a(argc, argv);
a.setStyle("fusion");
a.setPalette(QPalette(QColor(64, 64, 64)));
Expand Down
4 changes: 2 additions & 2 deletions lightpreview/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,6 @@ MainWindow::MainWindow(QWidget *parent)
// create the menu first as it is used by other things (dock widgets)
setupMenu();

resize(640, 480);

// gl view
glView = new GLView(this);
setCentralWidget(glView);
Expand All @@ -136,6 +134,8 @@ MainWindow::MainWindow(QWidget *parent)
createOutputLog();

createStatusBar();

resize(1024, 768);
}

void MainWindow::createPropertiesSidebar()
Expand Down

0 comments on commit 7abfec9

Please sign in to comment.