DtkWidget
DTK Widget module
载入中...
搜索中...
未找到
dabstractdialog.h
浏览该文件的文档.
1// SPDX-FileCopyrightText: 2015 - 2022 UnionTech Software Technology Co., Ltd.
2//
3// SPDX-License-Identifier: LGPL-3.0-or-later
4
5#ifndef DABSTRACTDIALOG_H
6#define DABSTRACTDIALOG_H
7
8#include <QDialog>
9#include <QPoint>
10
11#include <DObject>
12
13#include <dtkwidget_global.h>
14
15class QMouseEvent;
16class QPushButton;
17class QResizeEvent;
18
19DWIDGET_BEGIN_NAMESPACE
20
21class DAbstractDialogPrivate;
22class LIBDTKWIDGETSHARED_EXPORT DAbstractDialog : public QDialog, public DTK_CORE_NAMESPACE::DObject
23{
24 Q_OBJECT
25
26 Q_PROPERTY(DisplayPosition displayPosition READ displayPosition WRITE setDisplayPosition)
27
28public:
31 TopRight
32 };
33 enum DisplayPostion { // This is wrong, but keep it for compatibility
34 DisplayCenter = Center,
35 DisplayTopRight = TopRight
36 };
37
38 Q_ENUMS(DisplayPosition)
39 Q_ENUMS(DisplayPostion)
40
41 DAbstractDialog(QWidget *parent = nullptr);
42 DAbstractDialog(bool blurIfPossible, QWidget *parent = nullptr);
43
44 DisplayPosition displayPosition() const;
45
46 void move(const QPoint &pos);
47 inline void move(int x, int y)
48 { move(QPoint(x, y));}
49
50 void setGeometry(const QRect &rect);
51 inline void setGeometry(int x, int y, int width, int height)
52 { setGeometry(QRect(x, y, width, height));}
53
54public Q_SLOTS:
55 void moveToCenter();
56 void moveToTopRight();
57 void moveToCenterByRect(const QRect &rect);
58 void moveToTopRightByRect(const QRect &rect);
59
60 void setDisplayPosition(DisplayPosition displayPosition);
61
62Q_SIGNALS:
68 void sizeChanged(QSize size);
69
70protected:
71 void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
72 void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
73 void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
74 void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE;
75 void showEvent(QShowEvent *event) override;
76
77protected:
78 DAbstractDialog(DAbstractDialogPrivate &dd, QWidget *parent = nullptr);
79
80private:
81 D_DECLARE_PRIVATE(DAbstractDialog)
82};
83
84DWIDGET_END_NAMESPACE
85
86#endif // DABSTRACTDIALOG_H
Definition dabstractdialogprivate_p.h:21
可以使用 DAbstractDialog 类创建符合 DDE 风格的对话框窗口.
Definition dabstractdialog.h:23
DisplayPosition
对话框显示位置
Definition dabstractdialog.h:29
@ Center
在屏幕中央显示此对话框
Definition dabstractdialog.h:30
void move(int x, int y)
将窗口移动到指定坐标
Definition dabstractdialog.h:47
void sizeChanged(QSize size)
窗口大小发生改变