Ticket #57577: patch-graphicssystem-via-qtconfig.2.diff

File patch-graphicssystem-via-qtconfig.2.diff, 5.1 KB (added by RJVB (René Bertin), 6 years ago)
  • src/gui/kernel/qapplication.cpp

    diff --git src/gui/kernel/qapplication.cpp src/gui/kernel/qapplication.cpp
    index 22da34e0154a5b37566f38c514648a9125ee5771..3efa5433eb2801bed7e2a5f1bcf8ae609ed88d86 100644
    void QApplicationPrivate::construct( 
    818818
    819819    qt_is_gui_used = (qt_appType != QApplication::Tty);
    820820    process_cmdline();
    821     // the environment variable has the lowest precedence of runtime graphicssystem switches
     821    // the environment variable has almost the lowest precedence of runtime graphicssystem switches
    822822    if (graphics_system_name.isEmpty())
    823823        graphics_system_name = QString::fromLocal8Bit(qgetenv("QT_GRAPHICSSYSTEM"));
     824    if (graphics_system_name.isEmpty()) {
     825        // Fetch the default graphics system from the settings store if no other setting has been made
     826        QSettings settings(QSettings::UserScope, QLatin1String("Trolltech"));
     827        settings.beginGroup(QLatin1String("Qt"));
     828        const QString defaultGraphicsSystem = settings.value(QLatin1String("DefaultGraphicsSystem")).toString();
     829        if (! defaultGraphicsSystem.isNull() && ! defaultGraphicsSystem.isEmpty()) {
     830            graphics_system_name = defaultGraphicsSystem;
     831        }
     832    }
     833
    824834
    825835#if defined(Q_WS_X11) && !defined(QT_NO_EGL)
    826836    if (graphics_system_name.isEmpty()) {
  • tools/qtconfig/mainwindow.cpp

    diff --git tools/qtconfig/mainwindow.cpp tools/qtconfig/mainwindow.cpp
    index 1bb6e4eae01fd43d9de41d627677abc8521908d8..e1726fb174c406311bf132d4f6c70ba3016a4c41 100644
    MainWindow::MainWindow() 
    227238    connect(ui->rtlExtensionsCheckBox, SIGNAL(toggled(bool)), SLOT(somethingModified()));
    228239    connect(ui->inputStyleCombo, SIGNAL(activated(int)), SLOT(somethingModified()));
    229240    connect(ui->inputMethodCombo, SIGNAL(activated(int)), SLOT(somethingModified()));
     241    connect(ui->graphicsSystemCombo, SIGNAL(activated(int)), SLOT(somethingModified()));
    230242    connect(ui->guiStyleCombo, SIGNAL(activated(QString)), SLOT(styleSelected(QString)));
    231243    connect(ui->familySubstitutionCombo, SIGNAL(activated(QString)), SLOT(substituteSelected(QString)));
    232244    connect(ui->tunePaletteButton, SIGNAL(clicked()), SLOT(tunePalette()));
    MainWindow::MainWindow() 
    416463    ui->inputMethodCombo->hide();
    417464    ui->inputMethodLabel->hide();
    418465#endif
    419 
     466#ifdef Q_OS_MAC
     467    ui->graphicsSystemCombo->setToolTip(tr("Select the graphicsssystem to be used by default.\n"
     468        "Native: use native CoreGraphics rendering\n"
     469        "Raster: use raster graphics\n"
     470        "OpenGL: use OpenGL (experimental!)\n"
     471        "Raster mode is the preferred default except on Mac OS 10.14 and newer where it causes flickering.\n"
     472        "Use Native rendering on those newer OS versions (or if you experience other graphics glitches)."));
     473    QStringList graphicsSystems;
     474    QString defaultGraphicsSystem = settings.value(QLatin1String("DefaultGraphicsSystem"), QLatin1String("Raster")).toString();
     475
     476    graphicsSystems << tr("(unset)") << tr("Native") << tr("Raster") << tr("OpenGL");
     477    ui->graphicsSystemCombo->addItems(graphicsSystems);
     478    if (!defaultGraphicsSystem.isNull() && !defaultGraphicsSystem.isEmpty()) {
     479        ui->graphicsSystemCombo->setCurrentIndex(graphicsSystems.indexOf(QRegExp(defaultGraphicsSystem, Qt::CaseInsensitive)));
     480    }
     481#else
     482    ui->graphicsSystemLabel->hide();
     483    ui->graphicsSystemCombo->hide();
     484#endif
    420485    ui->fontEmbeddingCheckBox->setChecked(settings.value(QLatin1String("embedFonts"), true)
    421486                                          .toBool());
    422487    fontpaths = settings.value(QLatin1String("fontPath")).toStringList();
    void MainWindow::fileSave() 
    573638#if defined(Q_WS_X11) && !defined(QT_NO_XIM)
    574639        settings.setValue(QLatin1String("DefaultInputMethod"), ui->inputMethodCombo->currentText());
    575640#endif
     641#ifdef Q_OS_MAC
     642        if (ui->graphicsSystemCombo->currentIndex() > 0) {
     643            settings.setValue(QLatin1String("DefaultGraphicsSystem"), ui->graphicsSystemCombo->currentText());
     644        } else {
     645            settings.remove(QLatin1String("DefaultGraphicsSystem"));
     646        }
     647#endif
    576648
    577649        QString audioSink = settings.value(QLatin1String("audiosink"), QLatin1String("Auto")).toString();
    578650        QString videoMode = settings.value(QLatin1String("videomode"), QLatin1String("Auto")).toString();
  • tools/qtconfig/mainwindow.ui

    diff --git tools/qtconfig/mainwindow.ui tools/qtconfig/mainwindow.ui
    index 454021ecdf2c00b29b9f2b86a2a68893da57b572..7593f7140b8ad73b1c615439dd4b473e37b3e9a7 100644
     
    901901          </property>
    902902         </widget>
    903903        </item>
     904        <item>
     905         <widget class="QLabel" name="graphicsSystemLabel">
     906          <property name="text">
     907           <string>Default Graphics System:</string>
     908          </property>
     909         </widget>
     910        </item>
     911        <item>
     912         <widget class="QComboBox" name="graphicsSystemCombo">
     913          <property name="currentIndex">
     914           <number>-1</number>
     915          </property>
     916         </widget>
     917        </item>
    904918        <item>
    905919         <spacer>
    906920          <property name="orientation">