Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/gui/kernel/qplatformdialoghelper.cpp |
Source code | Switch to Preprocessed file |
Line | Source | Count | ||||||
---|---|---|---|---|---|---|---|---|
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 QtGui module of the Qt Toolkit. | - | ||||||
7 | ** | - | ||||||
8 | ** $QT_BEGIN_LICENSE:LGPL$ | - | ||||||
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 Lesser General Public License Usage | - | ||||||
18 | ** Alternatively, this file may be used under the terms of the GNU Lesser | - | ||||||
19 | ** General Public License version 3 as published by the Free Software | - | ||||||
20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the | - | ||||||
21 | ** packaging of this file. Please review the following information to | - | ||||||
22 | ** ensure the GNU Lesser General Public License version 3 requirements | - | ||||||
23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. | - | ||||||
24 | ** | - | ||||||
25 | ** GNU General Public License Usage | - | ||||||
26 | ** Alternatively, this file may be used under the terms of the GNU | - | ||||||
27 | ** General Public License version 2.0 or (at your option) the GNU General | - | ||||||
28 | ** Public license version 3 or any later version approved by the KDE Free | - | ||||||
29 | ** Qt Foundation. The licenses are as published by the Free Software | - | ||||||
30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 | - | ||||||
31 | ** included in the packaging of this file. Please review the following | - | ||||||
32 | ** information to ensure the GNU General Public License requirements will | - | ||||||
33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and | - | ||||||
34 | ** https://www.gnu.org/licenses/gpl-3.0.html. | - | ||||||
35 | ** | - | ||||||
36 | ** $QT_END_LICENSE$ | - | ||||||
37 | ** | - | ||||||
38 | ****************************************************************************/ | - | ||||||
39 | - | |||||||
40 | #include "qplatformdialoghelper.h" | - | ||||||
41 | - | |||||||
42 | #include <QtCore/QCoreApplication> | - | ||||||
43 | #include <QtCore/QVariant> | - | ||||||
44 | #include <QtCore/QSharedData> | - | ||||||
45 | #include <QtCore/QSettings> | - | ||||||
46 | #include <QtCore/QUrl> | - | ||||||
47 | #include <QtGui/QColor> | - | ||||||
48 | - | |||||||
49 | #include <algorithm> | - | ||||||
50 | - | |||||||
51 | QT_BEGIN_NAMESPACE | - | ||||||
52 | - | |||||||
53 | /*! | - | ||||||
54 | \class QPlatformDialogHelper | - | ||||||
55 | \since 5.0 | - | ||||||
56 | \internal | - | ||||||
57 | \ingroup qpa | - | ||||||
58 | - | |||||||
59 | \brief The QPlatformDialogHelper class allows for platform-specific customization of dialogs. | - | ||||||
60 | - | |||||||
61 | */ | - | ||||||
62 | - | |||||||
63 | static const int buttonRoleLayouts[2][5][14] = | - | ||||||
64 | { | - | ||||||
65 | // Qt::Horizontal | - | ||||||
66 | { | - | ||||||
67 | // WinLayout | - | ||||||
68 | { QPlatformDialogHelper::ResetRole, QPlatformDialogHelper::Stretch, QPlatformDialogHelper::YesRole, QPlatformDialogHelper::AcceptRole, | - | ||||||
69 | QPlatformDialogHelper::AlternateRole, QPlatformDialogHelper::DestructiveRole, QPlatformDialogHelper::NoRole, | - | ||||||
70 | QPlatformDialogHelper::ActionRole, QPlatformDialogHelper::RejectRole, QPlatformDialogHelper::ApplyRole, | - | ||||||
71 | QPlatformDialogHelper::HelpRole, QPlatformDialogHelper::EOL, QPlatformDialogHelper::EOL, QPlatformDialogHelper::EOL }, | - | ||||||
72 | - | |||||||
73 | // MacLayout | - | ||||||
74 | { QPlatformDialogHelper::HelpRole, QPlatformDialogHelper::ResetRole, QPlatformDialogHelper::ApplyRole, QPlatformDialogHelper::ActionRole, | - | ||||||
75 | QPlatformDialogHelper::Stretch, QPlatformDialogHelper::DestructiveRole | QPlatformDialogHelper::Reverse, | - | ||||||
76 | QPlatformDialogHelper::AlternateRole | QPlatformDialogHelper::Reverse, QPlatformDialogHelper::RejectRole | QPlatformDialogHelper::Reverse, | - | ||||||
77 | QPlatformDialogHelper::AcceptRole | QPlatformDialogHelper::Reverse, QPlatformDialogHelper::NoRole | QPlatformDialogHelper::Reverse, | - | ||||||
78 | QPlatformDialogHelper::YesRole | QPlatformDialogHelper::Reverse, QPlatformDialogHelper::EOL, QPlatformDialogHelper::EOL }, | - | ||||||
79 | - | |||||||
80 | // KdeLayout | - | ||||||
81 | { QPlatformDialogHelper::HelpRole, QPlatformDialogHelper::ResetRole, QPlatformDialogHelper::Stretch, QPlatformDialogHelper::YesRole, | - | ||||||
82 | QPlatformDialogHelper::NoRole, QPlatformDialogHelper::ActionRole, QPlatformDialogHelper::AcceptRole, QPlatformDialogHelper::AlternateRole, | - | ||||||
83 | QPlatformDialogHelper::ApplyRole, QPlatformDialogHelper::DestructiveRole, QPlatformDialogHelper::RejectRole, QPlatformDialogHelper::EOL }, | - | ||||||
84 | - | |||||||
85 | // GnomeLayout | - | ||||||
86 | { QPlatformDialogHelper::HelpRole, QPlatformDialogHelper::ResetRole, QPlatformDialogHelper::Stretch, QPlatformDialogHelper::ActionRole, | - | ||||||
87 | QPlatformDialogHelper::ApplyRole | QPlatformDialogHelper::Reverse, QPlatformDialogHelper::DestructiveRole | QPlatformDialogHelper::Reverse, | - | ||||||
88 | QPlatformDialogHelper::AlternateRole | QPlatformDialogHelper::Reverse, QPlatformDialogHelper::RejectRole | QPlatformDialogHelper::Reverse, | - | ||||||
89 | QPlatformDialogHelper::AcceptRole | QPlatformDialogHelper::Reverse, QPlatformDialogHelper::NoRole | QPlatformDialogHelper::Reverse, | - | ||||||
90 | QPlatformDialogHelper::YesRole | QPlatformDialogHelper::Reverse, QPlatformDialogHelper::EOL }, | - | ||||||
91 | - | |||||||
92 | // MacModelessLayout | - | ||||||
93 | { QPlatformDialogHelper::ResetRole, QPlatformDialogHelper::ApplyRole, QPlatformDialogHelper::ActionRole, QPlatformDialogHelper::Stretch, | - | ||||||
94 | QPlatformDialogHelper::HelpRole, QPlatformDialogHelper::EOL, QPlatformDialogHelper::EOL, QPlatformDialogHelper::EOL, QPlatformDialogHelper::EOL, | - | ||||||
95 | QPlatformDialogHelper::EOL, QPlatformDialogHelper::EOL, QPlatformDialogHelper::EOL, QPlatformDialogHelper::EOL, QPlatformDialogHelper::EOL } | - | ||||||
96 | }, | - | ||||||
97 | - | |||||||
98 | // Qt::Vertical | - | ||||||
99 | { | - | ||||||
100 | // WinLayout | - | ||||||
101 | { QPlatformDialogHelper::ActionRole, QPlatformDialogHelper::YesRole, QPlatformDialogHelper::AcceptRole, QPlatformDialogHelper::AlternateRole, | - | ||||||
102 | QPlatformDialogHelper::DestructiveRole, QPlatformDialogHelper::NoRole, QPlatformDialogHelper::RejectRole, QPlatformDialogHelper::ApplyRole, QPlatformDialogHelper::ResetRole, | - | ||||||
103 | QPlatformDialogHelper::HelpRole, QPlatformDialogHelper::Stretch, QPlatformDialogHelper::EOL, QPlatformDialogHelper::EOL, QPlatformDialogHelper::EOL }, | - | ||||||
104 | - | |||||||
105 | // MacLayout | - | ||||||
106 | { QPlatformDialogHelper::YesRole, QPlatformDialogHelper::NoRole, QPlatformDialogHelper::AcceptRole, QPlatformDialogHelper::RejectRole, | - | ||||||
107 | QPlatformDialogHelper::AlternateRole, QPlatformDialogHelper::DestructiveRole, QPlatformDialogHelper::Stretch, QPlatformDialogHelper::ActionRole, QPlatformDialogHelper::ApplyRole, | - | ||||||
108 | QPlatformDialogHelper::ResetRole, QPlatformDialogHelper::HelpRole, QPlatformDialogHelper::EOL, QPlatformDialogHelper::EOL }, | - | ||||||
109 | - | |||||||
110 | // KdeLayout | - | ||||||
111 | { QPlatformDialogHelper::AcceptRole, QPlatformDialogHelper::AlternateRole, QPlatformDialogHelper::ApplyRole, QPlatformDialogHelper::ActionRole, | - | ||||||
112 | QPlatformDialogHelper::YesRole, QPlatformDialogHelper::NoRole, QPlatformDialogHelper::Stretch, QPlatformDialogHelper::ResetRole, | - | ||||||
113 | QPlatformDialogHelper::DestructiveRole, QPlatformDialogHelper::RejectRole, QPlatformDialogHelper::HelpRole, QPlatformDialogHelper::EOL }, | - | ||||||
114 | - | |||||||
115 | // GnomeLayout | - | ||||||
116 | { QPlatformDialogHelper::YesRole, QPlatformDialogHelper::NoRole, QPlatformDialogHelper::AcceptRole, QPlatformDialogHelper::RejectRole, | - | ||||||
117 | QPlatformDialogHelper::AlternateRole, QPlatformDialogHelper::DestructiveRole, QPlatformDialogHelper::ApplyRole, QPlatformDialogHelper::ActionRole, QPlatformDialogHelper::Stretch, | - | ||||||
118 | QPlatformDialogHelper::ResetRole, QPlatformDialogHelper::HelpRole, QPlatformDialogHelper::EOL, QPlatformDialogHelper::EOL, QPlatformDialogHelper::EOL }, | - | ||||||
119 | - | |||||||
120 | // MacModelessLayout | - | ||||||
121 | { QPlatformDialogHelper::ActionRole, QPlatformDialogHelper::ApplyRole, QPlatformDialogHelper::ResetRole, QPlatformDialogHelper::Stretch, | - | ||||||
122 | QPlatformDialogHelper::HelpRole, QPlatformDialogHelper::EOL, QPlatformDialogHelper::EOL, QPlatformDialogHelper::EOL, QPlatformDialogHelper::EOL, | - | ||||||
123 | QPlatformDialogHelper::EOL, QPlatformDialogHelper::EOL, QPlatformDialogHelper::EOL, QPlatformDialogHelper::EOL, QPlatformDialogHelper::EOL } | - | ||||||
124 | } | - | ||||||
125 | }; | - | ||||||
126 | - | |||||||
127 | QPlatformDialogHelper::QPlatformDialogHelper() | - | ||||||
128 | { | - | ||||||
129 | qRegisterMetaType<StandardButton>(); | - | ||||||
130 | qRegisterMetaType<ButtonRole>(); | - | ||||||
131 | } | - | ||||||
132 | - | |||||||
133 | QPlatformDialogHelper::~QPlatformDialogHelper() | - | ||||||
134 | { | - | ||||||
135 | } | - | ||||||
136 | - | |||||||
137 | QVariant QPlatformDialogHelper::styleHint(StyleHint hint) const | - | ||||||
138 | { | - | ||||||
139 | return QPlatformDialogHelper::defaultStyleHint(hint); | - | ||||||
140 | } | - | ||||||
141 | - | |||||||
142 | QVariant QPlatformDialogHelper::defaultStyleHint(QPlatformDialogHelper::StyleHint hint) | - | ||||||
143 | { | - | ||||||
144 | Q_UNUSED(hint); | - | ||||||
145 | return QVariant(); | - | ||||||
146 | } | - | ||||||
147 | - | |||||||
148 | // Font dialog | - | ||||||
149 | - | |||||||
150 | class QFontDialogOptionsPrivate : public QSharedData | - | ||||||
151 | { | - | ||||||
152 | public: | - | ||||||
153 | QFontDialogOptionsPrivate() : options(0) {} | - | ||||||
154 | - | |||||||
155 | QFontDialogOptions::FontDialogOptions options; | - | ||||||
156 | QString windowTitle; | - | ||||||
157 | }; | - | ||||||
158 | - | |||||||
159 | QFontDialogOptions::QFontDialogOptions() : d(new QFontDialogOptionsPrivate) | - | ||||||
160 | { | - | ||||||
161 | } | - | ||||||
162 | - | |||||||
163 | QFontDialogOptions::QFontDialogOptions(const QFontDialogOptions &rhs) : d(rhs.d) | - | ||||||
164 | { | - | ||||||
165 | } | - | ||||||
166 | - | |||||||
167 | QFontDialogOptions &QFontDialogOptions::operator=(const QFontDialogOptions &rhs) | - | ||||||
168 | { | - | ||||||
169 | if (this != &rhs) | - | ||||||
170 | d = rhs.d; | - | ||||||
171 | return *this; | - | ||||||
172 | } | - | ||||||
173 | - | |||||||
174 | QFontDialogOptions::~QFontDialogOptions() | - | ||||||
175 | { | - | ||||||
176 | } | - | ||||||
177 | - | |||||||
178 | QString QFontDialogOptions::windowTitle() const | - | ||||||
179 | { | - | ||||||
180 | return d->windowTitle; | - | ||||||
181 | } | - | ||||||
182 | - | |||||||
183 | void QFontDialogOptions::setWindowTitle(const QString &title) | - | ||||||
184 | { | - | ||||||
185 | d->windowTitle = title; | - | ||||||
186 | } | - | ||||||
187 | - | |||||||
188 | void QFontDialogOptions::setOption(QFontDialogOptions::FontDialogOption option, bool on) | - | ||||||
189 | { | - | ||||||
190 | if (!(d->options & option) != !on) | - | ||||||
191 | setOptions(d->options ^ option); | - | ||||||
192 | } | - | ||||||
193 | - | |||||||
194 | bool QFontDialogOptions::testOption(QFontDialogOptions::FontDialogOption option) const | - | ||||||
195 | { | - | ||||||
196 | return d->options & option; | - | ||||||
197 | } | - | ||||||
198 | - | |||||||
199 | void QFontDialogOptions::setOptions(FontDialogOptions options) | - | ||||||
200 | { | - | ||||||
201 | if (options != d->options) | - | ||||||
202 | d->options = options; | - | ||||||
203 | } | - | ||||||
204 | - | |||||||
205 | QFontDialogOptions::FontDialogOptions QFontDialogOptions::options() const | - | ||||||
206 | { | - | ||||||
207 | return d->options; | - | ||||||
208 | } | - | ||||||
209 | - | |||||||
210 | /*! | - | ||||||
211 | \class QPlatformFontDialogHelper | - | ||||||
212 | \since 5.0 | - | ||||||
213 | \internal | - | ||||||
214 | \ingroup qpa | - | ||||||
215 | - | |||||||
216 | \brief The QPlatformFontDialogHelper class allows for platform-specific customization of font dialogs. | - | ||||||
217 | - | |||||||
218 | */ | - | ||||||
219 | const QSharedPointer<QFontDialogOptions> &QPlatformFontDialogHelper::options() const | - | ||||||
220 | { | - | ||||||
221 | return m_options; | - | ||||||
222 | } | - | ||||||
223 | - | |||||||
224 | void QPlatformFontDialogHelper::setOptions(const QSharedPointer<QFontDialogOptions> &options) | - | ||||||
225 | { | - | ||||||
226 | m_options = options; | - | ||||||
227 | } | - | ||||||
228 | - | |||||||
229 | // Color dialog | - | ||||||
230 | - | |||||||
231 | class QColorDialogStaticData | - | ||||||
232 | { | - | ||||||
233 | public: | - | ||||||
234 | enum { CustomColorCount = 16, StandardColorCount = 6 * 8 }; | - | ||||||
235 | - | |||||||
236 | QColorDialogStaticData(); | - | ||||||
237 | inline void readSettings(); | - | ||||||
238 | inline void writeSettings() const; | - | ||||||
239 | - | |||||||
240 | QRgb customRgb[CustomColorCount]; | - | ||||||
241 | QRgb standardRgb[StandardColorCount]; | - | ||||||
242 | bool customSet; | - | ||||||
243 | }; | - | ||||||
244 | - | |||||||
245 | QColorDialogStaticData::QColorDialogStaticData() : customSet(false) | - | ||||||
246 | { | - | ||||||
247 | int i = 0; | - | ||||||
248 | for (int g = 0; g < 4; ++g) | - | ||||||
249 | for (int r = 0; r < 4; ++r) | - | ||||||
250 | for (int b = 0; b < 3; ++b) | - | ||||||
251 | standardRgb[i++] = qRgb(r * 255 / 3, g * 255 / 3, b * 255 / 2); | - | ||||||
252 | std::fill(customRgb, customRgb + CustomColorCount, 0xffffffff); | - | ||||||
253 | readSettings(); | - | ||||||
254 | } | - | ||||||
255 | - | |||||||
256 | void QColorDialogStaticData::readSettings() | - | ||||||
257 | { | - | ||||||
258 | #ifndef QT_NO_SETTINGS | - | ||||||
259 | const QSettings settings(QSettings::UserScope, QStringLiteral("QtProject")); | - | ||||||
260 | for (int i = 0; i < int(CustomColorCount); ++i) {
| 0 | ||||||
261 | const QVariant v = settings.value(QStringLiteralQLatin1String("Qt/customColors/") + QString::number(i)); | - | ||||||
262 | if (v.isValid())
| 0 | ||||||
263 | customRgb[i] = v.toUInt(); never executed: customRgb[i] = v.toUInt(); | 0 | ||||||
264 | } never executed: end of block | 0 | ||||||
265 | #endif | - | ||||||
266 | } never executed: end of block | 0 | ||||||
267 | - | |||||||
268 | void QColorDialogStaticData::writeSettings() const | - | ||||||
269 | { | - | ||||||
270 | #ifndef QT_NO_SETTINGS | - | ||||||
271 | if (!customSet) {
| 0 | ||||||
272 | QSettings settings(QSettings::UserScope, QStringLiteral("QtProject")); | - | ||||||
273 | for (int i = 0; i < int(CustomColorCount); ++i)
| 0 | ||||||
274 | settings.setValue(QStringLiteralQLatin1String("Qt/customColors/") + QString::number(i), customRgb[i]); never executed: settings.setValue(QLatin1String("Qt/customColors/") + QString::number(i), customRgb[i]); | 0 | ||||||
275 | } never executed: end of block | 0 | ||||||
276 | #endif | - | ||||||
277 | } never executed: end of block | 0 | ||||||
278 | - | |||||||
279 | Q_GLOBAL_STATIC(QColorDialogStaticData, qColorDialogStaticData) | - | ||||||
280 | - | |||||||
281 | class QColorDialogOptionsPrivate : public QSharedData | - | ||||||
282 | { | - | ||||||
283 | public: | - | ||||||
284 | QColorDialogOptionsPrivate() : options(0) {} | - | ||||||
285 | // Write out settings around destruction of dialogs | - | ||||||
286 | ~QColorDialogOptionsPrivate() { qColorDialogStaticData()->writeSettings(); } | - | ||||||
287 | - | |||||||
288 | QColorDialogOptions::ColorDialogOptions options; | - | ||||||
289 | QString windowTitle; | - | ||||||
290 | }; | - | ||||||
291 | - | |||||||
292 | QColorDialogOptions::QColorDialogOptions() : d(new QColorDialogOptionsPrivate) | - | ||||||
293 | { | - | ||||||
294 | } | - | ||||||
295 | - | |||||||
296 | QColorDialogOptions::QColorDialogOptions(const QColorDialogOptions &rhs) : d(rhs.d) | - | ||||||
297 | { | - | ||||||
298 | } | - | ||||||
299 | - | |||||||
300 | QColorDialogOptions &QColorDialogOptions::operator=(const QColorDialogOptions &rhs) | - | ||||||
301 | { | - | ||||||
302 | if (this != &rhs) | - | ||||||
303 | d = rhs.d; | - | ||||||
304 | return *this; | - | ||||||
305 | } | - | ||||||
306 | - | |||||||
307 | QColorDialogOptions::~QColorDialogOptions() | - | ||||||
308 | { | - | ||||||
309 | } | - | ||||||
310 | - | |||||||
311 | QString QColorDialogOptions::windowTitle() const | - | ||||||
312 | { | - | ||||||
313 | return d->windowTitle; | - | ||||||
314 | } | - | ||||||
315 | - | |||||||
316 | void QColorDialogOptions::setWindowTitle(const QString &title) | - | ||||||
317 | { | - | ||||||
318 | d->windowTitle = title; | - | ||||||
319 | } | - | ||||||
320 | - | |||||||
321 | void QColorDialogOptions::setOption(QColorDialogOptions::ColorDialogOption option, bool on) | - | ||||||
322 | { | - | ||||||
323 | if (!(d->options & option) != !on) | - | ||||||
324 | setOptions(d->options ^ option); | - | ||||||
325 | } | - | ||||||
326 | - | |||||||
327 | bool QColorDialogOptions::testOption(QColorDialogOptions::ColorDialogOption option) const | - | ||||||
328 | { | - | ||||||
329 | return d->options & option; | - | ||||||
330 | } | - | ||||||
331 | - | |||||||
332 | void QColorDialogOptions::setOptions(ColorDialogOptions options) | - | ||||||
333 | { | - | ||||||
334 | if (options != d->options) | - | ||||||
335 | d->options = options; | - | ||||||
336 | } | - | ||||||
337 | - | |||||||
338 | QColorDialogOptions::ColorDialogOptions QColorDialogOptions::options() const | - | ||||||
339 | { | - | ||||||
340 | return d->options; | - | ||||||
341 | } | - | ||||||
342 | - | |||||||
343 | int QColorDialogOptions::customColorCount() | - | ||||||
344 | { | - | ||||||
345 | return QColorDialogStaticData::CustomColorCount; | - | ||||||
346 | } | - | ||||||
347 | - | |||||||
348 | QRgb QColorDialogOptions::customColor(int index) | - | ||||||
349 | { | - | ||||||
350 | if (uint(index) >= uint(QColorDialogStaticData::CustomColorCount)) | - | ||||||
351 | return qRgb(255, 255, 255); | - | ||||||
352 | return qColorDialogStaticData()->customRgb[index]; | - | ||||||
353 | } | - | ||||||
354 | - | |||||||
355 | QRgb *QColorDialogOptions::customColors() | - | ||||||
356 | { | - | ||||||
357 | return qColorDialogStaticData()->customRgb; | - | ||||||
358 | } | - | ||||||
359 | - | |||||||
360 | void QColorDialogOptions::setCustomColor(int index, QRgb color) | - | ||||||
361 | { | - | ||||||
362 | if (uint(index) >= uint(QColorDialogStaticData::CustomColorCount)) | - | ||||||
363 | return; | - | ||||||
364 | qColorDialogStaticData()->customSet = true; | - | ||||||
365 | qColorDialogStaticData()->customRgb[index] = color; | - | ||||||
366 | } | - | ||||||
367 | - | |||||||
368 | QRgb *QColorDialogOptions::standardColors() | - | ||||||
369 | { | - | ||||||
370 | return qColorDialogStaticData()->standardRgb; | - | ||||||
371 | } | - | ||||||
372 | - | |||||||
373 | QRgb QColorDialogOptions::standardColor(int index) | - | ||||||
374 | { | - | ||||||
375 | if (uint(index) >= uint(QColorDialogStaticData::StandardColorCount)) | - | ||||||
376 | return qRgb(255, 255, 255); | - | ||||||
377 | return qColorDialogStaticData()->standardRgb[index]; | - | ||||||
378 | } | - | ||||||
379 | - | |||||||
380 | void QColorDialogOptions::setStandardColor(int index, QRgb color) | - | ||||||
381 | { | - | ||||||
382 | if (uint(index) >= uint(QColorDialogStaticData::StandardColorCount)) | - | ||||||
383 | return; | - | ||||||
384 | qColorDialogStaticData()->standardRgb[index] = color; | - | ||||||
385 | } | - | ||||||
386 | - | |||||||
387 | /*! | - | ||||||
388 | \class QPlatformColorDialogHelper | - | ||||||
389 | \since 5.0 | - | ||||||
390 | \internal | - | ||||||
391 | \ingroup qpa | - | ||||||
392 | - | |||||||
393 | \brief The QPlatformColorDialogHelper class allows for platform-specific customization of color dialogs. | - | ||||||
394 | - | |||||||
395 | */ | - | ||||||
396 | const QSharedPointer<QColorDialogOptions> &QPlatformColorDialogHelper::options() const | - | ||||||
397 | { | - | ||||||
398 | return m_options; | - | ||||||
399 | } | - | ||||||
400 | - | |||||||
401 | void QPlatformColorDialogHelper::setOptions(const QSharedPointer<QColorDialogOptions> &options) | - | ||||||
402 | { | - | ||||||
403 | m_options = options; | - | ||||||
404 | } | - | ||||||
405 | - | |||||||
406 | // File dialog | - | ||||||
407 | - | |||||||
408 | class QFileDialogOptionsPrivate : public QSharedData | - | ||||||
409 | { | - | ||||||
410 | public: | - | ||||||
411 | QFileDialogOptionsPrivate() : options(0), | - | ||||||
412 | viewMode(QFileDialogOptions::Detail), | - | ||||||
413 | fileMode(QFileDialogOptions::AnyFile), | - | ||||||
414 | acceptMode(QFileDialogOptions::AcceptOpen), | - | ||||||
415 | filters(QDir::AllEntries | QDir::NoDotAndDotDot | QDir::AllDirs), | - | ||||||
416 | useDefaultNameFilters(true) | - | ||||||
417 | {} never executed: end of block | 0 | ||||||
418 | - | |||||||
419 | QFileDialogOptions::FileDialogOptions options; | - | ||||||
420 | QString windowTitle; | - | ||||||
421 | - | |||||||
422 | QFileDialogOptions::ViewMode viewMode; | - | ||||||
423 | QFileDialogOptions::FileMode fileMode; | - | ||||||
424 | QFileDialogOptions::AcceptMode acceptMode; | - | ||||||
425 | QString labels[QFileDialogOptions::DialogLabelCount]; | - | ||||||
426 | QDir::Filters filters; | - | ||||||
427 | QList<QUrl> sidebarUrls; | - | ||||||
428 | bool useDefaultNameFilters; | - | ||||||
429 | QStringList nameFilters; | - | ||||||
430 | QStringList mimeTypeFilters; | - | ||||||
431 | QString defaultSuffix; | - | ||||||
432 | QStringList history; | - | ||||||
433 | QUrl initialDirectory; | - | ||||||
434 | QString initiallySelectedNameFilter; | - | ||||||
435 | QList<QUrl> initiallySelectedFiles; | - | ||||||
436 | QStringList supportedSchemes; | - | ||||||
437 | }; | - | ||||||
438 | - | |||||||
439 | QFileDialogOptions::QFileDialogOptions() : d(new QFileDialogOptionsPrivate) | - | ||||||
440 | { | - | ||||||
441 | } | - | ||||||
442 | - | |||||||
443 | QFileDialogOptions::QFileDialogOptions(const QFileDialogOptions &rhs) : d(rhs.d) | - | ||||||
444 | { | - | ||||||
445 | } | - | ||||||
446 | - | |||||||
447 | QFileDialogOptions &QFileDialogOptions::operator=(const QFileDialogOptions &rhs) | - | ||||||
448 | { | - | ||||||
449 | if (this != &rhs) | - | ||||||
450 | d = rhs.d; | - | ||||||
451 | return *this; | - | ||||||
452 | } | - | ||||||
453 | - | |||||||
454 | QFileDialogOptions::~QFileDialogOptions() | - | ||||||
455 | { | - | ||||||
456 | } | - | ||||||
457 | - | |||||||
458 | QString QFileDialogOptions::windowTitle() const | - | ||||||
459 | { | - | ||||||
460 | return d->windowTitle; | - | ||||||
461 | } | - | ||||||
462 | - | |||||||
463 | void QFileDialogOptions::setWindowTitle(const QString &title) | - | ||||||
464 | { | - | ||||||
465 | d->windowTitle = title; | - | ||||||
466 | } | - | ||||||
467 | - | |||||||
468 | void QFileDialogOptions::setOption(QFileDialogOptions::FileDialogOption option, bool on) | - | ||||||
469 | { | - | ||||||
470 | if (!(d->options & option) != !on) | - | ||||||
471 | setOptions(d->options ^ option); | - | ||||||
472 | } | - | ||||||
473 | - | |||||||
474 | bool QFileDialogOptions::testOption(QFileDialogOptions::FileDialogOption option) const | - | ||||||
475 | { | - | ||||||
476 | return d->options & option; | - | ||||||
477 | } | - | ||||||
478 | - | |||||||
479 | void QFileDialogOptions::setOptions(FileDialogOptions options) | - | ||||||
480 | { | - | ||||||
481 | if (options != d->options) | - | ||||||
482 | d->options = options; | - | ||||||
483 | } | - | ||||||
484 | - | |||||||
485 | QFileDialogOptions::FileDialogOptions QFileDialogOptions::options() const | - | ||||||
486 | { | - | ||||||
487 | return d->options; | - | ||||||
488 | } | - | ||||||
489 | - | |||||||
490 | QDir::Filters QFileDialogOptions::filter() const | - | ||||||
491 | { | - | ||||||
492 | return d->filters; | - | ||||||
493 | } | - | ||||||
494 | - | |||||||
495 | void QFileDialogOptions::setFilter(QDir::Filters filters) | - | ||||||
496 | { | - | ||||||
497 | d->filters = filters; | - | ||||||
498 | } | - | ||||||
499 | - | |||||||
500 | void QFileDialogOptions::setViewMode(QFileDialogOptions::ViewMode mode) | - | ||||||
501 | { | - | ||||||
502 | d->viewMode = mode; | - | ||||||
503 | } | - | ||||||
504 | - | |||||||
505 | QFileDialogOptions::ViewMode QFileDialogOptions::viewMode() const | - | ||||||
506 | { | - | ||||||
507 | return d->viewMode; | - | ||||||
508 | } | - | ||||||
509 | - | |||||||
510 | void QFileDialogOptions::setFileMode(QFileDialogOptions::FileMode mode) | - | ||||||
511 | { | - | ||||||
512 | d->fileMode = mode; | - | ||||||
513 | } | - | ||||||
514 | - | |||||||
515 | QFileDialogOptions::FileMode QFileDialogOptions::fileMode() const | - | ||||||
516 | { | - | ||||||
517 | return d->fileMode; | - | ||||||
518 | } | - | ||||||
519 | - | |||||||
520 | void QFileDialogOptions::setAcceptMode(QFileDialogOptions::AcceptMode mode) | - | ||||||
521 | { | - | ||||||
522 | d->acceptMode = mode; | - | ||||||
523 | } | - | ||||||
524 | - | |||||||
525 | QFileDialogOptions::AcceptMode QFileDialogOptions::acceptMode() const | - | ||||||
526 | { | - | ||||||
527 | return d->acceptMode; | - | ||||||
528 | } | - | ||||||
529 | - | |||||||
530 | void QFileDialogOptions::setSidebarUrls(const QList<QUrl> &urls) | - | ||||||
531 | { | - | ||||||
532 | d->sidebarUrls = urls; | - | ||||||
533 | } | - | ||||||
534 | - | |||||||
535 | QList<QUrl> QFileDialogOptions::sidebarUrls() const | - | ||||||
536 | { | - | ||||||
537 | return d->sidebarUrls; | - | ||||||
538 | } | - | ||||||
539 | - | |||||||
540 | /*! | - | ||||||
541 | \since 5.7 | - | ||||||
542 | \internal | - | ||||||
543 | The bool property useDefaultNameFilters indicates that no name filters have been | - | ||||||
544 | set or that they are equivalent to \gui{All Files (*)}. If it is true, the | - | ||||||
545 | platform can choose to hide the filter combo box. | - | ||||||
546 | - | |||||||
547 | \sa defaultNameFilterString(). | - | ||||||
548 | */ | - | ||||||
549 | bool QFileDialogOptions::useDefaultNameFilters() const | - | ||||||
550 | { | - | ||||||
551 | return d->useDefaultNameFilters; never executed: return d->useDefaultNameFilters; | 0 | ||||||
552 | } | - | ||||||
553 | - | |||||||
554 | void QFileDialogOptions::setUseDefaultNameFilters(bool dnf) | - | ||||||
555 | { | - | ||||||
556 | d->useDefaultNameFilters = dnf; | - | ||||||
557 | } never executed: end of block | 0 | ||||||
558 | - | |||||||
559 | void QFileDialogOptions::setNameFilters(const QStringList &filters) | - | ||||||
560 | { | - | ||||||
561 | d->useDefaultNameFilters = filters.size() == 1
| 0 | ||||||
562 | && filters.first() == QFileDialogOptions::defaultNameFilterString();
| 0 | ||||||
563 | d->nameFilters = filters; | - | ||||||
564 | } never executed: end of block | 0 | ||||||
565 | - | |||||||
566 | QStringList QFileDialogOptions::nameFilters() const | - | ||||||
567 | { | - | ||||||
568 | return d->useDefaultNameFilters ? never executed: return d->useDefaultNameFilters ? QStringList(QFileDialogOptions::defaultNameFilterString()) : d->nameFilters; | 0 | ||||||
569 | QStringList(QFileDialogOptions::defaultNameFilterString()) : never executed: d->nameFilters;return d->useDefaultNameFilters ? QStringList(QFileDialogOptions::defaultNameFilterString()) : d->nameFilters; never executed: return d->useDefaultNameFilters ? QStringList(QFileDialogOptions::defaultNameFilterString()) : d->nameFilters; | 0 | ||||||
570 | } | - | ||||||
571 | - | |||||||
572 | /*! | - | ||||||
573 | \since 5.6 | - | ||||||
574 | \internal | - | ||||||
575 | \return The translated default name filter string (\gui{All Files (*)}). | - | ||||||
576 | \sa defaultNameFilters(), nameFilters() | - | ||||||
577 | */ | - | ||||||
578 | - | |||||||
579 | QString QFileDialogOptions::defaultNameFilterString() | - | ||||||
580 | { | - | ||||||
581 | return QCoreApplication::translate("QFileDialog", "All Files (*)"); never executed: return QCoreApplication::translate("QFileDialog", "All Files (*)"); | 0 | ||||||
582 | } | - | ||||||
583 | - | |||||||
584 | void QFileDialogOptions::setMimeTypeFilters(const QStringList &filters) | - | ||||||
585 | { | - | ||||||
586 | d->mimeTypeFilters = filters; | - | ||||||
587 | } | - | ||||||
588 | - | |||||||
589 | QStringList QFileDialogOptions::mimeTypeFilters() const | - | ||||||
590 | { | - | ||||||
591 | return d->mimeTypeFilters; | - | ||||||
592 | } | - | ||||||
593 | - | |||||||
594 | void QFileDialogOptions::setDefaultSuffix(const QString &suffix) | - | ||||||
595 | { | - | ||||||
596 | d->defaultSuffix = suffix; | - | ||||||
597 | if (d->defaultSuffix.size() > 1 && d->defaultSuffix.startsWith(QLatin1Char('.'))) | - | ||||||
598 | d->defaultSuffix.remove(0, 1); // Silently change ".txt" -> "txt". | - | ||||||
599 | } | - | ||||||
600 | - | |||||||
601 | QString QFileDialogOptions::defaultSuffix() const | - | ||||||
602 | { | - | ||||||
603 | return d->defaultSuffix; | - | ||||||
604 | } | - | ||||||
605 | - | |||||||
606 | void QFileDialogOptions::setHistory(const QStringList &paths) | - | ||||||
607 | { | - | ||||||
608 | d->history = paths; | - | ||||||
609 | } | - | ||||||
610 | - | |||||||
611 | QStringList QFileDialogOptions::history() const | - | ||||||
612 | { | - | ||||||
613 | return d->history; | - | ||||||
614 | } | - | ||||||
615 | - | |||||||
616 | void QFileDialogOptions::setLabelText(QFileDialogOptions::DialogLabel label, const QString &text) | - | ||||||
617 | { | - | ||||||
618 | if (label >= 0 && label < DialogLabelCount) | - | ||||||
619 | d->labels[label] = text; | - | ||||||
620 | } | - | ||||||
621 | - | |||||||
622 | QString QFileDialogOptions::labelText(QFileDialogOptions::DialogLabel label) const | - | ||||||
623 | { | - | ||||||
624 | return (label >= 0 && label < DialogLabelCount) ? d->labels[label] : QString(); | - | ||||||
625 | } | - | ||||||
626 | - | |||||||
627 | bool QFileDialogOptions::isLabelExplicitlySet(DialogLabel label) | - | ||||||
628 | { | - | ||||||
629 | return label >= 0 && label < DialogLabelCount && !d->labels[label].isEmpty(); | - | ||||||
630 | } | - | ||||||
631 | - | |||||||
632 | QUrl QFileDialogOptions::initialDirectory() const | - | ||||||
633 | { | - | ||||||
634 | return d->initialDirectory; | - | ||||||
635 | } | - | ||||||
636 | - | |||||||
637 | void QFileDialogOptions::setInitialDirectory(const QUrl &directory) | - | ||||||
638 | { | - | ||||||
639 | d->initialDirectory = directory; | - | ||||||
640 | } | - | ||||||
641 | - | |||||||
642 | QString QFileDialogOptions::initiallySelectedNameFilter() const | - | ||||||
643 | { | - | ||||||
644 | return d->initiallySelectedNameFilter; | - | ||||||
645 | } | - | ||||||
646 | - | |||||||
647 | void QFileDialogOptions::setInitiallySelectedNameFilter(const QString &filter) | - | ||||||
648 | { | - | ||||||
649 | d->initiallySelectedNameFilter = filter; | - | ||||||
650 | } | - | ||||||
651 | - | |||||||
652 | QList<QUrl> QFileDialogOptions::initiallySelectedFiles() const | - | ||||||
653 | { | - | ||||||
654 | return d->initiallySelectedFiles; | - | ||||||
655 | } | - | ||||||
656 | - | |||||||
657 | void QFileDialogOptions::setInitiallySelectedFiles(const QList<QUrl> &files) | - | ||||||
658 | { | - | ||||||
659 | d->initiallySelectedFiles = files; | - | ||||||
660 | } | - | ||||||
661 | - | |||||||
662 | // Schemes supported by the application | - | ||||||
663 | void QFileDialogOptions::setSupportedSchemes(const QStringList &schemes) | - | ||||||
664 | { | - | ||||||
665 | d->supportedSchemes = schemes; | - | ||||||
666 | } | - | ||||||
667 | - | |||||||
668 | QStringList QFileDialogOptions::supportedSchemes() const | - | ||||||
669 | { | - | ||||||
670 | return d->supportedSchemes; | - | ||||||
671 | } | - | ||||||
672 | - | |||||||
673 | // Return true if the URL is supported by the filedialog implementation *and* by the application. | - | ||||||
674 | bool QPlatformFileDialogHelper::isSupportedUrl(const QUrl &url) const | - | ||||||
675 | { | - | ||||||
676 | return url.isLocalFile(); | - | ||||||
677 | } | - | ||||||
678 | - | |||||||
679 | /*! | - | ||||||
680 | \class QPlatformFileDialogHelper | - | ||||||
681 | \since 5.0 | - | ||||||
682 | \internal | - | ||||||
683 | \ingroup qpa | - | ||||||
684 | - | |||||||
685 | \brief The QPlatformFileDialogHelper class allows for platform-specific customization of file dialogs. | - | ||||||
686 | - | |||||||
687 | */ | - | ||||||
688 | const QSharedPointer<QFileDialogOptions> &QPlatformFileDialogHelper::options() const | - | ||||||
689 | { | - | ||||||
690 | return m_options; | - | ||||||
691 | } | - | ||||||
692 | - | |||||||
693 | void QPlatformFileDialogHelper::setOptions(const QSharedPointer<QFileDialogOptions> &options) | - | ||||||
694 | { | - | ||||||
695 | m_options = options; | - | ||||||
696 | } | - | ||||||
697 | - | |||||||
698 | const char *QPlatformFileDialogHelper::filterRegExp = | - | ||||||
699 | "^(.*)\\(([a-zA-Z0-9_.,*? +;#\\-\\[\\]@\\{\\}/!<>\\$%&=^~:\\|]*)\\)$"; | - | ||||||
700 | - | |||||||
701 | // Makes a list of filters from a normal filter string "Image Files (*.png *.jpg)" | - | ||||||
702 | QStringList QPlatformFileDialogHelper::cleanFilterList(const QString &filter) | - | ||||||
703 | { | - | ||||||
704 | QRegExp regexp(QString::fromLatin1(filterRegExp)); | - | ||||||
705 | Q_ASSERT(regexp.isValid()); | - | ||||||
706 | QString f = filter; | - | ||||||
707 | int i = regexp.indexIn(f); | - | ||||||
708 | if (i >= 0) | - | ||||||
709 | f = regexp.cap(2); | - | ||||||
710 | return f.split(QLatin1Char(' '), QString::SkipEmptyParts); | - | ||||||
711 | } | - | ||||||
712 | - | |||||||
713 | // Message dialog | - | ||||||
714 | - | |||||||
715 | class QMessageDialogOptionsPrivate : public QSharedData | - | ||||||
716 | { | - | ||||||
717 | public: | - | ||||||
718 | QMessageDialogOptionsPrivate() : | - | ||||||
719 | icon(QMessageDialogOptions::NoIcon), | - | ||||||
720 | buttons(QPlatformDialogHelper::Ok) | - | ||||||
721 | {} | - | ||||||
722 | - | |||||||
723 | QString windowTitle; | - | ||||||
724 | QMessageDialogOptions::Icon icon; | - | ||||||
725 | QString text; | - | ||||||
726 | QString informativeText; | - | ||||||
727 | QString detailedText; | - | ||||||
728 | QPlatformDialogHelper::StandardButtons buttons; | - | ||||||
729 | }; | - | ||||||
730 | - | |||||||
731 | QMessageDialogOptions::QMessageDialogOptions() : d(new QMessageDialogOptionsPrivate) | - | ||||||
732 | { | - | ||||||
733 | } | - | ||||||
734 | - | |||||||
735 | QMessageDialogOptions::QMessageDialogOptions(const QMessageDialogOptions &rhs) : d(rhs.d) | - | ||||||
736 | { | - | ||||||
737 | } | - | ||||||
738 | - | |||||||
739 | QMessageDialogOptions &QMessageDialogOptions::operator=(const QMessageDialogOptions &rhs) | - | ||||||
740 | { | - | ||||||
741 | if (this != &rhs) | - | ||||||
742 | d = rhs.d; | - | ||||||
743 | return *this; | - | ||||||
744 | } | - | ||||||
745 | - | |||||||
746 | QMessageDialogOptions::~QMessageDialogOptions() | - | ||||||
747 | { | - | ||||||
748 | } | - | ||||||
749 | - | |||||||
750 | QString QMessageDialogOptions::windowTitle() const | - | ||||||
751 | { | - | ||||||
752 | return d->windowTitle; | - | ||||||
753 | } | - | ||||||
754 | - | |||||||
755 | void QMessageDialogOptions::setWindowTitle(const QString &title) | - | ||||||
756 | { | - | ||||||
757 | d->windowTitle = title; | - | ||||||
758 | } | - | ||||||
759 | - | |||||||
760 | QMessageDialogOptions::Icon QMessageDialogOptions::icon() const | - | ||||||
761 | { | - | ||||||
762 | return d->icon; | - | ||||||
763 | } | - | ||||||
764 | - | |||||||
765 | void QMessageDialogOptions::setIcon(Icon icon) | - | ||||||
766 | { | - | ||||||
767 | d->icon = icon; | - | ||||||
768 | } | - | ||||||
769 | - | |||||||
770 | QString QMessageDialogOptions::text() const | - | ||||||
771 | { | - | ||||||
772 | return d->text; | - | ||||||
773 | } | - | ||||||
774 | - | |||||||
775 | void QMessageDialogOptions::setText(const QString &text) | - | ||||||
776 | { | - | ||||||
777 | d->text = text; | - | ||||||
778 | } | - | ||||||
779 | - | |||||||
780 | QString QMessageDialogOptions::informativeText() const | - | ||||||
781 | { | - | ||||||
782 | return d->informativeText; | - | ||||||
783 | } | - | ||||||
784 | - | |||||||
785 | void QMessageDialogOptions::setInformativeText(const QString &informativeText) | - | ||||||
786 | { | - | ||||||
787 | d->informativeText = informativeText; | - | ||||||
788 | } | - | ||||||
789 | - | |||||||
790 | QString QMessageDialogOptions::detailedText() const | - | ||||||
791 | { | - | ||||||
792 | return d->detailedText; | - | ||||||
793 | } | - | ||||||
794 | - | |||||||
795 | void QMessageDialogOptions::setDetailedText(const QString &detailedText) | - | ||||||
796 | { | - | ||||||
797 | d->detailedText = detailedText; | - | ||||||
798 | } | - | ||||||
799 | - | |||||||
800 | void QMessageDialogOptions::setStandardButtons(QPlatformDialogHelper::StandardButtons buttons) | - | ||||||
801 | { | - | ||||||
802 | d->buttons = buttons; | - | ||||||
803 | } | - | ||||||
804 | - | |||||||
805 | QPlatformDialogHelper::StandardButtons QMessageDialogOptions::standardButtons() const | - | ||||||
806 | { | - | ||||||
807 | return d->buttons; | - | ||||||
808 | } | - | ||||||
809 | - | |||||||
810 | QPlatformDialogHelper::ButtonRole QPlatformDialogHelper::buttonRole(QPlatformDialogHelper::StandardButton button) | - | ||||||
811 | { | - | ||||||
812 | switch (button) { | - | ||||||
813 | case Ok: | - | ||||||
814 | case Save: | - | ||||||
815 | case Open: | - | ||||||
816 | case SaveAll: | - | ||||||
817 | case Retry: | - | ||||||
818 | case Ignore: | - | ||||||
819 | return AcceptRole; | - | ||||||
820 | - | |||||||
821 | case Cancel: | - | ||||||
822 | case Close: | - | ||||||
823 | case Abort: | - | ||||||
824 | return RejectRole; | - | ||||||
825 | - | |||||||
826 | case Discard: | - | ||||||
827 | return DestructiveRole; | - | ||||||
828 | - | |||||||
829 | case Help: | - | ||||||
830 | return HelpRole; | - | ||||||
831 | - | |||||||
832 | case Apply: | - | ||||||
833 | return ApplyRole; | - | ||||||
834 | - | |||||||
835 | case Yes: | - | ||||||
836 | case YesToAll: | - | ||||||
837 | return YesRole; | - | ||||||
838 | - | |||||||
839 | case No: | - | ||||||
840 | case NoToAll: | - | ||||||
841 | return NoRole; | - | ||||||
842 | - | |||||||
843 | case RestoreDefaults: | - | ||||||
844 | case Reset: | - | ||||||
845 | return ResetRole; | - | ||||||
846 | - | |||||||
847 | default: | - | ||||||
848 | break; | - | ||||||
849 | } | - | ||||||
850 | return InvalidRole; | - | ||||||
851 | } | - | ||||||
852 | - | |||||||
853 | const int *QPlatformDialogHelper::buttonLayout(Qt::Orientation orientation, ButtonLayout policy) | - | ||||||
854 | { | - | ||||||
855 | if (policy == UnknownLayout) { | - | ||||||
856 | #if defined (Q_OS_OSX) | - | ||||||
857 | policy = MacLayout; | - | ||||||
858 | #elif defined (Q_OS_LINUX) || defined (Q_OS_UNIX) | - | ||||||
859 | policy = KdeLayout; | - | ||||||
860 | #else | - | ||||||
861 | policy = WinLayout; | - | ||||||
862 | #endif | - | ||||||
863 | } | - | ||||||
864 | return buttonRoleLayouts[orientation == Qt::Vertical][policy]; | - | ||||||
865 | } | - | ||||||
866 | - | |||||||
867 | /*! | - | ||||||
868 | \class QPlatformMessageDialogHelper | - | ||||||
869 | \since 5.0 | - | ||||||
870 | \internal | - | ||||||
871 | \ingroup qpa | - | ||||||
872 | - | |||||||
873 | \brief The QPlatformMessageDialogHelper class allows for platform-specific customization of Message dialogs. | - | ||||||
874 | - | |||||||
875 | */ | - | ||||||
876 | const QSharedPointer<QMessageDialogOptions> &QPlatformMessageDialogHelper::options() const | - | ||||||
877 | { | - | ||||||
878 | return m_options; | - | ||||||
879 | } | - | ||||||
880 | - | |||||||
881 | void QPlatformMessageDialogHelper::setOptions(const QSharedPointer<QMessageDialogOptions> &options) | - | ||||||
882 | { | - | ||||||
883 | m_options = options; | - | ||||||
884 | } | - | ||||||
885 | - | |||||||
886 | QT_END_NAMESPACE | - | ||||||
Source code | Switch to Preprocessed file |