1/****************************************************************************
2**
3** Copyright (C) 2016 The Qt Company Ltd.
4** Contact: https://www.qt.io/licensing/
5**
6** This file is part of the Qt Designer of the Qt Toolkit.
7**
8** $QT_BEGIN_LICENSE:GPL-EXCEPT$
9** Commercial License Usage
10** Licensees holding valid commercial Qt licenses may use this file in
11** accordance with the commercial license agreement provided with the
12** Software or, alternatively, in accordance with the terms contained in
13** a written agreement between you and The Qt Company. For licensing terms
14** and conditions see https://www.qt.io/terms-conditions. For further
15** information use the contact form at https://www.qt.io/contact-us.
16**
17** GNU General Public License Usage
18** Alternatively, this file may be used under the terms of the GNU
19** General Public License version 3 as published by the Free Software
20** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
21** included in the packaging of this file. Please review the following
22** information to ensure the GNU General Public License requirements will
23** be met: https://www.gnu.org/licenses/gpl-3.0.html.
24**
25** $QT_END_LICENSE$
26**
27****************************************************************************/
28
29#include "abstractdialoggui_p.h"
30
31QT_BEGIN_NAMESPACE
32
33/*!
34 \class QDesignerDialogGuiInterface
35 \since 4.4
36 \internal
37
38 \brief The QDesignerDialogGuiInterface allows integrations of \QD to replace the
39 message boxes displayed by \QD by custom dialogs.
40
41 \inmodule QtDesigner
42
43 QDesignerDialogGuiInterface provides virtual functions that can be overwritten
44 to display message boxes and file dialogs.
45 \sa QMessageBox, QFileDialog
46*/
47
48/*!
49 \enum QDesignerDialogGuiInterface::Message
50
51 This enum specifies the context from within the message box is called.
52
53 \value FormLoadFailureMessage Loading of a form failed
54 \value UiVersionMismatchMessage Attempt to load a file created with an old version of Designer
55 \value ResourceLoadFailureMessage Resources specified in a file could not be found
56 \value TopLevelSpacerMessage Spacer items detected on a container without layout
57 \value PropertyEditorMessage Messages of the propert yeditor
58 \value SignalSlotEditorMessage Messages of the signal / slot editor
59 \value FormEditorMessage Messages of the form editor
60 \value PreviewFailureMessage A preview could not be created
61 \value PromotionErrorMessage Messages related to promotion of a widget
62 \value ResourceEditorMessage Messages of the resource editor
63 \value ScriptDialogMessage Messages of the script dialog
64 \value SignalSlotDialogMessage Messages of the signal slot dialog
65 \value OtherMessage Unspecified context
66*/
67
68/*!
69 Constructs a QDesignerDialogGuiInterface object.
70*/
71
72QDesignerDialogGuiInterface::QDesignerDialogGuiInterface() = default;
73
74/*!
75 Destroys the QDesignerDialogGuiInterface object.
76*/
77QDesignerDialogGuiInterface::~QDesignerDialogGuiInterface() = default;
78
79/*!
80 \fn QMessageBox::StandardButton QDesignerDialogGuiInterface::message(QWidget *parent, Message context, QMessageBox::Icon icon, const QString &title, const QString &text, QMessageBox::StandardButtons buttons, QMessageBox::StandardButton defaultButton)
81
82 Opens a message box as child of \a parent within the context \a context, using \a icon, \a title, \a text, \a buttons and \a defaultButton
83 and returns the button chosen by the user.
84*/
85
86/*!
87 \fn QString QDesignerDialogGuiInterface::getExistingDirectory(QWidget *parent, const QString &caption, const QString &dir, QFileDialog::Options options)
88
89 Opens a file dialog as child of \a parent using the parameters \a caption, \a dir and \a options that prompts the
90 user for an existing directory. Returns a directory selected by the user.
91*/
92
93/*!
94 \fn QString QDesignerDialogGuiInterface::getOpenFileName(QWidget *parent, const QString &caption, const QString &dir, const QString &filter, QString *selectedFilter, QFileDialog::Options)
95
96 Opens a file dialog as child of \a parent using the parameters \a caption, \a dir, \a filter, \a selectedFilter and \a options
97 that prompts the user for an existing file. Returns a file selected by the user.
98*/
99
100/*!
101 \fn QStringList QDesignerDialogGuiInterface::getOpenFileNames(QWidget *parent, const QString &caption, const QString &dir, const QString &filter, QString *selectedFilter, QFileDialog::Options)
102
103 Opens a file dialog as child of \a parent using the parameters \a caption, \a dir, \a filter, \a selectedFilter and \a options
104 that prompts the user for a set of existing files. Returns one or more existing files selected by the user.
105*/
106
107/*!
108 Opens a file dialog with image browsing capabilities as child of \a parent using the parameters \a caption, \a dir, \a filter, \a selectedFilter and \a options
109 that prompts the user for an existing file. Returns a file selected by the user.
110
111 The default implementation simply calls getOpenFileName(). On platforms that do not support an image preview in the QFileDialog,
112 the function can be reimplemented to provide an image browser.
113
114 \since 4.5
115*/
116
117QString QDesignerDialogGuiInterface::getOpenImageFileName(QWidget *parent, const QString &caption, const QString &dir, const QString &filter, QString *selectedFilter, QFileDialog::Options options)
118{
119 return getOpenFileName(parent, caption, dir, filter, selectedFilter, options);
120}
121
122/*!
123 Opens a file dialog with image browsing capabilities as child of \a parent using the parameters \a caption, \a dir, \a filter, \a selectedFilter and \a options
124 that prompts the user for a set of existing files. Returns one or more existing files selected by the user.
125
126 The default implementation simply calls getOpenFileNames(). On platforms that do not support an image preview in the QFileDialog,
127 the function can be reimplemented to provide an image browser.
128
129 \since 4.5
130*/
131
132QStringList QDesignerDialogGuiInterface::getOpenImageFileNames(QWidget *parent, const QString &caption, const QString &dir, const QString &filter, QString *selectedFilter, QFileDialog::Options options)
133{
134 return getOpenFileNames(parent, caption, dir, filter, selectedFilter, options);
135}
136
137/*!
138 \fn QString QDesignerDialogGuiInterface::getSaveFileName(QWidget *parent, const QString &caption, const QString &dir, const QString &filter, QString *selectedFilter, QFileDialog::Options)
139
140 Opens a file dialog as child of \a parent using the parameters \a caption, \a dir, \a filter, \a selectedFilter and \a options
141 that prompts the user for a file. Returns a file selected by the user. The file does not have to exist.
142*/
143
144QT_END_NAMESPACE
145

source code of qttools/src/designer/src/lib/sdk/abstractdialoggui.cpp