1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
3
4#ifndef NEWFORM_H
5#define NEWFORM_H
6
7#include <QtWidgets/qdialog.h>
8
9QT_BEGIN_NAMESPACE
10
11namespace qdesigner_internal {
12 class DeviceProfile;
13}
14
15class QDesignerFormEditorInterface;
16class QDesignerNewFormWidgetInterface;
17class QDesignerWorkbench;
18
19class QCheckBox;
20class QAbstractButton;
21class QPushButton;
22class QDialogButtonBox;
23class QImage;
24class QIODevice;
25
26class NewForm: public QDialog
27{
28 Q_OBJECT
29 Q_DISABLE_COPY_MOVE(NewForm)
30
31public:
32 NewForm(QDesignerWorkbench *workbench,
33 QWidget *parentWidget,
34 // Use that file name instead of a temporary one
35 const QString &fileName = QString());
36
37 ~NewForm() override;
38
39 // Convenience for implementing file dialogs with preview
40 static QImage grabForm(QDesignerFormEditorInterface *core,
41 QIODevice &file,
42 const QString &workingDir,
43 const qdesigner_internal::DeviceProfile &dp);
44
45private slots:
46 void slotButtonBoxClicked(QAbstractButton *btn);
47 void recentFileChosen();
48 void slotCurrentTemplateChanged(bool templateSelected);
49 void slotTemplateActivated();
50
51private:
52 QDialogButtonBox *createButtonBox();
53 bool openTemplate(QString *ptrToErrorMessage);
54
55 QString m_fileName;
56 QDesignerNewFormWidgetInterface *m_newFormWidget;
57 QDesignerWorkbench *m_workbench;
58 QCheckBox *m_chkShowOnStartup;
59 QPushButton *m_createButton;
60 QPushButton *m_recentButton;
61 QDialogButtonBox *m_buttonBox;
62};
63
64QT_END_NAMESPACE
65
66#endif // NEWFORM_H
67

source code of qttools/src/designer/src/designer/newform.h