do not use focus navigation for the list entries
This commit is contained in:
parent
e9ed10ac82
commit
75b64d049a
|
@ -19,6 +19,8 @@ QSK_SUBCONTROL( QskListView, Text )
|
||||||
|
|
||||||
QSK_STATE( QskListView, Selected, QskAspect::FirstUserState )
|
QSK_STATE( QskListView, Selected, QskAspect::FirstUserState )
|
||||||
|
|
||||||
|
#define FOCUS_ON_CURRENT 1
|
||||||
|
|
||||||
class QskListView::PrivateData
|
class QskListView::PrivateData
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -44,7 +46,9 @@ QskListView::QskListView( QQuickItem* parent )
|
||||||
: QskScrollView( parent )
|
: QskScrollView( parent )
|
||||||
, m_data( new PrivateData() )
|
, m_data( new PrivateData() )
|
||||||
{
|
{
|
||||||
|
#if FOCUS_ON_CURRENT
|
||||||
connect( this, &QskScrollView::scrollPosChanged, &QskControl::focusIndicatorRectChanged );
|
connect( this, &QskScrollView::scrollPosChanged, &QskControl::focusIndicatorRectChanged );
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
QskListView::~QskListView()
|
QskListView::~QskListView()
|
||||||
|
@ -152,13 +156,17 @@ QskColorFilter QskListView::graphicFilterAt( int row, int col ) const
|
||||||
|
|
||||||
QRectF QskListView::focusIndicatorRect() const
|
QRectF QskListView::focusIndicatorRect() const
|
||||||
{
|
{
|
||||||
|
#if FOCUS_ON_CURRENT
|
||||||
if( m_data->selectedRow >= 0 )
|
if( m_data->selectedRow >= 0 )
|
||||||
{
|
{
|
||||||
const auto rect = effectiveSkinlet()->sampleRect(
|
auto rect = effectiveSkinlet()->sampleRect(
|
||||||
this, contentsRect(), Cell, m_data->selectedRow );
|
this, contentsRect(), Cell, m_data->selectedRow );
|
||||||
|
|
||||||
return rect.translated( -scrollPos() );
|
rect = rect.translated( -scrollPos() );
|
||||||
|
if ( rect.intersects( viewContentsRect() ) )
|
||||||
|
return rect;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
return Inherited::focusIndicatorRect();
|
return Inherited::focusIndicatorRect();
|
||||||
}
|
}
|
||||||
|
@ -210,19 +218,8 @@ void QskListView::keyPressEvent( QKeyEvent* event )
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
if ( const int steps = qskFocusChainIncrement( event ) )
|
Inherited::keyPressEvent( event );
|
||||||
{
|
return;
|
||||||
row += steps;
|
|
||||||
|
|
||||||
if( row < 0 )
|
|
||||||
{
|
|
||||||
row += rowCount();
|
|
||||||
}
|
|
||||||
else if( row >= rowCount() )
|
|
||||||
{
|
|
||||||
row %= rowCount();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue