Implemented 'Change color of list view #6512'. Style of list widget can now be changed in style sheet by using the dynamic property state="ExternalInput".

This commit is contained in:
rubenthoms
2020-09-18 10:38:20 +02:00
committed by Gaute Lindkvist
parent 23f581d7a0
commit 719feac15e
5 changed files with 24 additions and 7 deletions

View File

@@ -703,9 +703,11 @@ void RimExtrudedCurveIntersection::setPushButtonText( bool buttonEnable, caf::Pd
//--------------------------------------------------------------------------------------------------
void RimExtrudedCurveIntersection::setBaseColor( bool enable, caf::PdmUiListEditorAttribute* attribute )
{
if ( attribute && enable )
// if ( attribute && enable )
if ( attribute )
{
attribute->m_baseColor.setRgb( 255, 220, 255 );
attribute->m_qssState = enable ? "ExternalInput" : QString();
// attribute->m_baseColor.setRgb( 255, 220, 255 );
}
}

View File

@@ -19,6 +19,7 @@ $markerColor: #e6e7ea; // Marker color
$lineMarkerColor: #eeeeee; // Color of line marker
$plotGridColor: #394046; // Plot grid color
$auxiliaryCurveColor: #000000; // Auxiliary curve color
$externalInputColor: #e82257; // External input background color
QwtPlot["*"]::grid["*"] {
color: $backgroundColor2;
@@ -361,4 +362,9 @@ QMinimizePanel QLabel, QMinimizePanel QCheckBox, QToolButton {
QTextEdit, QPlainTextEdit {
border: 2px solid $borderColor;
}
QWidget[state="ExternalInput"] {
background-color: $externalInputColor;
border: 2px solid $borderColor;
}

View File

@@ -19,6 +19,7 @@ $markerColor: #141719; // Marker color
$lineMarkerColor: #eeeeee; // Color of line marker
$plotGridColor: #394046; // Plot grid color
$auxiliaryCurveColor: #000000; // Auxiliary curve color
$externalInputColor: #fff2a7; // Background color for external input fields
QwtPlot["*"]::grid["*"] {
color: $backgroundColor2;
@@ -90,4 +91,9 @@ QMainWindow {
QToolBar {
background-color: #eeeeee;
}
QListView[state="ExternalInput"] {
background-color: $externalInputColor;
border: 2px solid $borderColor;
}

View File

@@ -177,13 +177,15 @@ void PdmUiListEditor::configureAndUpdateUi( const QString& uiConfigName )
{
uiObject->editorAttribute( uiField()->fieldHandle(), uiConfigName, &attributes );
QPalette myPalette;
m_listView->setHeightHint( attributes.m_heightHint );
if ( !attributes.m_allowHorizontalScrollBar )
{
m_listView->setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
}
m_listView->setProperty( "state", attributes.m_qssState );
m_listView->style()->unpolish( m_listView );
m_listView->style()->polish( m_listView );
}
MyStringListModel* strListModel = dynamic_cast<MyStringListModel*>( m_model.data() );

View File

@@ -63,9 +63,10 @@ public:
}
public:
QColor m_baseColor;
int m_heightHint;
bool m_allowHorizontalScrollBar;
QColor m_baseColor;
QString m_qssState;
int m_heightHint;
bool m_allowHorizontalScrollBar;
};
//==================================================================================================