Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qlabel_p.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QLABEL_P_H
5#define QLABEL_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QtWidgets/private/qtwidgetsglobal_p.h>
19#include "qlabel.h"
20
21#include "private/qtextdocumentlayout_p.h"
22#include "private/qwidgettextcontrol_p.h"
24#include "qframe_p.h"
25#include "qtextdocument.h"
26#if QT_CONFIG(movie)
27#include "qmovie.h"
28#endif
29#include "qimage.h"
30#include "qbitmap.h"
31#include "qpicture.h"
32#if QT_CONFIG(menu)
33#include "qmenu.h"
34#endif
35
36#include <QtCore/qpointer.h>
37
38#include <array>
39#include <optional>
40
42
44{
45 Q_DECLARE_PUBLIC(QLabel)
46public:
49
50 void init();
51 void clearContents();
52 void updateLabel();
53 QSize sizeForWidth(int w) const;
54
55#if QT_CONFIG(movie)
56 void movieUpdated(const QRect &rect);
57 void movieResized(const QSize &size);
58#endif
59#ifndef QT_NO_SHORTCUT
60 void updateShortcut();
61 void buddyDeleted();
62#endif
63 inline bool needTextControl() const {
64 Q_Q(const QLabel);
65 return isTextLabel
66 && (effectiveTextFormat != Qt::PlainText
67 || (textInteractionFlags & (Qt::TextSelectableByMouse | Qt::TextSelectableByKeyboard))
68 || q->focusPolicy() != Qt::NoFocus);
69 }
70
71 void ensureTextPopulated() const;
72 void ensureTextLayouted() const;
73 void ensureTextControl() const;
74 void sendControlEvent(QEvent *e);
75
76 void linkHovered(const QString &link);
77
78 QRectF layoutRect() const;
79 QRect documentRect() const;
80 QPoint layoutPoint(const QPoint& p) const;
81 Qt::LayoutDirection textDirection() const;
82#ifndef QT_NO_CONTEXTMENU
83 QMenu *createStandardContextMenu(const QPoint &pos);
84#endif
85
86 mutable QSize sh;
87 mutable QSize msh;
89 std::optional<QPixmap> pixmap;
90 std::optional<QPixmap> scaledpixmap;
91 std::optional<QImage> cachedimage;
92#ifndef QT_NO_PICTURE
93 std::optional<QPicture> picture;
94#endif
95#if QT_CONFIG(movie)
96 QPointer<QMovie> movie;
97 std::array<QMetaObject::Connection, 2> movieConnections;
98#endif
101#ifndef QT_NO_CURSOR
103#endif
104#ifndef QT_NO_SHORTCUT
105 QPointer<QWidget> buddy;
107#endif
110 Qt::TextInteractionFlags textInteractionFlags;
114 short indent;
115 mutable uint valid_hints : 1;
118 mutable uint textDirty : 1;
119 mutable uint isTextLabel : 1;
120 mutable uint hasShortcut : 1;
121#ifndef QT_NO_CURSOR
124#endif
126 // <-- space for more bit field values here
128
129 friend class QMessageBoxPrivate;
130};
131
133
134#endif // QLABEL_P_H
The QCursor class provides a mouse cursor with an arbitrary shape.
Definition qcursor.h:45
\inmodule QtCore
Definition qcoreevent.h:45
void init()
Definition qframe.cpp:33
QCursor cursor
Definition qlabel_p.h:102
std::optional< QImage > cachedimage
Definition qlabel_p.h:91
uint validCursor
Definition qlabel_p.h:122
std::optional< QPixmap > pixmap
Definition qlabel_p.h:89
std::optional< QPixmap > scaledpixmap
Definition qlabel_p.h:90
QString text
Definition qlabel_p.h:88
Qt::TextFormat effectiveTextFormat
Definition qlabel_p.h:109
QPointer< QWidget > buddy
Definition qlabel_p.h:105
uint hasShortcut
Definition qlabel_p.h:120
uint scaledcontents
Definition qlabel_p.h:116
QTextCursor shortcutCursor
Definition qlabel_p.h:100
Qt::TextFormat textformat
Definition qlabel_p.h:108
bool needTextControl() const
Definition qlabel_p.h:63
uint textLayoutDirty
Definition qlabel_p.h:117
QTextDocument::ResourceProvider resourceProvider
Definition qlabel_p.h:127
uint openExternalLinks
Definition qlabel_p.h:125
QWidgetTextControl * control
Definition qlabel_p.h:99
uint isTextLabel
Definition qlabel_p.h:119
ushort align
Definition qlabel_p.h:113
QSizePolicy sizePolicy
Definition qlabel_p.h:111
std::optional< QPicture > picture
Definition qlabel_p.h:93
Qt::TextInteractionFlags textInteractionFlags
Definition qlabel_p.h:110
uint valid_hints
Definition qlabel_p.h:115
The QLabel widget provides a text or image display.
Definition qlabel.h:20
The QMenu class provides a menu widget for use in menu bars, context menus, and other popup menus.
Definition qmenu.h:26
\inmodule QtCore\reentrant
Definition qpoint.h:25
\inmodule QtCore\reentrant
Definition qrect.h:484
\inmodule QtCore\reentrant
Definition qrect.h:30
The QSizePolicy class is a layout attribute describing horizontal and vertical resizing policy.
Definition qsizepolicy.h:18
\inmodule QtCore
Definition qsize.h:25
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
\reentrant \inmodule QtGui
Definition qtextcursor.h:30
std::function< QVariant(const QUrl &)> ResourceProvider
rect
[4]
Combined button and popup list for selecting options.
@ TextSelectableByMouse
@ TextSelectableByKeyboard
TextFormat
@ PlainText
LayoutDirection
@ NoFocus
Definition qnamespace.h:107
GLfloat GLfloat GLfloat w
[0]
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLdouble GLdouble GLdouble GLdouble q
Definition qopenglext.h:259
GLfloat GLfloat p
[1]
#define Q_AUTOTEST_EXPORT
unsigned int uint
Definition qtypes.h:34
unsigned short ushort
Definition qtypes.h:33