56 lines
1.7 KiB
C
56 lines
1.7 KiB
C
|
#ifndef FRAMELESS_H
|
||
|
#define FRAMELESS_H
|
||
|
|
||
|
#include <QAbstractNativeEventFilter>
|
||
|
#include <QQuickItem>
|
||
|
|
||
|
class Frameless : public QQuickItem, QAbstractNativeEventFilter {
|
||
|
Q_OBJECT
|
||
|
QML_ELEMENT
|
||
|
Q_PROPERTY(QQuickItem *appBar READ appBar WRITE setAppBar NOTIFY appBarChanged)
|
||
|
Q_PROPERTY(QQuickItem *maximizeButton READ maximizeButton WRITE setMaximizeButton NOTIFY maximizeButtonChanged)
|
||
|
Q_PROPERTY(bool fixSize READ fixSize WRITE setFixSize NOTIFY fixSizeChanged)
|
||
|
Q_PROPERTY(bool topmost READ topmost WRITE setTopmost NOTIFY topmostChanged)
|
||
|
Q_PROPERTY(bool disabled READ disabled WRITE setDisabled NOTIFY disabledChanged)
|
||
|
|
||
|
public:
|
||
|
Frameless(QQuickItem *parent = nullptr);
|
||
|
QQuickItem *appBar() const;
|
||
|
void setAppBar(QQuickItem *appBar);
|
||
|
|
||
|
QQuickItem *maximizeButton() const;
|
||
|
void setMaximizeButton(QQuickItem *button);
|
||
|
|
||
|
bool fixSize() const;
|
||
|
void setFixSize(bool fix);
|
||
|
|
||
|
bool topmost() const;
|
||
|
void setTopmost(bool topmost);
|
||
|
|
||
|
bool disabled() const;
|
||
|
void setDisabled(bool disabled);
|
||
|
|
||
|
Q_INVOKABLE void setHitTestVisible(QQuickItem *item);
|
||
|
Q_INVOKABLE void onDestruction();
|
||
|
void componentComplete() final;
|
||
|
|
||
|
bool nativeEventFilter(const QByteArray &eventType, void *message, qintptr *result) final;
|
||
|
|
||
|
signals:
|
||
|
void appBarChanged();
|
||
|
void maximizeButtonChanged();
|
||
|
void fixSizeChanged();
|
||
|
void topmostChanged();
|
||
|
void disabledChanged();
|
||
|
|
||
|
private:
|
||
|
QQuickItem *m_appBar = nullptr;
|
||
|
QQuickItem *m_maximizeButton = nullptr;
|
||
|
bool m_fixSize = false;
|
||
|
bool m_topmost = false;
|
||
|
bool m_disabled = false;
|
||
|
QList<QPointer<QQuickItem>> m_hitTestList;
|
||
|
};
|
||
|
|
||
|
#endif // FRAMELESS_H
|