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