mirror of
https://github.com/OPM/ResInsight.git
synced 2024-12-29 10:21:54 -06:00
Modify the the background color of table using stylesheets
This commit is contained in:
parent
33dcd55561
commit
d0a9b7cd0b
@ -193,9 +193,25 @@ void PdmUiTableViewEditor::configureAndUpdateUi( const QString& uiConfigName )
|
||||
this->setRowSelectionLevel( editorAttrib.rowSelectionLevel );
|
||||
this->enableHeaderText( editorAttrib.enableHeaderText );
|
||||
|
||||
QPalette myPalette( m_tableView->palette() );
|
||||
myPalette.setColor( QPalette::Base, editorAttrib.baseColor );
|
||||
m_tableView->setPalette( myPalette );
|
||||
QString styleSheetTable;
|
||||
QString styleSheetHeader;
|
||||
|
||||
if ( editorAttrib.baseColor.isValid() )
|
||||
{
|
||||
// Configure style sheet to set the background color of the table and headers, including the corner button
|
||||
|
||||
styleSheetTable = QString( "QTableView QTableCornerButton::section { background: %1 } QTableView { "
|
||||
"background-color : %1 } " )
|
||||
.arg( editorAttrib.baseColor.name() );
|
||||
|
||||
styleSheetHeader =
|
||||
QString( "QHeaderView { background-color: %1 } QHeaderView::section { background-color: %1 }" )
|
||||
.arg( editorAttrib.baseColor.name() );
|
||||
}
|
||||
|
||||
m_tableView->setStyleSheet( styleSheetTable );
|
||||
m_tableView->horizontalHeader()->setStyleSheet( styleSheetHeader );
|
||||
m_tableView->verticalHeader()->setStyleSheet( styleSheetHeader );
|
||||
|
||||
// Drop target settings
|
||||
m_tableView->setAcceptDrops( editorAttrib.enableDropTarget );
|
||||
|
@ -107,11 +107,8 @@ public:
|
||||
, resizePolicy( NO_AUTOMATIC_RESIZE )
|
||||
, enableDropTarget( false )
|
||||
{
|
||||
QPalette myPalette;
|
||||
baseColor = myPalette.color( QPalette::Active, QPalette::Base );
|
||||
}
|
||||
|
||||
int selectionLevel;
|
||||
int tableSelectionLevel;
|
||||
int rowSelectionLevel;
|
||||
bool enableHeaderText;
|
||||
|
Loading…
Reference in New Issue
Block a user