Qt 6.x
The Qt SDK
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 <optional>
37
39
41{
42 Q_DECLARE_PUBLIC(QLabel)
43public:
46
47 void init();
48 void clearContents();
49 void updateLabel();
50 QSize sizeForWidth(int w) const;
51
52#if QT_CONFIG(movie)
53 void _q_movieUpdated(const QRect&);
54 void _q_movieResized(const QSize&);
55#endif
56#ifndef QT_NO_SHORTCUT
57 void updateShortcut();
58 void _q_buddyDeleted();
59#endif
60 inline bool needTextControl() const {
61 Q_Q(const QLabel);
62 return isTextLabel
63 && (effectiveTextFormat != Qt::PlainText
64 || (textInteractionFlags & (Qt::TextSelectableByMouse | Qt::TextSelectableByKeyboard))
65 || q->focusPolicy() != Qt::NoFocus);
66 }
67
68 void ensureTextPopulated() const;
69 void ensureTextLayouted() const;
70 void ensureTextControl() const;
71 void sendControlEvent(QEvent *e);
72
73 void _q_linkHovered(const QString &link);
74
75 QRectF layoutRect() const;
76 QRect documentRect() const;
77 QPoint layoutPoint(const QPoint& p) const;
78 Qt::LayoutDirection textDirection() const;
79#ifndef QT_NO_CONTEXTMENU
80 QMenu *createStandardContextMenu(const QPoint &pos);
81#endif
82
83 mutable QSize sh;
84 mutable QSize msh;
86 std::optional<QPixmap> pixmap;
87 std::optional<QPixmap> scaledpixmap;
88 std::optional<QImage> cachedimage;
89#ifndef QT_NO_PICTURE
90 std::optional<QPicture> picture;
91#endif
92#if QT_CONFIG(movie)
93 QPointer<QMovie> movie;
94#endif
97#ifndef QT_NO_CURSOR
99#endif
100#ifndef QT_NO_SHORTCUT
103#endif
106 Qt::TextInteractionFlags textInteractionFlags;
110 short indent;
111 mutable uint valid_hints : 1;
114 mutable uint textDirty : 1;
115 mutable uint isTextLabel : 1;
116 mutable uint hasShortcut : 1;
117#ifndef QT_NO_CURSOR
120#endif
122 // <-- space for more bit field values here
124
125 friend class QMessageBoxPrivate;
126};
127
129
130#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:98
std::optional< QImage > cachedimage
Definition qlabel_p.h:88
uint validCursor
Definition qlabel_p.h:118
std::optional< QPixmap > pixmap
Definition qlabel_p.h:86
std::optional< QPixmap > scaledpixmap
Definition qlabel_p.h:87
QString text
Definition qlabel_p.h:85
Qt::TextFormat effectiveTextFormat
Definition qlabel_p.h:105
QPointer< QWidget > buddy
Definition qlabel_p.h:101
uint hasShortcut
Definition qlabel_p.h:116
uint scaledcontents
Definition qlabel_p.h:112
QTextCursor shortcutCursor
Definition qlabel_p.h:96
Qt::TextFormat textformat
Definition qlabel_p.h:104
bool needTextControl() const
Definition qlabel_p.h:60
uint textLayoutDirty
Definition qlabel_p.h:113
QTextDocument::ResourceProvider resourceProvider
Definition qlabel_p.h:123
uint openExternalLinks
Definition qlabel_p.h:121
QWidgetTextControl * control
Definition qlabel_p.h:95
uint isTextLabel
Definition qlabel_p.h:115
ushort align
Definition qlabel_p.h:109
QSizePolicy sizePolicy
Definition qlabel_p.h:107
std::optional< QPicture > picture
Definition qlabel_p.h:90
Qt::TextInteractionFlags textInteractionFlags
Definition qlabel_p.h:106
uint valid_hints
Definition qlabel_p.h:111
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:23
\inmodule QtCore
Definition qpointer.h:18
\inmodule QtCore\reentrant
Definition qrect.h:483
\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:127
\reentrant \inmodule QtGui
Definition qtextcursor.h:30
std::function< QVariant(const QUrl &)> ResourceProvider
double e
Combined button and popup list for selecting options.
@ TextSelectableByMouse
@ TextSelectableByKeyboard
TextFormat
@ PlainText
LayoutDirection
@ NoFocus
Definition qnamespace.h:106
GLfloat GLfloat GLfloat w
[0]
GLdouble GLdouble GLdouble GLdouble q
Definition qopenglext.h:259
GLfloat GLfloat p
[1]
#define Q_AUTOTEST_EXPORT
unsigned int uint
Definition qtypes.h:29
unsigned short ushort
Definition qtypes.h:28