High-DPI: Remove usage of Qt::AA_EnableHighDpiScaling
This attribute is now on by default. Change-Id: I7c9d2e3445d204d3450758673048d514bc9c850c Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This commit is contained in:
parent
891fc4b42b
commit
dce106c77c
@ -55,7 +55,6 @@
|
||||
//! [0]
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||
QApplication app(argc, argv);
|
||||
MandelbrotWidget widget;
|
||||
widget.show();
|
||||
|
@ -61,11 +61,8 @@ int main(int argc, char *argv[])
|
||||
useHighDpiScaling = false;
|
||||
}
|
||||
|
||||
if (useHighDpiScaling) {
|
||||
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||
} else {
|
||||
if (!useHighDpiScaling)
|
||||
QCoreApplication::setAttribute(Qt::AA_DisableHighDpiScaling);
|
||||
}
|
||||
|
||||
QApplication app(argc, argv);
|
||||
WidgetGallery gallery;
|
||||
|
@ -58,9 +58,6 @@ static constexpr int MouseCount = 7;
|
||||
//! [0]
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
#ifdef Q_OS_ANDROID
|
||||
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||
#endif
|
||||
QApplication app(argc, argv);
|
||||
//! [0]
|
||||
|
||||
|
@ -55,9 +55,6 @@
|
||||
int main(int argv, char *args[])
|
||||
{
|
||||
Q_INIT_RESOURCE(diagramscene);
|
||||
#ifdef Q_OS_ANDROID
|
||||
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||
#endif
|
||||
|
||||
QApplication app(argv, args);
|
||||
MainWindow mainWindow;
|
||||
|
@ -55,9 +55,6 @@
|
||||
//! [0]
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
#ifdef Q_OS_ANDROID
|
||||
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||
#endif
|
||||
QApplication app(argc, argv);
|
||||
MainWindow mw;
|
||||
mw.show();
|
||||
|
@ -56,9 +56,6 @@
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
Q_INIT_RESOURCE(spreadsheet);
|
||||
#ifdef Q_OS_ANDROID
|
||||
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||
#endif
|
||||
|
||||
QApplication app(argc, argv);
|
||||
SpreadSheet sheet(10, 6);
|
||||
|
@ -58,9 +58,6 @@
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
Q_INIT_RESOURCE(application);
|
||||
#ifdef Q_OS_ANDROID
|
||||
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||
#endif
|
||||
|
||||
QApplication app(argc, argv);
|
||||
QCoreApplication::setOrganizationName("QtProject");
|
||||
|
@ -54,9 +54,6 @@
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
#ifdef Q_OS_ANDROID
|
||||
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||
#endif
|
||||
QApplication app(argc, argv);
|
||||
Q_INIT_RESOURCE(dockwidgets);
|
||||
MainWindow mainWin;
|
||||
|
@ -175,7 +175,6 @@ static ParseCommandLineArgumentsResult
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||
QApplication app(argc, argv);
|
||||
MainWindow::CustomSizeHintMap customSizeHints;
|
||||
switch (parseCustomSizeHints(QCoreApplication::arguments(), &customSizeHints)) {
|
||||
|
@ -54,9 +54,6 @@
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
#ifdef Q_OS_ANDROID
|
||||
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||
#endif
|
||||
QApplication app(argc, argv);
|
||||
Window window;
|
||||
window.show();
|
||||
|
@ -54,9 +54,6 @@
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
#ifdef Q_OS_ANDROID
|
||||
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||
#endif
|
||||
QApplication app(argc, argv);
|
||||
MainWindow window;
|
||||
window.show();
|
||||
|
@ -54,9 +54,6 @@
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
Q_INIT_RESOURCE(undo);
|
||||
#ifdef Q_OS_ANDROID
|
||||
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||
#endif
|
||||
|
||||
QApplication app(argc, argv);
|
||||
|
||||
|
@ -54,9 +54,6 @@
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
#ifdef Q_OS_ANDROID
|
||||
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||
#endif
|
||||
QApplication app(argc, argv);
|
||||
Calculator calc;
|
||||
calc.show();
|
||||
|
@ -55,9 +55,6 @@
|
||||
//! [0]
|
||||
int main( int argc, char *argv[] )
|
||||
{
|
||||
#ifdef Q_OS_ANDROID
|
||||
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||
#endif
|
||||
QApplication application( argc, argv );
|
||||
TestWidget w;
|
||||
w.showFullScreen();
|
||||
|
@ -54,9 +54,6 @@
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
#ifdef Q_OS_ANDROID
|
||||
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||
#endif
|
||||
QApplication app(argc, argv);
|
||||
MainWindow window;
|
||||
window.show();
|
||||
|
@ -54,9 +54,6 @@
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
#ifdef Q_OS_ANDROID
|
||||
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||
#endif
|
||||
QApplication app(argc, argv);
|
||||
Window window;
|
||||
window.show();
|
||||
|
@ -487,7 +487,9 @@ namespace Qt {
|
||||
AA_UseSoftwareOpenGL = 17,
|
||||
AA_ShareOpenGLContexts = 18,
|
||||
AA_SetPalette = 19,
|
||||
AA_EnableHighDpiScaling = 20,
|
||||
#if QT_DEPRECATED_SINCE(6, 0)
|
||||
AA_EnableHighDpiScaling Q_DECL_ENUMERATOR_DEPRECATED = 20,
|
||||
#endif
|
||||
AA_DisableHighDpiScaling = 21,
|
||||
AA_UseStyleSheetPropagationInWidgetStyles = 22,
|
||||
AA_DontUseNativeDialogs = 23,
|
||||
|
@ -215,15 +215,6 @@
|
||||
\value AA_SetPalette Indicates whether a palette was explicitly set on the
|
||||
QGuiApplication. This value was added in Qt 5.5.
|
||||
|
||||
\value AA_EnableHighDpiScaling Enables high-DPI scaling in Qt on supported
|
||||
platforms (see also \l{High DPI Displays}). Supported platforms are
|
||||
X11, Windows and Android. Enabling makes Qt scale the main (device
|
||||
independent) coordinate system according to display scale factors
|
||||
provided by the operating system. This corresponds to setting the
|
||||
QT_AUTO_SCREEN\unicode{0x200b}_SCALE_FACTOR environment variable to
|
||||
1. This attribute must be set before QGuiApplication is constructed.
|
||||
This value was added in Qt 5.6.
|
||||
|
||||
\value AA_DisableHighDpiScaling Disables high-DPI scaling in Qt, exposing window
|
||||
system coordinates. Note that the window system may do its own scaling,
|
||||
so this does not guarantee that QPaintDevice::devicePixelRatio() will
|
||||
@ -305,6 +296,7 @@
|
||||
This value was added in 5.15
|
||||
|
||||
\omitvalue AA_AttributeCount
|
||||
\omitvalue AA_EnableHighDpiScaling
|
||||
*/
|
||||
|
||||
/*!
|
||||
@ -3270,7 +3262,6 @@
|
||||
environment variable.
|
||||
|
||||
\sa QGuiApplication::setHighDpiScaleFactorRoundingPolicy()
|
||||
\sa AA_EnableHighDpiScaling.
|
||||
|
||||
\omitvalue Unset
|
||||
\value Round Round up for .5 and above.
|
||||
|
@ -952,7 +952,6 @@ void QCoreApplication::setAttribute(Qt::ApplicationAttribute attribute, bool on)
|
||||
if (Q_UNLIKELY(QCoreApplicationPrivate::is_app_running)) {
|
||||
#endif
|
||||
switch (attribute) {
|
||||
case Qt::AA_EnableHighDpiScaling:
|
||||
case Qt::AA_DisableHighDpiScaling:
|
||||
case Qt::AA_PluginApplication:
|
||||
case Qt::AA_UseDesktopOpenGL:
|
||||
|
@ -3699,7 +3699,7 @@ Qt::ApplicationState QGuiApplication::applicationState()
|
||||
|
||||
Sets the high-DPI scale factor rounding policy for the application. The
|
||||
\a policy decides how non-integer scale factors (such as Windows 150%) are
|
||||
handled, for applications that have AA_EnableHighDpiScaling enabled.
|
||||
handled.
|
||||
|
||||
The two principal options are whether fractional scale factors should
|
||||
be rounded to an integer or not. Keeping the scale factor as-is will
|
||||
|
@ -1586,8 +1586,8 @@ bool QDockWidget::event(QEvent *event)
|
||||
|
||||
// Usually the window won't get resized while it's being moved, but it can happen,
|
||||
// for example on Windows when moving to a screen with bigger scale factor
|
||||
// (and Qt::AA_EnableHighDpiScaling is enabled). If that happens we should
|
||||
// update state->pressPos, otherwise it will be outside the window when the window shrinks.
|
||||
// If that happens we should update state->pressPos, otherwise it will be outside
|
||||
// the window when the window shrinks.
|
||||
if (d->state && d->state->dragging)
|
||||
d->recalculatePressPos(static_cast<QResizeEvent*>(event));
|
||||
break;
|
||||
|
@ -496,10 +496,6 @@ private:
|
||||
|
||||
void tst_QGraphicsItem::initMain()
|
||||
{
|
||||
#ifdef Q_OS_WIN
|
||||
// Ensure minimum size constraints of framed windows on High DPI screens
|
||||
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||
#endif
|
||||
}
|
||||
|
||||
void tst_QGraphicsItem::cleanup()
|
||||
|
@ -267,10 +267,6 @@ protected:
|
||||
|
||||
void tst_QHeaderView::initMain()
|
||||
{
|
||||
#ifdef Q_OS_WIN
|
||||
// Ensure minimum size constraints of framed windows on High DPI screens
|
||||
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||
#endif
|
||||
}
|
||||
|
||||
class QtTestModel: public QAbstractTableModel
|
||||
|
@ -1458,7 +1458,6 @@ void MetricsTest::logScreenChangeSignal(const QObject *o, const char *name, cons
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
#define NOSCALINGOPTION "noscaling"
|
||||
#define SCALINGOPTION "scaling"
|
||||
|
||||
qInfo("High DPI tester %s", QT_VERSION_STR);
|
||||
|
||||
@ -1468,10 +1467,6 @@ int main(int argc, char **argv)
|
||||
QCoreApplication::setAttribute(Qt::AA_DisableHighDpiScaling);
|
||||
preAppOptionCount++;
|
||||
qInfo("AA_DisableHighDpiScaling");
|
||||
} else if (qstrcmp(argv[a], "--" SCALINGOPTION) == 0) {
|
||||
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||
preAppOptionCount++;
|
||||
qInfo("AA_EnableHighDpiScaling");
|
||||
}
|
||||
}
|
||||
|
||||
@ -1489,7 +1484,6 @@ int main(int argc, char **argv)
|
||||
QCommandLineOption controllerOption("interactive", "Show configuration window.");
|
||||
parser.addOption(controllerOption);
|
||||
parser.addOption(QCommandLineOption(NOSCALINGOPTION, "Set AA_DisableHighDpiScaling"));
|
||||
parser.addOption(QCommandLineOption(SCALINGOPTION, "Set AA_EnableHighDpiScaling"));
|
||||
|
||||
DemoContainerList demoList;
|
||||
demoList << new DemoContainer<PixmapPainter>("pixmap", "Test pixmap painter");
|
||||
|
@ -339,9 +339,7 @@ int main(int argc, char *argv[])
|
||||
std::copy(argv + 1, argv + argc, std::back_inserter(arguments));
|
||||
|
||||
#if QT_VERSION > 0x050000
|
||||
if (arguments.contains("-s"))
|
||||
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||
else if (arguments.contains("-n"))
|
||||
if (arguments.contains("-n"))
|
||||
QCoreApplication::setAttribute(Qt::AA_DisableHighDpiScaling);
|
||||
#endif // Qt 5
|
||||
|
||||
|
@ -77,7 +77,6 @@ QString graphicsApiName(QRhi::Implementation graphicsApi)
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||
QGuiApplication app(argc, argv);
|
||||
|
||||
QRhi::Implementation graphicsApi;
|
||||
|
@ -525,7 +525,6 @@ void closeWindow()
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||
QApplication app(argc, argv);
|
||||
|
||||
#if defined(Q_OS_WIN)
|
||||
|
@ -725,7 +725,6 @@ void closeWindow()
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||
QApplication app(argc, argv);
|
||||
|
||||
#if defined(Q_OS_WIN)
|
||||
|
@ -125,7 +125,6 @@ QString graphicsApiName()
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||
QGuiApplication app(argc, argv);
|
||||
|
||||
#if defined(Q_OS_WIN)
|
||||
|
@ -440,7 +440,6 @@ void Window::render()
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||
QGuiApplication app(argc, argv);
|
||||
|
||||
QLoggingCategory::setFilterRules(QLatin1String("qt.rhi.*=true"));
|
||||
|
Loading…
x
Reference in New Issue
Block a user