Qt 4.8
qlabel_p.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 QLABEL_P_H
43 #define QLABEL_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 purely as an
50 // implementation detail. This header file may change from version to
51 // version without notice, or even be removed.
52 //
53 // We mean it.
54 //
55 
56 #include "qlabel.h"
57 
58 #include "private/qtextdocumentlayout_p.h"
59 #include "private/qtextcontrol_p.h"
60 #include "qtextdocumentfragment.h"
61 #include "qframe_p.h"
62 #include "qtextdocument.h"
63 #include "qmovie.h"
64 #include "qimage.h"
65 #include "qbitmap.h"
66 #include "qpicture.h"
67 #include "qmenu.h"
68 
70 
72 {
74 public:
76 
77  void init();
78  void clearContents();
79  void updateLabel();
80  QSize sizeForWidth(int w) const;
81 
82  mutable QSize sh;
83  mutable QSize msh;
84  mutable bool valid_hints;
86  int margin;
91 #ifndef QT_NO_PICTURE
93 #endif
94 #ifndef QT_NO_MOVIE
96  void _q_movieUpdated(const QRect&);
97  void _q_movieResized(const QSize&);
98 #endif
99 #ifndef QT_NO_SHORTCUT
100  void updateShortcut();
101 #endif
102 #ifndef QT_NO_SHORTCUT
105 #endif
107  short indent;
109  mutable uint textLayoutDirty : 1;
110  mutable uint textDirty : 1;
111  mutable uint isRichText : 1;
112  mutable uint isTextLabel : 1;
113  mutable uint hasShortcut : 1;
117  Qt::TextInteractionFlags textInteractionFlags;
118 
119  inline bool needTextControl() const {
120  return isTextLabel
121  && (isRichText
122  || (!isRichText && (textInteractionFlags & (Qt::TextSelectableByMouse | Qt::TextSelectableByKeyboard))));
123  }
124 
125  void ensureTextPopulated() const;
126  void ensureTextLayouted() const;
127  void ensureTextControl() const;
128  void sendControlEvent(QEvent *e);
129 
130  void _q_linkHovered(const QString &link);
131 
132  QRectF layoutRect() const;
133  QRect documentRect() const;
134  QPoint layoutPoint(const QPoint& p) const;
136 #ifndef QT_NO_CONTEXTMENU
138 #endif
139 
141 
142 #ifndef QT_NO_CURSOR
146 #endif
147 
148  friend class QMessageBoxPrivate;
149 };
150 
152 
153 #endif // QLABEL_P_H
QString text
Definition: qlabel_p.h:87
ushort align
Definition: qlabel_p.h:106
QPoint layoutPoint(const QPoint &p) const
Definition: qlabel.cpp:1752
QPointer< QWidget > buddy
Definition: qlabel_p.h:103
QSize sizeForWidth(int w) const
Returns the size that will be used if the width of the label is w.
Definition: qlabel.cpp:667
QSize sh
Definition: qlabel_p.h:82
void _q_linkHovered(const QString &link)
Definition: qlabel.cpp:1710
The QCursor class provides a mouse cursor with an arbitrary shape.
Definition: qcursor.h:89
bool needTextControl() const
Definition: qlabel_p.h:119
uint isTextLabel
Definition: qlabel_p.h:112
#define QT_END_NAMESPACE
This macro expands to.
Definition: qglobal.h:90
void _q_movieResized(const QSize &)
Definition: qlabel.cpp:1367
QTextControl * control
Definition: qlabel_p.h:115
uint scaledcontents
Definition: qlabel_p.h:108
bool valid_hints
Definition: qlabel_p.h:84
QImage * cachedimage
Definition: qlabel_p.h:90
QPixmap * scaledpixmap
Definition: qlabel_p.h:89
void clearContents()
Clears any contents, without updating/repainting the label.
Definition: qlabel.cpp:1414
uint onAnchor
Definition: qlabel_p.h:144
QMenu * createStandardContextMenu(const QPoint &pos)
Definition: qlabel.cpp:1759
The QString class provides a Unicode character string.
Definition: qstring.h:83
Qt::TextInteractionFlags textInteractionFlags
Definition: qlabel_p.h:117
void ensureTextPopulated() const
Definition: qlabel.cpp:1611
uint textDirty
Definition: qlabel_p.h:110
QPicture * picture
Definition: qlabel_p.h:92
void updateShortcut()
Definition: qlabel.cpp:1325
#define QT_BEGIN_NAMESPACE
This macro expands to.
Definition: qglobal.h:89
The QRectF class defines a rectangle in the plane using floating point precision. ...
Definition: qrect.h:511
Qt::LayoutDirection textDirection() const
Definition: qlabel.cpp:1564
QRect documentRect() const
Definition: qlabel.cpp:1587
The QTextCursor class offers an API to access and modify QTextDocuments.
Definition: qtextcursor.h:70
LayoutDirection
Definition: qnamespace.h:1580
The QImage class provides a hardware-independent image representation that allows direct access to th...
Definition: qimage.h:87
void ensureTextLayouted() const
Definition: qlabel.cpp:1650
unsigned int uint
Definition: qglobal.h:996
QRectF layoutRect() const
Definition: qlabel.cpp:1735
QTextCursor shortcutCursor
Definition: qlabel_p.h:116
uint hasShortcut
Definition: qlabel_p.h:113
void _q_movieUpdated(const QRect &)
Definition: qlabel.cpp:1344
TextFormat
Definition: qnamespace.h:1310
QSize msh
Definition: qlabel_p.h:83
QPixmap * pixmap
Definition: qlabel_p.h:88
void ensureTextControl() const
Definition: qlabel.cpp:1676
void init()
Definition: qlabel.cpp:292
QSizePolicy sizePolicy
Definition: qlabel_p.h:85
#define Q_DECLARE_PUBLIC(Class)
Definition: qglobal.h:2477
QCursor cursor
Definition: qlabel_p.h:145
The QMenu class provides a menu widget for use in menu bars, context menus, and other popup menus...
Definition: qmenu.h:72
uint validCursor
Definition: qlabel_p.h:143
unsigned short ushort
Definition: qglobal.h:995
Qt::TextFormat textformat
Definition: qlabel_p.h:114
void sendControlEvent(QEvent *e)
Definition: qlabel.cpp:1700
int shortcutId
Definition: qlabel_p.h:104
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
uint isRichText
Definition: qlabel_p.h:111
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
The QLabel widget provides a text or image display.
Definition: qlabel.h:55
short indent
Definition: qlabel_p.h:107
The QPixmap class is an off-screen image representation that can be used as a paint device...
Definition: qpixmap.h:71
bool openExternalLinks
Definition: qlabel_p.h:140
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53
void updateLabel()
Updates the label, but not the frame.
Definition: qlabel.cpp:1253
uint textLayoutDirty
Definition: qlabel_p.h:109
The QPicture class is a paint device that records and replays QPainter commands.
Definition: qpicture.h:58
The QEvent class is the base class of all event classes.
Definition: qcoreevent.h:56
QPointer< QMovie > movie
Definition: qlabel_p.h:95