1
0
mirror of https://github.com/jaredtao/TaoQuick.git synced 2025-02-06 21:48:24 +08:00
TaoQuick/3rdparty/TaoCommon/Frameless/TaoFrameLessView.h
2020-10-29 15:26:24 +08:00

36 lines
1.1 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#pragma once
#include "TaoCommonGlobal.h"
#include <QQuickView>
//无边框窗口支持拖动和改变大小支持Windows平台Aero效果
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 { return m_isMax; }
QQuickItem *titleItem() const { return m_titleItem; }
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 WIN32
# 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
#endif
private:
bool m_isMax;
QQuickItem *m_titleItem = nullptr;
};