alternating row colors as skin hint
This commit is contained in:
parent
a88a1b7a50
commit
3d7afa533a
|
@ -1056,6 +1056,8 @@ void Editor::setupListView()
|
||||||
|
|
||||||
setColor( Q::Cell | Q::Selected, m_pal.highlighted );
|
setColor( Q::Cell | Q::Selected, m_pal.highlighted );
|
||||||
setColor( Q::Text | Q::Selected, m_pal.highlightedText );
|
setColor( Q::Text | Q::Selected, m_pal.highlightedText );
|
||||||
|
|
||||||
|
setFlag( Q::Cell | QskAspect::Style, true ); // alternating colors
|
||||||
}
|
}
|
||||||
|
|
||||||
void Editor::setupSubWindow()
|
void Editor::setupSubWindow()
|
||||||
|
|
|
@ -23,14 +23,12 @@ class QskListView::PrivateData
|
||||||
public:
|
public:
|
||||||
PrivateData()
|
PrivateData()
|
||||||
: preferredWidthFromColumns( false )
|
: preferredWidthFromColumns( false )
|
||||||
, alternatingRowColors( false )
|
|
||||||
, selectionMode( QskListView::SingleSelection )
|
, selectionMode( QskListView::SingleSelection )
|
||||||
, selectedRow( -1 )
|
, selectedRow( -1 )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
bool preferredWidthFromColumns : 1;
|
bool preferredWidthFromColumns : 1;
|
||||||
bool alternatingRowColors : 1;
|
|
||||||
SelectionMode selectionMode : 4;
|
SelectionMode selectionMode : 4;
|
||||||
|
|
||||||
int selectedRow;
|
int selectedRow;
|
||||||
|
@ -64,18 +62,19 @@ bool QskListView::preferredWidthFromColumns() const
|
||||||
|
|
||||||
void QskListView::setAlternatingRowColors( bool on )
|
void QskListView::setAlternatingRowColors( bool on )
|
||||||
{
|
{
|
||||||
if ( on != m_data->alternatingRowColors )
|
if ( setFlagHint( Cell | QskAspect::Style, on ) )
|
||||||
{
|
|
||||||
m_data->alternatingRowColors = on;
|
|
||||||
update();
|
|
||||||
|
|
||||||
Q_EMIT alternatingRowColorsChanged();
|
Q_EMIT alternatingRowColorsChanged();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
bool QskListView::alternatingRowColors() const
|
bool QskListView::alternatingRowColors() const
|
||||||
{
|
{
|
||||||
return m_data->alternatingRowColors;
|
return flagHint< bool >( Cell | QskAspect::Style, false );
|
||||||
|
}
|
||||||
|
|
||||||
|
void QskListView::resetAlternatingRowColors()
|
||||||
|
{
|
||||||
|
if ( resetSkinHint( Cell | QskAspect::Style ) )
|
||||||
|
Q_EMIT alternatingRowColorsChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QskListView::setTextOptions( const QskTextOptions& textOptions )
|
void QskListView::setTextOptions( const QskTextOptions& textOptions )
|
||||||
|
@ -92,6 +91,15 @@ QskTextOptions QskListView::textOptions() const
|
||||||
return textOptionsHint( Text );
|
return textOptionsHint( Text );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QskListView::resetTextOptions()
|
||||||
|
{
|
||||||
|
if ( resetTextOptionsHint( Text ) )
|
||||||
|
{
|
||||||
|
updateScrollableSize();
|
||||||
|
Q_EMIT textOptionsChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void QskListView::setSelectedRow( int row )
|
void QskListView::setSelectedRow( int row )
|
||||||
{
|
{
|
||||||
if ( row < 0 )
|
if ( row < 0 )
|
||||||
|
|
|
@ -14,7 +14,8 @@ class QSK_EXPORT QskListView : public QskScrollView
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
Q_PROPERTY( bool alternatingRowColors READ alternatingRowColors
|
Q_PROPERTY( bool alternatingRowColors READ alternatingRowColors
|
||||||
WRITE setAlternatingRowColors NOTIFY alternatingRowColorsChanged FINAL )
|
WRITE setAlternatingRowColors RESET resetAlternatingRowColors
|
||||||
|
NOTIFY alternatingRowColorsChanged FINAL )
|
||||||
|
|
||||||
Q_PROPERTY( SelectionMode selectionMode READ selectionMode
|
Q_PROPERTY( SelectionMode selectionMode READ selectionMode
|
||||||
WRITE setSelectionMode NOTIFY selectionModeChanged FINAL )
|
WRITE setSelectionMode NOTIFY selectionModeChanged FINAL )
|
||||||
|
@ -23,7 +24,8 @@ class QSK_EXPORT QskListView : public QskScrollView
|
||||||
WRITE setSelectedRow NOTIFY selectedRowChanged FINAL )
|
WRITE setSelectedRow NOTIFY selectedRowChanged FINAL )
|
||||||
|
|
||||||
Q_PROPERTY( QskTextOptions textOptions READ textOptions
|
Q_PROPERTY( QskTextOptions textOptions READ textOptions
|
||||||
WRITE setTextOptions NOTIFY textOptionsChanged FINAL )
|
WRITE setTextOptions RESET resetTextOptions
|
||||||
|
NOTIFY textOptionsChanged FINAL )
|
||||||
|
|
||||||
Q_PROPERTY( bool preferredWidthFromColumns READ preferredWidthFromColumns
|
Q_PROPERTY( bool preferredWidthFromColumns READ preferredWidthFromColumns
|
||||||
WRITE setPreferredWidthFromColumns NOTIFY preferredWidthFromColumnsChanged() )
|
WRITE setPreferredWidthFromColumns NOTIFY preferredWidthFromColumnsChanged() )
|
||||||
|
@ -49,12 +51,14 @@ class QSK_EXPORT QskListView : public QskScrollView
|
||||||
bool preferredWidthFromColumns() const;
|
bool preferredWidthFromColumns() const;
|
||||||
|
|
||||||
void setAlternatingRowColors( bool );
|
void setAlternatingRowColors( bool );
|
||||||
|
void resetAlternatingRowColors();
|
||||||
bool alternatingRowColors() const;
|
bool alternatingRowColors() const;
|
||||||
|
|
||||||
void setSelectionMode( SelectionMode );
|
void setSelectionMode( SelectionMode );
|
||||||
SelectionMode selectionMode() const;
|
SelectionMode selectionMode() const;
|
||||||
|
|
||||||
void setTextOptions( const QskTextOptions& textOptions );
|
void setTextOptions( const QskTextOptions& textOptions );
|
||||||
|
void resetTextOptions();
|
||||||
QskTextOptions textOptions() const;
|
QskTextOptions textOptions() const;
|
||||||
|
|
||||||
Q_INVOKABLE int selectedRow() const;
|
Q_INVOKABLE int selectedRow() const;
|
||||||
|
|
Loading…
Reference in New Issue