Skip to content
Permalink
Browse files

[attrtable] Force default selection color (regardless of window focus)

Fix #8205
  • Loading branch information
m-kuhn committed Jan 13, 2014
1 parent a273b69 commit 173e1d72a668fcf26366fc64052ed664fefe059b
Showing with 18 additions and 0 deletions.
  1. +15 −0 src/app/qgisappstylesheet.cpp
  2. +3 −0 src/app/qgsattributetabledialog.cpp
@@ -184,6 +184,21 @@ void QgisAppStyleSheet::buildStyleSheet( const QMap<QString, QVariant>& opts )
ss += "} ";
}

// Fix selection color on loosing focus (Windows)
QApplication* app = dynamic_cast<QApplication*>( QgsApplication::instance() );
if ( app )
{
const QPalette palette = app->palette();

ss += QString( "QTableView {"
"selection-background-color: %1;"
"selection-color: %2;"
"}")
.arg( palette.highlight().color().name() )
.arg( palette.highlightedText().color().name() );
}


QgsDebugMsg( QString( "Stylesheet built: %1" ).arg( ss ) );

emit appStyleSheetChanged( ss );
@@ -64,6 +64,9 @@ QgsAttributeTableDialog::QgsAttributeTableDialog( QgsVectorLayer *theLayer, QWid
{
setupUi( this );

// Fix selection color on loosing focus (Windows)
setStyleSheet( QgisApp::instance()->styleSheet() );

setAttribute( Qt::WA_DeleteOnClose );

QSettings settings;

0 comments on commit 173e1d7

Please sign in to comment.
You can’t perform that action at this time.