Add an assert on object name to RiuWidgetStyleSheet

This commit is contained in:
Gaute Lindkvist
2019-10-30 12:39:18 +01:00
parent 5c79ff2573
commit 35ecde99c8
2 changed files with 4 additions and 3 deletions

View File

@@ -125,6 +125,8 @@ RiuWidgetStyleSheet::State& RiuWidgetStyleSheet::state( StateTag stateTag )
//--------------------------------------------------------------------------------------------------
void RiuWidgetStyleSheet::applyToWidget( QWidget* widget ) const
{
CAF_ASSERT( !widget->objectName().isEmpty() &&
"The widget is required to have an object name set with setObjectName" );
QString completeStyleSheet = fullText( QString( widget->metaObject()->className() ), widget->objectName() );
// qDebug().noquote() << completeStyleSheet;
widget->setStyleSheet( completeStyleSheet );

View File

@@ -27,9 +27,8 @@ class RiuWidgetStyleSheetManager;
class QWidget;
//==================================================================================================
//
//
//
// ResInsight widget class. Meant to create and apply style sheets to particular widget instances.
// without "bleeding" the look into other widgets.
//==================================================================================================
class RiuWidgetStyleSheet
{