BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
formwindowbase_p.h
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/legal
5 **
6 ** This file is part of the Qt Designer 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 Digia. For licensing terms and
14 ** conditions see http://qt.digia.com/licensing. For further information
15 ** use the contact form at http://qt.digia.com/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 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 **
25 ** In addition, as a special exception, Digia gives you certain additional
26 ** rights. These rights are described in the Digia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 **
29 ** GNU General Public License Usage
30 ** Alternatively, this file may be used under the terms of the GNU
31 ** General Public License version 3.0 as published by the Free Software
32 ** Foundation and appearing in the file LICENSE.GPL included in the
33 ** packaging of this file. Please review the following information to
34 ** ensure the GNU General Public License version 3.0 requirements will be
35 ** met: http://www.gnu.org/copyleft/gpl.html.
36 **
37 **
38 ** $QT_END_LICENSE$
39 **
40 ****************************************************************************/
41 
42 //
43 // W A R N I N G
44 // -------------
45 //
46 // This file is not part of the Qt API. It exists for the convenience
47 // of Qt Designer. This header
48 // file may change from version to version without notice, or even be removed.
49 //
50 // We mean it.
51 //
52 
53 // Patched JWu 12nov20 because QFlags(0) was deprecated
54 
55 #ifndef BORNAGAIN_GUI_COREGUI_VIEWS_WIDGETBOX_FORMWINDOWBASE_P_H
56 #define BORNAGAIN_GUI_COREGUI_VIEWS_WIDGETBOX_FORMWINDOWBASE_P_H
57 
59 
60 #include <QtDesigner/QDesignerFormWindowInterface>
61 
62 #include <QtCore/QList>
63 #include <QtCore/QVariantMap>
64 
65 QT_BEGIN_NAMESPACE
66 
67 class QDesignerDnDItemInterface;
68 class QMenu;
69 class QtResourceSet;
70 class QDesignerPropertySheet;
71 
72 namespace qdesigner_internal {
73 
74 class QEditorFormBuilder;
75 class DeviceProfile;
76 class Grid;
77 
78 class DesignerPixmapCache;
79 class DesignerIconCache;
80 class FormWindowBasePrivate;
81 
82 class QDESIGNER_SHARED_EXPORT FormWindowBase : public QDesignerFormWindowInterface {
83  Q_OBJECT
84 public:
85  enum HighlightMode { Restore, Highlight };
86 
87  explicit FormWindowBase(QDesignerFormEditorInterface* core, QWidget* parent = 0,
88  Qt::WindowFlags flags = {});
89  virtual ~FormWindowBase();
90 
91  QVariantMap formData();
92  void setFormData(const QVariantMap& vm);
93 
94  virtual QStringList checkContents() const;
95 
96  // Deprecated
97  virtual QPoint grid() const;
98 
99  // Deprecated
100  virtual void setGrid(const QPoint& grid);
101 
102  virtual bool hasFeature(Feature f) const;
103  virtual Feature features() const;
104  virtual void setFeatures(Feature f);
105 
106  const Grid& designerGrid() const;
107  void setDesignerGrid(const Grid& grid);
108 
109  bool hasFormGrid() const;
110  void setHasFormGrid(bool b);
111 
112  bool gridVisible() const;
113 
114 #if QT_VERSION >= 0x050000
115  virtual ResourceFileSaveMode resourceFileSaveMode() const;
116  virtual void setResourceFileSaveMode(ResourceFileSaveMode behaviour);
117 #endif
118 
119  static const Grid& defaultDesignerGrid();
120  static void setDefaultDesignerGrid(const Grid& grid);
121 
122  // Overwrite to initialize and return a full popup menu for a managed widget
123  virtual QMenu* initializePopupMenu(QWidget* managedWidget);
124  // Helper to create a basic popup menu from task menu extensions (internal/public)
125  static QMenu* createExtensionTaskMenu(QDesignerFormWindowInterface* fw, QObject* o,
126  bool trailingSeparator = true);
127 
128  virtual bool dropWidgets(const QList<QDesignerDnDItemInterface*>& item_list, QWidget* target,
129  const QPoint& global_mouse_pos) = 0;
130 
131  // Helper to find the widget at the mouse position with some flags.
132  enum WidgetUnderMouseMode { FindSingleSelectionDropTarget, FindMultiSelectionDropTarget };
133  QWidget* widgetUnderMouse(const QPoint& formPos, WidgetUnderMouseMode m);
134 
135  virtual QWidget* widgetAt(const QPoint& pos) = 0;
136  virtual QWidget* findContainer(QWidget* w, bool excludeLayout) const = 0;
137 
138  void deleteWidgetList(const QWidgetList& widget_list);
139 
140  virtual void highlightWidget(QWidget* w, const QPoint& pos, HighlightMode mode = Highlight) = 0;
141 
142  enum PasteMode { PasteAll, PasteActionsOnly };
143 #ifndef QT_NO_CLIPBOARD
144  virtual void paste(PasteMode pasteMode) = 0;
145 #endif
146 
147  // Factory method to create a form builder
149 
150  virtual bool blockSelectionChanged(bool blocked) = 0;
151  virtual void emitSelectionChanged() = 0;
152 
155  virtual QtResourceSet* resourceSet() const;
156  virtual void setResourceSet(QtResourceSet* resourceSet);
157  void addReloadableProperty(QDesignerPropertySheet* sheet, int index);
158  void removeReloadableProperty(QDesignerPropertySheet* sheet, int index);
159  void addReloadablePropertySheet(QDesignerPropertySheet* sheet, QObject* object);
160  void removeReloadablePropertySheet(QDesignerPropertySheet* sheet);
162 
163  void emitWidgetRemoved(QWidget* w);
164  void emitObjectRemoved(QObject* o);
165 
167  QString styleName() const;
168  QString deviceProfileName() const;
169 
173  NativeLineTerminator =
174 #if defined(Q_OS_WIN)
175  CRLFLineTerminator
176 #else
177  LFLineTerminator
178 #endif
179  };
180 
183 
184 public slots:
185  void resourceSetActivated(QtResourceSet* resourceSet, bool resourceSetChanged);
186 
187 private slots:
188  void triggerDefaultAction(QWidget* w);
189 
190 private:
192 
193  FormWindowBasePrivate* m_d;
194 };
195 
196 } // namespace qdesigner_internal
197 
198 QT_END_NAMESPACE
199 
200 #endif // BORNAGAIN_GUI_COREGUI_VIEWS_WIDGETBOX_FORMWINDOWBASE_P_H
static const Grid & defaultDesignerGrid()
virtual QtResourceSet * resourceSet() const
QWidget * widgetUnderMouse(const QPoint &formPos, WidgetUnderMouseMode m)
virtual void paste(PasteMode pasteMode)=0
virtual void setFeatures(Feature f)
void removeReloadableProperty(QDesignerPropertySheet *sheet, int index)
virtual bool blockSelectionChanged(bool blocked)=0
virtual bool dropWidgets(const QList< QDesignerDnDItemInterface * > &item_list, QWidget *target, const QPoint &global_mouse_pos)=0
virtual void setResourceSet(QtResourceSet *resourceSet)
virtual QMenu * initializePopupMenu(QWidget *managedWidget)
void setLineTerminatorMode(LineTerminatorMode mode)
void addReloadableProperty(QDesignerPropertySheet *sheet, int index)
virtual bool hasFeature(Feature f) const
DesignerIconCache * iconCache() const
virtual QPoint grid() const
virtual QWidget * findContainer(QWidget *w, bool excludeLayout) const =0
virtual void highlightWidget(QWidget *w, const QPoint &pos, HighlightMode mode=Highlight)=0
void deleteWidgetList(const QWidgetList &widget_list)
void resourceSetActivated(QtResourceSet *resourceSet, bool resourceSetChanged)
void removeReloadablePropertySheet(QDesignerPropertySheet *sheet)
virtual QWidget * widgetAt(const QPoint &pos)=0
static void setDefaultDesignerGrid(const Grid &grid)
virtual Feature features() const
void setFormData(const QVariantMap &vm)
void setDesignerGrid(const Grid &grid)
FormWindowBase(QDesignerFormEditorInterface *core, QWidget *parent=0, Qt::WindowFlags flags={})
const Grid & designerGrid() const
DeviceProfile deviceProfile() const
virtual void setGrid(const QPoint &grid)
static QMenu * createExtensionTaskMenu(QDesignerFormWindowInterface *fw, QObject *o, bool trailingSeparator=true)
virtual QStringList checkContents() const
virtual QEditorFormBuilder * createFormBuilder()=0
void addReloadablePropertySheet(QDesignerPropertySheet *sheet, QObject *object)
DesignerPixmapCache * pixmapCache() const
LineTerminatorMode lineTerminatorMode() const
#define QDESIGNER_SHARED_EXPORT