mirror of
https://github.com/jaredtao/TaoQuick.git
synced 2025-02-06 21:48:24 +08:00
37 lines
1.2 KiB
C++
37 lines
1.2 KiB
C++
#pragma once
|
||
#include "TaoCommonGlobal.h"
|
||
#include <QQuickView>
|
||
//无边框窗口,主要用来实现自定义标题栏。
|
||
//Windows平台支持拖动和改变大小,支持Windows平台Aero效果
|
||
//非Windows平台,去掉边框,不做其它处理。由Qml模拟编译resize和拖动。
|
||
class TaoFrameLessViewPrivate;
|
||
class TAO_API TaoFrameLessView : public QQuickView
|
||
{
|
||
Q_OBJECT
|
||
using Super = QQuickView;
|
||
Q_PROPERTY(bool isMax READ isMax NOTIFY isMaxChanged)
|
||
public:
|
||
explicit TaoFrameLessView(QWindow *parent = nullptr);
|
||
~TaoFrameLessView();
|
||
void moveToScreenCenter();
|
||
bool isMax() const;
|
||
QQuickItem *titleItem() const;
|
||
|
||
static QRect calcCenterGeo(const QRect &screenGeo, const QSize &normalSize);
|
||
public slots:
|
||
void setIsMax(bool isMax);
|
||
void setTitleItem(QQuickItem *item);
|
||
signals:
|
||
void isMaxChanged(bool isMax);
|
||
|
||
protected:
|
||
# if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||
bool nativeEvent(const QByteArray &eventType, void *message, qintptr *result) override;
|
||
# else
|
||
bool nativeEvent(const QByteArray &eventType, void *message, long *result) override;
|
||
# endif
|
||
|
||
private:
|
||
TaoFrameLessViewPrivate *d;
|
||
};
|