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-12-27 23:00:41 +08:00

37 lines
1.2 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平台支持拖动和改变大小支持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;
};