Skip to content

Commit

Permalink
build: fix qt6 build on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
variar committed Mar 23, 2022
1 parent 400da15 commit 4c39210
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions src/app/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,32 +84,33 @@ void setApplicationAttributes( bool enableQtHdpi, int scaleFactorRounding )
qputenv( "QT_BEARER_POLL_TIMEOUT", QByteArray::number( std::numeric_limits<int>::max() ) );

#if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 )
if ( enableQtHdpi ) {
// This attribute must be set before QGuiApplication is constructed:
QCoreApplication::setAttribute( Qt::AA_EnableHighDpiScaling );
// We support high-dpi (aka Retina) displays
QCoreApplication::setAttribute( Qt::AA_UseHighDpiPixmaps );
#ifdef Q_OS_WIN
QCoreApplication::setAttribute( Qt::AA_DisableWindowContextHelpButton );
#endif

if ( !enableQtHdpi ) {
QCoreApplication::setAttribute( Qt::AA_DisableHighDpiScaling );
}
else {

#if QT_VERSION >= QT_VERSION_CHECK( 5, 14, 0 )
QGuiApplication::setHighDpiScaleFactorRoundingPolicy(
static_cast<Qt::HighDpiScaleFactorRoundingPolicy>( scaleFactorRounding ) );
#else
Q_UNUSED( scaleFactorRounding );
#endif
}
else {
QCoreApplication::setAttribute( Qt::AA_DisableHighDpiScaling );

// This attribute must be set before QGuiApplication is constructed:
QCoreApplication::setAttribute( Qt::AA_EnableHighDpiScaling );
// We support high-dpi (aka Retina) displays
QCoreApplication::setAttribute( Qt::AA_UseHighDpiPixmaps );
}
#else
Q_UNUSED( enableQtHdpi );
Q_UNUSED( scaleFactorRounding );
#endif

QCoreApplication::setAttribute( Qt::AA_DontShowIconsInMenus );

#ifdef Q_OS_WIN
QCoreApplication::setAttribute( Qt::AA_DisableWindowContextHelpButton );
#endif
}

int main( int argc, char* argv[] )
Expand Down

0 comments on commit 4c39210

Please sign in to comment.