2017-07-21 16:21:34 +00:00
|
|
|
/******************************************************************************
|
2024-01-17 13:31:45 +00:00
|
|
|
* QSkinny - Copyright (C) The authors
|
2023-04-06 07:23:37 +00:00
|
|
|
* SPDX-License-Identifier: BSD-3-Clause
|
2017-07-21 16:21:34 +00:00
|
|
|
*****************************************************************************/
|
|
|
|
|
|
|
|
#ifndef QSK_FOCUS_INDICATOR_H
|
|
|
|
#define QSK_FOCUS_INDICATOR_H
|
|
|
|
|
|
|
|
#include "QskControl.h"
|
|
|
|
|
|
|
|
class QSK_EXPORT QskFocusIndicator : public QskControl
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
using Inherited = QskControl;
|
|
|
|
|
2023-12-02 11:48:20 +00:00
|
|
|
Q_PROPERTY( int duration READ duration
|
|
|
|
WRITE setDuration NOTIFY durationChanged )
|
|
|
|
|
2018-08-03 06:15:28 +00:00
|
|
|
public:
|
2017-07-21 16:21:34 +00:00
|
|
|
QSK_SUBCONTROLS( Panel )
|
|
|
|
|
|
|
|
QskFocusIndicator( QQuickItem* parent = nullptr );
|
2018-07-31 15:32:25 +00:00
|
|
|
~QskFocusIndicator() override;
|
2017-07-21 16:21:34 +00:00
|
|
|
|
2023-12-02 11:48:20 +00:00
|
|
|
/*
|
|
|
|
duration until the indicator goes into disabled state after being enabled.
|
|
|
|
A duration of 0 disables automatic state changes.
|
|
|
|
*/
|
|
|
|
void setDuration( int ms );
|
|
|
|
int duration() const;
|
|
|
|
|
2019-09-10 15:01:47 +00:00
|
|
|
bool contains( const QPointF& ) const override;
|
2020-03-16 12:17:51 +00:00
|
|
|
QRectF clipRect() const override;
|
2019-04-04 16:00:22 +00:00
|
|
|
|
2023-12-02 11:48:20 +00:00
|
|
|
bool eventFilter( QObject*, QEvent* ) override;
|
|
|
|
|
|
|
|
Q_SIGNALS:
|
|
|
|
void durationChanged( int );
|
|
|
|
|
2018-08-03 06:15:28 +00:00
|
|
|
protected:
|
2018-07-31 15:32:25 +00:00
|
|
|
void windowChangeEvent( QskWindowChangeEvent* ) override;
|
2023-12-02 11:48:20 +00:00
|
|
|
void timerEvent( QTimerEvent* ) override;
|
|
|
|
|
2018-02-01 07:07:54 +00:00
|
|
|
virtual QRectF focusRect() const;
|
2022-03-08 10:16:14 +00:00
|
|
|
void updateFocusFrame();
|
2017-07-21 16:21:34 +00:00
|
|
|
|
2018-08-03 06:15:28 +00:00
|
|
|
private:
|
2017-07-21 16:21:34 +00:00
|
|
|
void onFocusItemGeometryChanged();
|
2018-04-19 07:39:46 +00:00
|
|
|
void onWindowSizeChanged( int );
|
2017-07-21 16:21:34 +00:00
|
|
|
|
2018-02-01 07:07:54 +00:00
|
|
|
void onFocusItemChanged();
|
|
|
|
void onFocusItemDestroyed();
|
|
|
|
|
2023-12-02 11:48:20 +00:00
|
|
|
void resetTimer();
|
|
|
|
void maybeEnable( bool );
|
|
|
|
|
2018-02-01 07:07:54 +00:00
|
|
|
void connectWindow( const QQuickWindow*, bool on );
|
|
|
|
QVector< QMetaObject::Connection > connectItem( const QQuickItem* );
|
2017-07-21 16:21:34 +00:00
|
|
|
|
2018-02-01 07:07:54 +00:00
|
|
|
class PrivateData;
|
|
|
|
std::unique_ptr< PrivateData > m_data;
|
2017-07-21 16:21:34 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|