mirror of
https://github.com/zhuzichu520/FluentUI.git
synced 2025-07-03 16:45:24 +08:00
update
This commit is contained in:
@ -1,5 +1,4 @@
|
||||
#ifndef FLUFRAMELESS_H
|
||||
#define FLUFRAMELESS_H
|
||||
#pragma once
|
||||
|
||||
#include <QObject>
|
||||
#include <QQuickItem>
|
||||
@ -15,47 +14,63 @@ using QT_ENTER_EVENT_TYPE = QEvent;
|
||||
#endif
|
||||
|
||||
|
||||
class FluFrameless : public QQuickItem,QAbstractNativeEventFilter
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY_AUTO(QQuickItem*,appbar)
|
||||
Q_PROPERTY_AUTO(bool,topmost)
|
||||
Q_PROPERTY_AUTO(QQuickItem*,maximizeButton)
|
||||
Q_PROPERTY_AUTO(QQuickItem*,minimizedButton)
|
||||
Q_PROPERTY_AUTO(QQuickItem*,closeButton)
|
||||
Q_PROPERTY_AUTO(bool,disabled)
|
||||
Q_PROPERTY_AUTO(bool,fixSize)
|
||||
class FluFrameless : public QQuickItem, QAbstractNativeEventFilter {
|
||||
Q_OBJECT
|
||||
Q_PROPERTY_AUTO_P(QQuickItem*, appbar)
|
||||
Q_PROPERTY_AUTO_P(QQuickItem*, maximizeButton)
|
||||
Q_PROPERTY_AUTO_P(QQuickItem*, minimizedButton)
|
||||
Q_PROPERTY_AUTO_P(QQuickItem*, closeButton)
|
||||
Q_PROPERTY_AUTO(bool, topmost)
|
||||
Q_PROPERTY_AUTO(bool, disabled)
|
||||
Q_PROPERTY_AUTO(bool, fixSize)
|
||||
QML_NAMED_ELEMENT(FluFrameless)
|
||||
public:
|
||||
explicit FluFrameless(QQuickItem* parent = nullptr);
|
||||
~FluFrameless();
|
||||
explicit FluFrameless(QQuickItem *parent = nullptr);
|
||||
|
||||
~FluFrameless() override;
|
||||
|
||||
void componentComplete() override;
|
||||
bool nativeEventFilter(const QByteArray &eventType, void *message, QT_NATIVE_EVENT_RESULT_TYPE *result) override;
|
||||
Q_INVOKABLE void showFullScreen();
|
||||
|
||||
[[maybe_unused]] bool nativeEventFilter(const QByteArray &eventType, void *message, QT_NATIVE_EVENT_RESULT_TYPE *result) override;
|
||||
|
||||
Q_INVOKABLE [[maybe_unused]] void showFullScreen();
|
||||
|
||||
Q_INVOKABLE void showMaximized();
|
||||
Q_INVOKABLE void showMinimized();
|
||||
|
||||
Q_INVOKABLE [[maybe_unused]] void showMinimized();
|
||||
|
||||
Q_INVOKABLE void showNormal();
|
||||
Q_INVOKABLE void setHitTestVisible(QQuickItem*);
|
||||
Q_INVOKABLE void onDestruction();
|
||||
|
||||
Q_INVOKABLE void setHitTestVisible(QQuickItem *);
|
||||
|
||||
Q_INVOKABLE [[maybe_unused]] void onDestruction();
|
||||
|
||||
protected:
|
||||
bool eventFilter(QObject *obj, QEvent *event) override;
|
||||
|
||||
private:
|
||||
bool _isFullScreen();
|
||||
|
||||
bool _isMaximized();
|
||||
|
||||
void _updateCursor(int edges);
|
||||
|
||||
void _setWindowTopmost(bool topmost);
|
||||
|
||||
void _showSystemMenu(QPoint point);
|
||||
bool _containsCursorToItem(QQuickItem* item);
|
||||
|
||||
bool _hitAppBar();
|
||||
|
||||
bool _hitMaximizeButton();
|
||||
|
||||
void _setMaximizePressed(bool val);
|
||||
|
||||
void _setMaximizeHovered(bool val);
|
||||
|
||||
private:
|
||||
qint64 _current;
|
||||
quint64 _current = 0;
|
||||
int _edges = 0;
|
||||
int _margins = 8;
|
||||
qint64 _clickTimer = 0;
|
||||
quint64 _clickTimer = 0;
|
||||
QList<QPointer<QQuickItem>> _hitTestList;
|
||||
};
|
||||
|
||||
#endif // FLUFRAMELESS_H
|
||||
};
|
Reference in New Issue
Block a user