Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Disable in-session change of UI theme for Qt < 5.12
Random crasher associated with UI theme change is an
upstream bug, in the meantime let's make sure people don't
lose data crashing QGIS with an unsaved project.
  • Loading branch information
nirvn committed Dec 14, 2018
1 parent 36d3633 commit c714652
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
8 changes: 6 additions & 2 deletions src/app/qgsoptions.cpp
Expand Up @@ -144,7 +144,11 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WindowFlags fl, const QList<QgsOpti
QStringList themes = QgsApplication::uiThemes().keys();
cmbUITheme->addItems( themes );

#if QT_VERSION < QT_VERSION_CHECK( 5, 12, 0 )
lblUITheme->setText( QStringLiteral( "%1 <i>(%2)</i>" ).arg( lblUITheme->text(), tr( "QGIS restart required" ) ) );
#else
connect( cmbUITheme, static_cast<void ( QComboBox::* )( const QString & )>( &QComboBox::currentIndexChanged ), this, &QgsOptions::uiThemeChanged );
#endif

mIdentifyHighlightColorButton->setColorDialogTitle( tr( "Identify Highlight Color" ) );
mIdentifyHighlightColorButton->setAllowOpacity( true );
Expand Down Expand Up @@ -564,10 +568,10 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WindowFlags fl, const QList<QgsOpti
mMessageTimeoutSpnBx->setValue( mSettings->value( QStringLiteral( "/qgis/messageTimeout" ), 5 ).toInt() );

QString name = mSettings->value( QStringLiteral( "/qgis/style" ) ).toString();
cmbStyle->setCurrentIndex( cmbStyle->findText( name, Qt::MatchFixedString ) );
whileBlocking( cmbStyle )->setCurrentIndex( cmbStyle->findText( name, Qt::MatchFixedString ) );

QString theme = mSettings->value( QStringLiteral( "UI/UITheme" ), QStringLiteral( "auto" ) ).toString();
cmbUITheme->setCurrentIndex( cmbUITheme->findText( theme, Qt::MatchFixedString ) );
whileBlocking( cmbUITheme )->setCurrentIndex( cmbUITheme->findText( theme, Qt::MatchFixedString ) );

mNativeColorDialogsChkBx->setChecked( mSettings->value( QStringLiteral( "/qgis/native_color_dialogs" ), false ).toBool() );

Expand Down
1 change: 1 addition & 0 deletions src/core/qgsapplication.cpp
Expand Up @@ -67,6 +67,7 @@
#include <QPixmap>
#include <QThreadPool>
#include <QLocale>
#include <QStyle>

#ifndef Q_OS_WIN
#include <netinet/in.h>
Expand Down
2 changes: 1 addition & 1 deletion src/ui/qgsoptionsbase.ui
Expand Up @@ -484,7 +484,7 @@
<number>0</number>
</property>
<item>
<widget class="QLabel" name="label_42">
<widget class="QLabel" name="lblUITheme">
<property name="text">
<string>UI Theme</string>
</property>
Expand Down

0 comments on commit c714652

Please sign in to comment.