source: trunk/src/gui/graphicsview/qgraphicswidget_p.h@ 503

Last change on this file since 503 was 2, checked in by Dmitry A. Kuminov, 16 years ago

Initially imported qt-all-opensource-src-4.5.1 from Trolltech.

File size: 7.8 KB
Line 
1/****************************************************************************
2**
3** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
4** Contact: Qt Software Information ([email protected])
5**
6** This file is part of the QtGui module of the Qt Toolkit.
7**
8** $QT_BEGIN_LICENSE:LGPL$
9** Commercial Usage
10** Licensees holding valid Qt Commercial licenses may use this file in
11** accordance with the Qt Commercial License Agreement provided with the
12** Software or, alternatively, in accordance with the terms contained in
13** a written agreement between you and Nokia.
14**
15** GNU Lesser General Public License Usage
16** Alternatively, this file may be used under the terms of the GNU Lesser
17** General Public License version 2.1 as published by the Free Software
18** Foundation and appearing in the file LICENSE.LGPL included in the
19** packaging of this file. Please review the following information to
20** ensure the GNU Lesser General Public License version 2.1 requirements
21** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
22**
23** In addition, as a special exception, Nokia gives you certain
24** additional rights. These rights are described in the Nokia Qt LGPL
25** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
26** package.
27**
28** GNU General Public License Usage
29** Alternatively, this file may be used under the terms of the GNU
30** General Public License version 3.0 as published by the Free Software
31** Foundation and appearing in the file LICENSE.GPL included in the
32** packaging of this file. Please review the following information to
33** ensure the GNU General Public License version 3.0 requirements will be
34** met: http://www.gnu.org/copyleft/gpl.html.
35**
36** If you are unsure which license is appropriate for your use, please
37** contact the sales department at [email protected].
38** $QT_END_LICENSE$
39**
40****************************************************************************/
41
42#ifndef QGRAPHICSWIDGET_P_H
43#define QGRAPHICSWIDGET_P_H
44
45//
46// W A R N I N G
47// -------------
48//
49// This file is not part of the Qt API. It exists for the convenience
50// of qapplication_*.cpp, qwidget*.cpp and qfiledialog.cpp. This header
51// file may change from version to version without notice, or even be removed.
52//
53// We mean it.
54//
55
56#include <private/qobject_p.h>
57#include "qgraphicsitem_p.h"
58#include "qgraphicswidget.h"
59#include <QtGui/qfont.h>
60#include <QtGui/qpalette.h>
61#include <QtGui/qsizepolicy.h>
62#include <QtGui/qstyle.h>
63
64QT_BEGIN_NAMESPACE
65
66class QGraphicsLayout;
67class QStyleOptionTitleBar;
68
69#if !defined(QT_NO_GRAPHICSVIEW) || (QT_EDITION & QT_MODULE_GRAPHICSVIEW) != QT_MODULE_GRAPHICSVIEW
70
71class Q_GUI_EXPORT QGraphicsWidgetPrivate : public QGraphicsItemPrivate
72{
73 Q_DECLARE_PUBLIC(QGraphicsWidget)
74public:
75 QGraphicsWidgetPrivate()
76 : leftMargin(0),
77 topMargin(0),
78 rightMargin(0),
79 bottomMargin(0),
80 leftLayoutItemMargin(0),
81 topLayoutItemMargin(0),
82 rightLayoutItemMargin(0),
83 bottomLayoutItemMargin(0),
84 layout(0),
85 inheritedPaletteResolveMask(0),
86 inheritedFontResolveMask(0),
87 inSetGeometry(0),
88 polished(0),
89 inSetPos(0),
90 focusPolicy(Qt::NoFocus),
91 focusNext(0),
92 focusPrev(0),
93 focusChild(0),
94 windowFlags(0),
95 hoveredSubControl(QStyle::SC_None),
96 grabbedSection(Qt::NoSection),
97 buttonMouseOver(false),
98 buttonSunken(false),
99 setWindowFrameMargins(false),
100 leftWindowFrameMargin(0),
101 topWindowFrameMargin(0),
102 rightWindowFrameMargin(0),
103 bottomWindowFrameMargin(0)
104 { }
105
106 void init(QGraphicsItem *parentItem, Qt::WindowFlags wFlags);
107 qreal titleBarHeight(const QStyleOptionTitleBar &options) const;
108
109 // Margins
110 qreal leftMargin;
111 qreal topMargin;
112 qreal rightMargin;
113 qreal bottomMargin;
114 QRectF contentsRect;
115
116 // Layout item margins
117 void getLayoutItemMargins(qreal *left, qreal *top, qreal *right, qreal *bottom) const;
118 void setLayoutItemMargins(qreal left, qreal top, qreal right, qreal bottom);
119 void setLayoutItemMargins(QStyle::SubElement element, const QStyleOption *opt = 0);
120
121 void fixFocusChainBeforeReparenting(QGraphicsWidget *newParent, QGraphicsScene *newScene = 0);
122 void setLayout_helper(QGraphicsLayout *l);
123
124 qreal leftLayoutItemMargin;
125 qreal topLayoutItemMargin;
126 qreal rightLayoutItemMargin;
127 qreal bottomLayoutItemMargin;
128
129 // Layouts
130 QGraphicsLayout *layout;
131 void setLayoutDirection_helper(Qt::LayoutDirection direction);
132 void resolveLayoutDirection();
133
134 // Style