Skip to content

Commit

Permalink
[attrtable] Force default selection color (regardless of window focus)
Browse files Browse the repository at this point in the history
Fix #8205
  • Loading branch information
m-kuhn committed Jan 13, 2014
1 parent a273b69 commit 173e1d7
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/app/qgisappstylesheet.cpp
Expand Up @@ -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 );
Expand Down
3 changes: 3 additions & 0 deletions src/app/qgsattributetabledialog.cpp
Expand Up @@ -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;
Expand Down

0 comments on commit 173e1d7

Please sign in to comment.