Overte C++ Documentation
OffscreenQmlDialog.h
1 //
2 // OffscreenQmlDialog.h
3 //
4 // Created by Bradley Austin Davis on 2015/04/14
5 // Copyright 2015 High Fidelity, Inc.
6 //
7 // Distributed under the Apache License, Version 2.0.
8 // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
9 //
10 
11 #pragma once
12 #ifndef hifi_OffscreenQmlDialog_h
13 #define hifi_OffscreenQmlDialog_h
14 
15 #include <QQuickItem>
16 
17 #include "OffscreenUi.h"
18 
19 class OffscreenQmlDialog : public QQuickItem
20 {
21  Q_OBJECT
22  Q_PROPERTY(QString title READ title WRITE setTitle NOTIFY titleChanged)
23  Q_ENUMS(StandardButton)
24  Q_FLAGS(StandardButtons)
25 
26 public:
27  OffscreenQmlDialog(QQuickItem* parent = nullptr);
28  virtual ~OffscreenQmlDialog();
29 
30  enum StandardButton {
31  // keep this in sync with QDialogButtonBox::StandardButton and QMessageBox::StandardButton
32  NoButton = 0x00000000,
33  Ok = 0x00000400,
34  Save = 0x00000800,
35  SaveAll = 0x00001000,
36  Open = 0x00002000,
37  Yes = 0x00004000,
38  YesToAll = 0x00008000,
39  No = 0x00010000,
40  NoToAll = 0x00020000,
41  Abort = 0x00040000,
42  Retry = 0x00080000,
43  Ignore = 0x00100000,
44  Close = 0x00200000,
45  Cancel = 0x00400000,
46  Discard = 0x00800000,
47  Help = 0x01000000,
48  Apply = 0x02000000,
49  Reset = 0x04000000,
50  RestoreDefaults = 0x08000000,
51  NButtons
52  };
53  Q_DECLARE_FLAGS(StandardButtons, StandardButton)
54 
55 protected:
56  void hide();
57  virtual void accept();
58  virtual void reject();
59 
60 public:
61  QString title() const;
62  void setTitle(const QString& title);
63 
64 signals:
65  void accepted();
66  void rejected();
67  void titleChanged();
68 
69 private:
70  QString _title;
71 
72 };
73 
74 Q_DECLARE_OPERATORS_FOR_FLAGS(OffscreenQmlDialog::StandardButtons)
75 
76 #endif