QSkinny 0.8.0
C++/Qt UI toolkit
Loading...
Searching...
No Matches
QskFocusIndicator.h
1/******************************************************************************
2 * QSkinny - Copyright (C) The authors
3 * SPDX-License-Identifier: BSD-3-Clause
4 *****************************************************************************/
5
6#ifndef QSK_FOCUS_INDICATOR_H
7#define QSK_FOCUS_INDICATOR_H
8
9#include "QskControl.h"
10
11class QSK_EXPORT QskFocusIndicator : public QskControl
12{
13 Q_OBJECT
14
15 using Inherited = QskControl;
16
17 Q_PROPERTY( int duration READ duration
18 WRITE setDuration NOTIFY durationChanged )
19
20 public:
21 QSK_SUBCONTROLS( Panel )
22
23 QskFocusIndicator( QQuickItem* parent = nullptr );
24 ~QskFocusIndicator() override;
25
26 /*
27 duration until the indicator goes into disabled state after being enabled.
28 A duration of 0 disables automatic state changes.
29 */
30 void setDuration( int ms );
31 int duration() const;
32
33 bool contains( const QPointF& ) const override;
34 QRectF clipRect() const override;
35
36 bool eventFilter( QObject*, QEvent* ) override;
37
38 Q_SIGNALS:
39 void durationChanged( int );
40
41 protected:
43 void timerEvent( QTimerEvent* ) override;
44
45 virtual QRectF focusRect() const;
46 void updateFocusFrame();
47
48 private:
49 void onFocusItemGeometryChanged();
50 void onWindowSizeChanged( int );
51
52 void onFocusItemChanged();
53 void onFocusItemDestroyed();
54
55 void resetTimer();
56 void maybeEnable( bool );
57
58 void connectWindow( const QQuickWindow*, bool on );
59 QVector< QMetaObject::Connection > connectItem( const QQuickItem* );
60
61 class PrivateData;
62 std::unique_ptr< PrivateData > m_data;
63};
64
65#endif
Base class of all controls.
Definition QskControl.h:23
virtual void windowChangeEvent(QskWindowChangeEvent *)
Definition QskItem.cpp:851