BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
spacer_widget_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 #ifndef BORNAGAIN_GUI_COREGUI_VIEWS_WIDGETBOX_SPACER_WIDGET_P_H
54 #define BORNAGAIN_GUI_COREGUI_VIEWS_WIDGETBOX_SPACER_WIDGET_P_H
55 
57 
58 #include <QSizePolicy>
59 #include <QWidget>
60 
61 QT_BEGIN_NAMESPACE
62 
63 class QDesignerFormWindowInterface;
64 
65 class QDESIGNER_SHARED_EXPORT Spacer : public QWidget {
66  Q_OBJECT
67 
68  Q_ENUMS(SizeType)
69  // Special hack: Make name appear as "spacer name"
70  Q_PROPERTY(QString spacerName READ objectName WRITE setObjectName)
71  Q_PROPERTY(Qt::Orientation orientation READ orientation WRITE setOrientation)
72  Q_PROPERTY(QSizePolicy::Policy sizeType READ sizeType WRITE setSizeType)
73  Q_PROPERTY(
74  QSize sizeHint READ sizeHintProperty WRITE setSizeHintProperty DESIGNABLE true STORED true)
75 
76 public:
77  Spacer(QWidget* parent = 0);
78 
79  QSize sizeHint() const;
80 
81  QSize sizeHintProperty() const;
82  void setSizeHintProperty(const QSize& s);
83 
84  QSizePolicy::Policy sizeType() const;
85  void setSizeType(QSizePolicy::Policy t);
86 
87  Qt::Alignment alignment() const;
88  Qt::Orientation orientation() const;
89 
90  void setOrientation(Qt::Orientation o);
91  void setInteractiveMode(bool b) { m_interactive = b; };
92 
93  virtual bool event(QEvent* e);
94 
95 protected:
96  void paintEvent(QPaintEvent* e);
97  void resizeEvent(QResizeEvent* e);
98  void updateMask();
99 
100 private:
101  bool isInLayout() const;
103 
104  const QSize m_SizeOffset;
105  QDesignerFormWindowInterface* m_formWindow;
106  Qt::Orientation m_orientation;
108  // Cache information about 'being in layout' which is expensive to calculate.
109  enum LayoutState { InLayout, OutsideLayout, UnknownLayoutState };
111  QSize m_sizeHint;
112 };
113 
114 QT_END_NAMESPACE
115 
116 #endif // BORNAGAIN_GUI_COREGUI_VIEWS_WIDGETBOX_SPACER_WIDGET_P_H
void setInteractiveMode(bool b)
QSizePolicy::Policy sizeType() const
virtual bool event(QEvent *e)
LayoutState m_layoutState
Qt::Alignment alignment() const
bool isInLayout() const
const QSize m_SizeOffset
Qt::Orientation orientation() const
bool m_interactive
QDesignerFormWindowInterface * m_formWindow
void setSizeHintProperty(const QSize &s)
void updateMask()
Spacer(QWidget *parent=0)
Qt::Orientation m_orientation
void setOrientation(Qt::Orientation o)
QSize m_sizeHint
void setSizeType(QSizePolicy::Policy t)
void resizeEvent(QResizeEvent *e)
void paintEvent(QPaintEvent *e)
void updateToolTip()
QSize sizeHint() const
QSize sizeHintProperty() const
#define QDESIGNER_SHARED_EXPORT