Qt 4.8
qt-4.8.6
src
gui
graphicsview
qgraphicslayoutitem.h
Go to the documentation of this file.
1
/****************************************************************************
2
**
3
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
4
** Contact: http://www.qt-project.org/legal
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 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
#ifndef QGRAPHICSLAYOUTITEM_H
43
#define QGRAPHICSLAYOUTITEM_H
44
45
#include <QtCore/qscopedpointer.h>
46
#include <QtGui/qsizepolicy.h>
47
#include <QtGui/qevent.h>
48
49
QT_BEGIN_HEADER
50
51
QT_BEGIN_NAMESPACE
52
53
QT_MODULE
(Gui)
54
55
#if !defined(QT_NO_GRAPHICSVIEW) || (QT_EDITION & QT_MODULE_GRAPHICSVIEW) != QT_MODULE_GRAPHICSVIEW
56
57
class
QGraphicsLayoutItemPrivate
;
58
class
QGraphicsItem
;
59
class
Q_GUI_EXPORT
QGraphicsLayoutItem
60
{
61
public
:
62
QGraphicsLayoutItem
(
QGraphicsLayoutItem
*parent = 0,
bool
isLayout =
false
);
63
virtual
~
QGraphicsLayoutItem
();
64
65
void
setSizePolicy(
const
QSizePolicy
&policy);
66
void
setSizePolicy(
QSizePolicy::Policy
hPolicy,
QSizePolicy::Policy
vPolicy,
QSizePolicy::ControlType
controlType =
QSizePolicy::DefaultType
);
67
QSizePolicy
sizePolicy()
const
;
68
69
void
setMinimumSize(
const
QSizeF
&size);
70
inline
void
setMinimumSize(
qreal
w,
qreal
h);
71
QSizeF
minimumSize()
const
;
72
void
setMinimumWidth(
qreal
width);
73
inline
qreal
minimumWidth()
const
;
74
void
setMinimumHeight(
qreal
height);
75
inline
qreal
minimumHeight()
const
;
76
77
void
setPreferredSize(
const
QSizeF
&size);
78
inline
void
setPreferredSize(
qreal
w,
qreal
h);
79
QSizeF
preferredSize()
const
;
80
void
setPreferredWidth(
qreal
width);
81
inline
qreal
preferredWidth()
const
;
82
void
setPreferredHeight(
qreal
height);
83
inline
qreal
preferredHeight()
const
;
84
85
void
setMaximumSize(
const
QSizeF
&size);
86
inline
void
setMaximumSize(
qreal
w,
qreal
h);
87
QSizeF
maximumSize()
const
;
88
void
setMaximumWidth(
qreal
width);
89
inline
qreal
maximumWidth()
const
;
90
void
setMaximumHeight(
qreal
height);
91
inline
qreal
maximumHeight()
const
;
92
93
virtual
void
setGeometry(
const
QRectF
&rect);
94
QRectF
geometry()
const
;
95
virtual
void
getContentsMargins(
qreal
*
left
,
qreal
*top,
qreal
*
right
,
qreal
*bottom)
const
;
96
QRectF
contentsRect()
const
;
97
98
QSizeF
effectiveSizeHint(
Qt::SizeHint
which,
const
QSizeF
&constraint =
QSizeF
())
const
;
99
100
virtual
void
updateGeometry();
//### rename to sizeHintChanged()
101
102
QGraphicsLayoutItem
*parentLayoutItem()
const
;
103
void
setParentLayoutItem(
QGraphicsLayoutItem
*parent);
104
105
bool
isLayout()
const
;
106
// ###Qt5: Make automatic reparenting work regardless of item/object/widget type.
107
QGraphicsItem
*graphicsItem()
const
;
108
bool
ownedByLayout()
const
;
109
110
protected
:
111
void
setGraphicsItem(
QGraphicsItem
*item);
112
void
setOwnedByLayout(
bool
ownedByLayout);
113
QGraphicsLayoutItem
(
QGraphicsLayoutItemPrivate
&dd);
114
115
virtual
QSizeF
sizeHint(
Qt::SizeHint
which,
const
QSizeF
&constraint =
QSizeF
())
const
= 0;
116
QScopedPointer<QGraphicsLayoutItemPrivate>
d_ptr
;
117
118
private
:
119
QSizeF
*effectiveSizeHints(
const
QSizeF
&constraint)
const
;
120
Q_DECLARE_PRIVATE
(
QGraphicsLayoutItem
)
121
122
friend
class
QGraphicsLayout
;
123
};
124
125
Q_DECLARE_INTERFACE
(
QGraphicsLayoutItem
, "com.trolltech.
Qt
.QGraphicsLayoutItem")
126
127
inline
void
QGraphicsLayoutItem::setMinimumSize(
qreal
aw,
qreal
ah)
128
{ setMinimumSize(
QSizeF
(aw, ah)); }
129
inline
void
QGraphicsLayoutItem::setPreferredSize
(
qreal
aw,
qreal
ah)
130
{ setPreferredSize(
QSizeF
(aw, ah)); }
131
inline
void
QGraphicsLayoutItem::setMaximumSize
(
qreal
aw,
qreal
ah)
132
{ setMaximumSize(
QSizeF
(aw, ah)); }
133
134
inline
qreal
QGraphicsLayoutItem::minimumWidth
()
const
135
{
return
effectiveSizeHint(
Qt::MinimumSize
).
width
(); }
136
inline
qreal
QGraphicsLayoutItem::minimumHeight
()
const
137
{
return
effectiveSizeHint(
Qt::MinimumSize
).
height
(); }
138
139
inline
qreal
QGraphicsLayoutItem::preferredWidth
()
const
140
{
return
effectiveSizeHint(
Qt::PreferredSize
).
width
(); }
141
inline
qreal
QGraphicsLayoutItem::preferredHeight
()
const
142
{
return
effectiveSizeHint(
Qt::PreferredSize
).
height
(); }
143
144
inline
qreal
QGraphicsLayoutItem::maximumWidth
()
const
145
{
return
effectiveSizeHint(
Qt::MaximumSize
).
width
(); }
146
inline
qreal
QGraphicsLayoutItem::maximumHeight
()
const
147
{
return
effectiveSizeHint(
Qt::MaximumSize
).
height
(); }
148
149
#endif
150
151
QT_END_NAMESPACE
152
153
QT_END_HEADER
154
155
#endif
QGraphicsLayoutItem::maximumHeight
qreal maximumHeight() const
Returns the maximum height.
Definition:
qgraphicslayoutitem.h:146
Qt::MinimumSize
Definition:
qnamespace.h:1709
qreal
double qreal
Definition:
qglobal.h:1193
QT_END_NAMESPACE
#define QT_END_NAMESPACE
This macro expands to.
Definition:
qglobal.h:90
QGraphicsLayoutItem::d_ptr
QScopedPointer< QGraphicsLayoutItemPrivate > d_ptr
Definition:
qgraphicslayoutitem.h:116
QT_MODULE
#define QT_MODULE(x)
Definition:
qglobal.h:2783
QSizePolicy::Policy
Policy
Definition:
qsizepolicy.h:81
QT_BEGIN_HEADER
#define QT_BEGIN_HEADER
Definition:
qglobal.h:136
QSizeF::width
qreal width() const
Returns the width.
Definition:
qsize.h:284
Q_GUI_EXPORT
#define Q_GUI_EXPORT
Definition:
qglobal.h:1450
QGraphicsLayoutItem::maximumWidth
qreal maximumWidth() const
Returns the maximum width.
Definition:
qgraphicslayoutitem.h:144
QGraphicsItem
The QGraphicsItem class is the base class for all graphical items in a QGraphicsScene.
Definition:
qgraphicsitem.h:89
QSizeF::height
qreal height() const
Returns the height.
Definition:
qsize.h:287
QSizeF
The QSizeF class defines the size of a two-dimensional object using floating point precision...
Definition:
qsize.h:202
QGraphicsLayoutItem::minimumWidth
qreal minimumWidth() const
Returns the minimum width.
Definition:
qgraphicslayoutitem.h:134
Q_DECLARE_INTERFACE
#define Q_DECLARE_INTERFACE(IFace, IId)
Definition:
qobject.h:397
right
Q_CORE_EXPORT QTextStream & right(QTextStream &s)
QScopedPointer< QGraphicsLayoutItemPrivate >
QSizePolicy
Definition:
qsizepolicy.h:55
QT_BEGIN_NAMESPACE
#define QT_BEGIN_NAMESPACE
This macro expands to.
Definition:
qglobal.h:89
QRectF
The QRectF class defines a rectangle in the plane using floating point precision. ...
Definition:
qrect.h:511
QGraphicsLayoutItem::preferredWidth
qreal preferredWidth() const
Returns the preferred width.
Definition:
qgraphicslayoutitem.h:139
Qt::MaximumSize
Definition:
qnamespace.h:1711
QGraphicsLayoutItem::minimumHeight
qreal minimumHeight() const
Returns the minimum height.
Definition:
qgraphicslayoutitem.h:136
QGraphicsLayoutItem::preferredHeight
qreal preferredHeight() const
Returns the preferred height.
Definition:
qgraphicslayoutitem.h:141
QGraphicsLayoutItem
The QGraphicsLayoutItem class can be inherited to allow your custom items to be managed by layouts...
Definition:
qgraphicslayoutitem.h:59
QGraphicsLayoutItem::setPreferredSize
void setPreferredSize(const QSizeF &size)
Sets the preferred size to size.
Definition:
qgraphicslayoutitem.cpp:643
QGraphicsLayoutItemPrivate
Definition:
qgraphicslayoutitem_p.h:62
Qt::SizeHint
SizeHint
Definition:
qnamespace.h:1708
QSizePolicy::ControlType
ControlType
Definition:
qsizepolicy.h:91
QGraphicsLayout
The QGraphicsLayout class provides the base class for all layouts in Graphics View.
Definition:
qgraphicslayout.h:59
Qt
Definition:
qnamespace.h:54
Q_DECLARE_PRIVATE
#define Q_DECLARE_PRIVATE(Class)
Definition:
qglobal.h:2467
QSizePolicy::DefaultType
Definition:
qsizepolicy.h:92
class
#define class
Definition:
qapplication_x11.cpp:92
left
Q_CORE_EXPORT QTextStream & left(QTextStream &s)
QT_END_HEADER
#define QT_END_HEADER
Definition:
qglobal.h:137
Qt::PreferredSize
Definition:
qnamespace.h:1710
QGraphicsLayoutItem::setMaximumSize
void setMaximumSize(const QSizeF &size)
Sets the maximum size to size.
Definition:
qgraphicslayoutitem.cpp:700
Qt 4.8 Source Code Browser