Clean up RiuWidgetStyleSheet and add more comments

This commit is contained in:
Gaute Lindkvist
2019-10-30 12:33:19 +01:00
parent a925c0f29e
commit 5c79ff2573
2 changed files with 34 additions and 30 deletions

View File

@@ -93,7 +93,7 @@ RiuWidgetStyleSheet::RiuWidgetStyleSheet()
}
//--------------------------------------------------------------------------------------------------
///
/// Set keys and values directly to the default state
//--------------------------------------------------------------------------------------------------
void RiuWidgetStyleSheet::set( const QString& key, const QString& value )
{
@@ -101,7 +101,7 @@ void RiuWidgetStyleSheet::set( const QString& key, const QString& value )
}
//--------------------------------------------------------------------------------------------------
///
/// Get values directly from the default state
//--------------------------------------------------------------------------------------------------
QString RiuWidgetStyleSheet::get( const QString& key ) const
{
@@ -110,7 +110,7 @@ QString RiuWidgetStyleSheet::get( const QString& key ) const
}
//--------------------------------------------------------------------------------------------------
///
/// Access a particular state in the stylesheet
//--------------------------------------------------------------------------------------------------
RiuWidgetStyleSheet::State& RiuWidgetStyleSheet::state( StateTag stateTag )
{
@@ -121,19 +121,7 @@ RiuWidgetStyleSheet::State& RiuWidgetStyleSheet::state( StateTag stateTag )
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RiuWidgetStyleSheet::propertyName( StateTag state )
{
if ( state < PSEUDO_STATE_LIMIT )
{
return StateTagEnum::text( state );
}
return "";
}
//--------------------------------------------------------------------------------------------------
///
/// Apply the current stylesheet to the provided widget instance
//--------------------------------------------------------------------------------------------------
void RiuWidgetStyleSheet::applyToWidget( QWidget* widget ) const
{
@@ -144,16 +132,7 @@ void RiuWidgetStyleSheet::applyToWidget( QWidget* widget ) const
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuWidgetStyleSheet::refreshWidget( QWidget* widget ) const
{
widget->style()->unpolish( widget );
widget->style()->polish( widget );
}
//--------------------------------------------------------------------------------------------------
///
/// Put the provided widget into the provided state
//--------------------------------------------------------------------------------------------------
void RiuWidgetStyleSheet::setWidgetState( QWidget* widget, StateTag widgetState ) const
{
@@ -187,6 +166,15 @@ QString RiuWidgetStyleSheet::fullText( const QString& className, const QString&
return textForAllStates.join( "\n" );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuWidgetStyleSheet::refreshWidget( QWidget* widget ) const
{
widget->style()->unpolish( widget );
widget->style()->polish( widget );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -203,3 +191,15 @@ QString RiuWidgetStyleSheet::buildStateString( StateTag state )
}
return stateString;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RiuWidgetStyleSheet::propertyName( StateTag state )
{
if ( state < PSEUDO_STATE_LIMIT )
{
return StateTagEnum::text( state );
}
return "";
}