mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -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->setRowSelectionLevel( editorAttrib.rowSelectionLevel );
|
||||||
this->enableHeaderText( editorAttrib.enableHeaderText );
|
this->enableHeaderText( editorAttrib.enableHeaderText );
|
||||||
|
|
||||||
QPalette myPalette( m_tableView->palette() );
|
QString styleSheetTable;
|
||||||
myPalette.setColor( QPalette::Base, editorAttrib.baseColor );
|
QString styleSheetHeader;
|
||||||
m_tableView->setPalette( myPalette );
|
|
||||||
|
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
|
// Drop target settings
|
||||||
m_tableView->setAcceptDrops( editorAttrib.enableDropTarget );
|
m_tableView->setAcceptDrops( editorAttrib.enableDropTarget );
|
||||||
|
@ -107,11 +107,8 @@ public:
|
|||||||
, resizePolicy( NO_AUTOMATIC_RESIZE )
|
, resizePolicy( NO_AUTOMATIC_RESIZE )
|
||||||
, enableDropTarget( false )
|
, enableDropTarget( false )
|
||||||
{
|
{
|
||||||
QPalette myPalette;
|
|
||||||
baseColor = myPalette.color( QPalette::Active, QPalette::Base );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int selectionLevel;
|
|
||||||
int tableSelectionLevel;
|
int tableSelectionLevel;
|
||||||
int rowSelectionLevel;
|
int rowSelectionLevel;
|
||||||
bool enableHeaderText;
|
bool enableHeaderText;
|
||||||
|
Loading…
Reference in New Issue
Block a user