Qt 4.8
Public Functions | Public Variables | Friends | List of all members
QLabelPrivate Class Reference

#include <qlabel_p.h>

Inheritance diagram for QLabelPrivate:
QFramePrivate QWidgetPrivate QObjectPrivate QObjectData

Public Functions

void _q_linkHovered (const QString &link)
 
void _q_movieResized (const QSize &)
 
void _q_movieUpdated (const QRect &)
 
void clearContents ()
 Clears any contents, without updating/repainting the label. More...
 
QMenucreateStandardContextMenu (const QPoint &pos)
 
QRect documentRect () const
 
void ensureTextControl () const
 
void ensureTextLayouted () const
 
void ensureTextPopulated () const
 
void init ()
 
QPoint layoutPoint (const QPoint &p) const
 
QRectF layoutRect () const
 
bool needTextControl () const
 
 QLabelPrivate ()
 
void sendControlEvent (QEvent *e)
 
QSize sizeForWidth (int w) const
 Returns the size that will be used if the width of the label is w. More...
 
Qt::LayoutDirection textDirection () const
 
void updateLabel ()
 Updates the label, but not the frame. More...
 
void updateShortcut ()
 
- Public Functions inherited from QFramePrivate
void init ()
 
 QFramePrivate ()
 
void updateFrameWidth ()
 Updated the frameWidth parameter. More...
 
void updateStyledFrameWidths ()
 Updates the frame widths from the style. More...
 
- Public Functions inherited from QWidgetPrivate
void _q_showIfNotHidden ()
 
virtual void aboutToDestroy ()
 
void activateChildLayoutsRecursively ()
 
QSize adjustedSize () const
 
void adjustQuitOnCloseAttribute ()
 
QInputContextassignedInputContext () const
 
QPainterbeginSharedPainter ()
 
QWidgetchildAt_helper (const QPoint &, bool) const
 
QWidgetchildAtRecursiveHelper (const QPoint &p, bool, bool includeFrame=false) const
 
QRect clipRect () const
 
QRegion clipRegion () const
 
void clipToEffectiveMask (QRegion &region) const
 
bool close_helper (CloseMode mode)
 
void create_sys (WId window, bool initializeWindow, bool destroyOldWindow)
 
QWindowSurfacecreateDefaultWindowSurface ()
 
QWindowSurfacecreateDefaultWindowSurface_sys ()
 
void createExtra ()
 Creates the widget extra data. More...
 
void createRecursively ()
 
void createSysExtra ()
 
void createTLExtra ()
 
void createTLSysExtra ()
 
void createWinId (WId id=0)
 
void deactivateWidgetCleanup ()
 
void deleteExtra ()
 Deletes the widget extra data. More...
 
void deleteSysExtra ()
 
void deleteTLSysExtra ()
 
void drawWidget (QPaintDevice *pdev, const QRegion &rgn, const QPoint &offset, int flags, QPainter *sharedPainter=0, QWidgetBackingStore *backingStore=0)
 
QWidgeteffectiveFocusWidget ()
 
QRect effectiveRectFor (const QRect &rect) const
 
bool endSharedPainter ()
 
void enforceNativeChildren ()
 
QWExtraextraData () const
 
QRect frameStrut () const
 
void getLayoutItemMargins (int *left, int *top, int *right, int *bottom) const
 
const QRegiongetOpaqueChildren () const
 
void handleSoftwareInputPanel (Qt::MouseButton button, bool clickCausedFocus)
 
virtual bool hasHeightForWidth () const
 
void hide_helper ()
 
void hide_sys ()
 Platform-specific part of QWidget::hide(). More...
 
void hideChildren (bool spontaneous)
 
void inheritStyle ()
 
void init (QWidget *desktopWidget, Qt::WindowFlags f)
 
QInputContextinputContext () const
 
void invalidateBuffer (const QRegion &)
 Invalidates the rgn (in widget's coordinates) of the backing store, i.e. More...
 
void invalidateBuffer (const QRect &)
 This function is equivalent to calling invalidateBuffer(QRegion(rect), ...), but is more efficient as it eliminates QRegion operations/allocations and can use the rect more precisely for additional cut-offs. More...
 
void invalidateBuffer_resizeHelper (const QPoint &oldPos, const QSize &oldSize)
 Invalidates the buffer when the widget is resized. More...
 
void invalidateGraphicsEffectsRecursively ()
 
bool isAboutToShow () const
 
bool isBackgroundInherited () const
 
bool isOverlapped (const QRect &) const
 
void lower_sys ()
 
QPoint mapFromGlobal (const QPoint &pos) const
 
QPoint mapToGlobal (const QPoint &pos) const
 
QWidgetBackingStoremaybeBackingStore () const
 
QTLWExtramaybeTopData () const
 
void moveRect (const QRect &, int dx, int dy)
 
bool nativeChildrenForced () const
 
QFont naturalWidgetFont (uint inheritedMask) const
 
QPalette naturalWidgetPalette (uint inheritedMask) const
 Returns the palette that the widget w inherits from its ancestors and QApplication::palette. More...
 
void paintBackground (QPainter *, const QRegion &, int flags=DrawAsRoot) const
 
bool paintOnScreen () const
 
void paintSiblingsRecursive (QPaintDevice *pdev, const QObjectList &children, int index, const QRegion &rgn, const QPoint &offset, int flags, QPainter *sharedPainter, QWidgetBackingStore *backingStore)
 
bool pointInsideRectAndMask (const QPoint &) const
 
QRegion prepareToRender (const QRegion &region, QWidget::RenderFlags renderFlags)
 
void propagatePaletteChange ()
 Propagate this widget's palette to all children, except style sheet widgets, and windows that don't enable window propagation (palettes don't normally propagate to windows). More...
 
 QWidgetPrivate (int version=QObjectPrivateVersion)
 
void raise_sys ()
 
QPaintDeviceredirected (QPoint *offset) const
 
void registerDropSite (bool)
 
void render (QPaintDevice *target, const QPoint &targetOffset, const QRegion &sourceRegion, QWidget::RenderFlags renderFlags, bool readyToRender)
 
void render_helper (QPainter *painter, const QPoint &targetOffset, const QRegion &sourceRegion, QWidget::RenderFlags renderFlags)
 
void repaint_sys (const QRegion &rgn)
 
void reparentFocusWidgets (QWidget *oldtlw)
 
void resolveFont ()
 Determine which font is implicitly imposed on this widget by its ancestors and QApplication::font, resolve this against its own font (attributes from the implicit font are copied over). More...
 
void resolveLayoutDirection ()
 
void resolveLocale ()
 
void resolvePalette ()
 Determine which palette is inherited from this widget's ancestors and QApplication::palette, resolve this against this widget's palette (attributes from the inherited palette are copied over this widget's palette). More...
 
void restoreRedirected ()
 
void scroll_sys (int dx, int dy)
 
void scroll_sys (int dx, int dy, const QRect &r)
 
void scrollChildren (int dx, int dy)
 
void scrollRect (const QRect &, int dx, int dy)
 
void sendPendingMoveAndResizeEvents (bool recursive=false, bool disableUpdates=false)
 
void sendStartupMessage (const char *message) const
 Platform-specific part of QWidget::show(). More...
 
void setConstraints_sys ()
 
void setCursor_sys (const QCursor &cursor)
 
void setDirtyOpaqueRegion ()
 
void setEnabled_helper (bool)
 
void setFocus_sys ()
 
void setFont_helper (const QFont &font)
 
void setGeometry_sys (int, int, int, int, bool)
 
void setLayoutDirection_helper (Qt::LayoutDirection)
 
void setLayoutItemMargins (int left, int top, int right, int bottom)
 
void setLayoutItemMargins (QStyle::SubElement element, const QStyleOption *opt=0)
 
void setLocale_helper (const QLocale &l, bool forceUpdate=false)
 
void setMask_sys (const QRegion &)
 
bool setMaximumSize_helper (int &maxw, int &maxh)
 
bool setMinimumSize_helper (int &minw, int &minh)
 
void setModal_sys ()
 
void setNetWmWindowTypes ()
 
void setOpaque (bool opaque)
 
void setPalette_helper (const QPalette &)
 
void setParent_sys (QWidget *parent, Qt::WindowFlags)
 
void setRedirected (QPaintDevice *replacement, const QPoint &offset)
 
void setSharedPainter (QPainter *painter)
 
void setStyle_helper (QStyle *newStyle, bool propagate, bool metalHack=false)
 
void setUpdatesEnabled_helper (bool)
 
void setWindowFilePath_helper (const QString &filePath)
 
void setWindowIcon_helper ()
 
void setWindowIcon_sys (bool forceReset=false)
 
void setWindowIconText_helper (const QString &cap)
 
void setWindowIconText_sys (const QString &cap)
 
void setWindowOpacity_sys (qreal opacity)
 
void setWindowRole ()
 
void setWindowTitle_helper (const QString &cap)
 
void setWindowTitle_sys (const QString &cap)
 
void setWinId (WId)
 
QPaintersharedPainter () const
 
void show_helper ()
 
void show_recursive ()
 Makes the widget visible in the isVisible() meaning of the word. More...
 
void show_sys ()
 Platform-specific part of QWidget::show(). More...
 
void showChildren (bool spontaneous)
 
void stackUnder_sys (QWidget *)
 
void subtractOpaqueChildren (QRegion &rgn, const QRect &clipRect) const
 
void subtractOpaqueSiblings (QRegion &source, bool *hasDirtySiblingsAbove=0, bool alsoNonOpaque=false) const
 
void syncBackingStore ()
 
void syncBackingStore (const QRegion &region)
 
QTLWExtratopData () const
 
void unsetCursor_sys ()
 
void updateFont (const QFont &)
 Assign font to this widget, and propagate it to all children, except style sheet widgets (handled differently) and windows that don't enable window propagation. More...
 
void updateFrameStrut ()
 Computes the frame rectangle when needed. More...
 
void updateGeometry_helper (bool forceUpdate)
 
void updateIsOpaque ()
 
void updateIsTranslucent ()
 
void updateSystemBackground ()
 
void updateX11AcceptFocus ()
 
void x11UpdateIsOpaque ()
 
 ~QWidgetPrivate ()
 
- Public Functions inherited from QObjectPrivate
void _q_reregisterTimers (void *pointer)
 
void addConnection (int signal, Connection *c)
 
void cleanConnectionLists ()
 
void connectNotify (const char *signal)
 
void deleteChildren ()
 
void disconnectNotify (const char *signal)
 
bool isSender (const QObject *receiver, const char *signal) const
 
bool isSignalConnected (uint signalIdx) const
 Returns true if the signal with index signal_index from object sender is connected. More...
 
void moveToThread_helper ()
 
 QObjectPrivate (int version=QObjectPrivateVersion)
 
QObjectList receiverList (const char *signal) const
 
QObjectList senderList () const
 
void setParent_helper (QObject *)
 
void setThreadData_helper (QThreadData *currentData, QThreadData *targetData)
 
int signalIndex (const char *signalName) const
 Returns the signal index used in the internal connectionLists vector. More...
 
virtual ~QObjectPrivate ()
 
- Public Functions inherited from QObjectData
virtual ~QObjectData ()=0
 

Public Variables

ushort align
 
QPointer< QWidgetbuddy
 
QImagecachedimage
 
QTextControlcontrol
 
QCursor cursor
 
uint hasShortcut: 1
 
short indent
 
uint isRichText: 1
 
uint isTextLabel: 1
 
int margin
 
QPointer< QMoviemovie
 
QSize msh
 
uint onAnchor: 1
 
bool openExternalLinks
 
QPicturepicture
 
QPixmappixmap
 
uint scaledcontents:1
 
QPixmapscaledpixmap
 
QSize sh
 
QTextCursor shortcutCursor
 
int shortcutId
 
QSizePolicy sizePolicy
 
QString text
 
uint textDirty: 1
 
Qt::TextFormat textformat
 
Qt::TextInteractionFlags textInteractionFlags
 
uint textLayoutDirty: 1
 
bool valid_hints
 
uint validCursor: 1
 
- Public Variables inherited from QFramePrivate
short bottomFrameWidth
 
int frameStyle
 
short frameWidth
 
QRect frect
 
short leftFrameWidth
 
short lineWidth
 
short midLineWidth
 
short rightFrameWidth
 
short topFrameWidth
 
- Public Variables inherited from QWidgetPrivate
QString accessibleDescription
 
QString accessibleName
 
QList< QAction * > actions
 
QPalette::ColorRole bg_role: 8
 
signed char bottomLayoutItemMargin
 
short bottommargin
 
QWidgetData data
 
QRegion dirty
 
uint dirtyOpaqueChildren: 1
 
QWExtraextra
 
QPaintEngineextraPaintEngine
 
QPalette::ColorRole fg_role: 8
 
QWidgetfocus_child
 
QWidgetfocus_next
 
QWidgetfocus_prev
 
QMap< Qt::GestureType, Qt::GestureFlags > gestureContext
 
QGraphicsEffectgraphicsEffect
 
Qt::HANDLE hd
 
uint high_attributes [4]
 
QPointer< QInputContextic
 
Qt::InputMethodHints imHints
 
uint inDirtyList: 1
 
uint inheritedFontResolveMask
 
uint inheritedPaletteResolveMask
 
uint inheritsInputMethodHints: 1
 
uint inSetParent: 1
 
uint isGLWidget: 1
 
uint isMoved: 1
 
uint isOpaque: 1
 
uint isScrolled: 1
 
QLayoutlayout
 
signed char leftLayoutItemMargin
 
short leftmargin
 
QLocale locale
 
QRegionneedsFlush
 
QRegion opaqueChildren
 
Qt::HANDLE picture
 
const QMetaObjectpolished
 
QPaintDeviceredirectDev
 
QPoint redirectOffset
 
signed char rightLayoutItemMargin
 
short rightmargin
 
QSizePolicy size_policy
 
QString statusTip
 
QString toolTip
 
signed char topLayoutItemMargin
 
short topmargin
 
uint usesDoubleBufferedGLContext: 1
 
QString whatsThis
 
QWidgetItemV2widgetItem
 
QX11Info xinfo
 
- Public Variables inherited from QObjectPrivate
union {
   QObject *   currentChildBeingDeleted
 
   QAbstractDeclarativeData *   declarativeData
 
}; 
 
quint32 connectedSignals [2]
 
QObjectConnectionListVectorconnectionLists
 
SendercurrentSender
 
QList< QPointer< QObject > > eventFilters
 
ExtraDataextraData
 
QString objectName
 
Connectionsenders
 
QAtomicPointer< QtSharedPointer::ExternalRefCountData > sharedRefcount
 
QThreadDatathreadData
 
void * unused
 
- Public Variables inherited from QObjectData
uint blockSig: 1
 
QObjectList children
 
uint hasGuards: 1
 
uint inEventHandler: 1
 
uint inThreadChangeEvent: 1
 
uint isWidget: 1
 
QMetaObjectmetaObject
 
uint ownObjectName: 1
 
QObjectparent
 
uint pendTimer: 1
 
int postedEvents
 
QObjectq_ptr
 
uint receiveChildEvents: 1
 
uint sendChildEvents: 1
 
uint unused: 22
 
uint wasDeleted: 1
 

Friends

class QMessageBoxPrivate
 

Additional Inherited Members

- Public Types inherited from QWidgetPrivate
enum  CloseMode { CloseNoEvent, CloseWithEvent, CloseWithSpontaneousEvent }
 
enum  Direction { DirectionNorth = 0x01, DirectionEast = 0x10, DirectionSouth = 0x02, DirectionWest = 0x20 }
 
enum  DrawWidgetFlags {
  DrawAsRoot = 0x01, DrawPaintOnScreen = 0x02, DrawRecursive = 0x04, DrawInvisible = 0x08,
  DontSubtractOpaqueChildren = 0x10, DontSetCompositionMode = 0x20, DontDrawOpaqueChildren = 0x40, DontDrawNativeChildren = 0x80
}
 
- Public Types inherited from QObjectPrivate
typedef void(* StaticMetaCallFunction) (QObject *, QMetaObject::Call, int, void **)
 
- Static Public Functions inherited from QWidgetPrivate
static void adjustFlags (Qt::WindowFlags &flags, QWidget *w=0)
 
static QGraphicsProxyWidgetnearestGraphicsProxyWidget (const QWidget *origin)
 Finds the nearest widget embedded in a graphics proxy widget along the chain formed by this widget and its ancestors. More...
 
static int pointToRect (const QPoint &p, const QRect &r)
 
static QRect screenGeometry (const QWidget *widget)
 
- Static Public Functions inherited from QObjectPrivate
static void clearGuards (QObject *)
 
static QObjectPrivateget (QObject *o)
 
static void resetCurrentSender (QObject *receiver, Sender *currentSender, Sender *previousSender)
 
static SendersetCurrentSender (QObject *receiver, Sender *sender)
 
static void signalSignature (const QMetaMethod &signal, QVarLengthArray< char > *result)
 
- Static Public Variables inherited from QWidgetPrivate
static QWidgetSetallWidgets = 0
 
static int instanceCounter = 0
 
static QWidgetkeyboardGrabber = 0
 
static QWidgetMappermapper = 0
 
static int maxInstances = 0
 
static QWidgetmouseGrabber = 0
 

Detailed Description

Definition at line 71 of file qlabel_p.h.

Constructors and Destructors

◆ QLabelPrivate()

QLabelPrivate::QLabelPrivate ( )
inline

Definition at line 75 of file qlabel_p.h.

75 {}

Functions

◆ _q_linkHovered()

void QLabelPrivate::_q_linkHovered ( const QString link)

Definition at line 1710 of file qlabel.cpp.

Referenced by needTextControl().

1711 {
1712  Q_Q(QLabel);
1713 #ifndef QT_NO_CURSOR
1714  if (anchor.isEmpty()) { // restore cursor
1715  if (validCursor)
1716  q->setCursor(cursor);
1717  else
1718  q->unsetCursor();
1719  onAnchor = false;
1720  } else if (!onAnchor) {
1721  validCursor = q->testAttribute(Qt::WA_SetCursor);
1722  if (validCursor) {
1723  cursor = q->cursor();
1724  }
1725  q->setCursor(Qt::PointingHandCursor);
1726  onAnchor = true;
1727  }
1728 #endif
1729  emit q->linkHovered(anchor);
1730 }
uint onAnchor
Definition: qlabel_p.h:144
#define Q_Q(Class)
Definition: qglobal.h:2483
#define emit
Definition: qobjectdefs.h:76
QCursor cursor
Definition: qlabel_p.h:145
uint validCursor
Definition: qlabel_p.h:143
The QLabel widget provides a text or image display.
Definition: qlabel.h:55

◆ _q_movieResized()

void QLabelPrivate::_q_movieResized ( const QSize size)

Definition at line 1367 of file qlabel.cpp.

1368 {
1369  Q_Q(QLabel);
1370  q->update(); //we need to refresh the whole background in case the new size is smaler
1371  valid_hints = false;
1372  _q_movieUpdated(QRect(QPoint(0,0), size));
1373  q->updateGeometry();
1374 }
bool valid_hints
Definition: qlabel_p.h:84
#define Q_Q(Class)
Definition: qglobal.h:2483
void _q_movieUpdated(const QRect &)
Definition: qlabel.cpp:1344
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
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

◆ _q_movieUpdated()

void QLabelPrivate::_q_movieUpdated ( const QRect rect)

Definition at line 1344 of file qlabel.cpp.

1345 {
1346  Q_Q(QLabel);
1347  if (movie && movie->isValid()) {
1348  QRect r;
1349  if (scaledcontents) {
1350  QRect cr = q->contentsRect();
1351  QRect pixmapRect(cr.topLeft(), movie->currentPixmap().size());
1352  if (pixmapRect.isEmpty())
1353  return;
1354  r.setRect(cr.left(), cr.top(),
1355  (rect.width() * cr.width()) / pixmapRect.width(),
1356  (rect.height() * cr.height()) / pixmapRect.height());
1357  } else {
1358  r = q->style()->itemPixmapRect(q->contentsRect(), align, movie->currentPixmap());
1359  r.translate(rect.x(), rect.y());
1360  r.setWidth(qMin(r.width(), rect.width()));
1361  r.setHeight(qMin(r.height(), rect.height()));
1362  }
1363  q->update(r);
1364  }
1365 }
ushort align
Definition: qlabel_p.h:106
void setHeight(int h)
Sets the height of the rectangle to the given height.
Definition: qrect.h:445
Q_DECL_CONSTEXPR const T & qMin(const T &a, const T &b)
Definition: qglobal.h:1215
QSize size() const
Returns the size of the pixmap.
Definition: qpixmap.cpp:661
uint scaledcontents
Definition: qlabel_p.h:108
int left() const
Returns the x-coordinate of the rectangle&#39;s left edge.
Definition: qrect.h:240
int width() const
Returns the width of the rectangle.
Definition: qrect.h:303
int height() const
Returns the height of the rectangle.
Definition: qrect.h:306
#define Q_Q(Class)
Definition: qglobal.h:2483
QPixmap currentPixmap() const
Returns the current frame as a QPixmap.
Definition: qmovie.cpp:825
int top() const
Returns the y-coordinate of the rectangle&#39;s top edge.
Definition: qrect.h:243
bool isValid() const
Returns true if the movie is valid (e.g., the image data is readable and the image format is supporte...
Definition: qmovie.cpp:854
int y() const
Returns the y-coordinate of the rectangle&#39;s top edge.
Definition: qrect.h:255
int x() const
Returns the x-coordinate of the rectangle&#39;s left edge.
Definition: qrect.h:252
void setRect(int x, int y, int w, int h)
Sets the coordinates of the rectangle&#39;s top-left corner to ({x}, {y}), and its size to the given widt...
Definition: qrect.h:400
void setWidth(int w)
Sets the width of the rectangle to the given width.
Definition: qrect.h:442
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
void translate(int dx, int dy)
Moves the rectangle dx along the x axis and dy along the y axis, relative to the current position...
Definition: qrect.h:312
QPointer< QMovie > movie
Definition: qlabel_p.h:95
QPoint topLeft() const
Returns the position of the rectangle&#39;s top-left corner.
Definition: qrect.h:288

◆ clearContents()

void QLabelPrivate::clearContents ( )

Clears any contents, without updating/repainting the label.

Warning
This function is not part of the public interface.

Definition at line 1414 of file qlabel.cpp.

Referenced by QLabelPrivate().

1415 {
1416  delete control;
1417  control = 0;
1418  isTextLabel = false;
1419  hasShortcut = false;
1420 
1421 #ifndef QT_NO_PICTURE
1422  delete picture;
1423  picture = 0;
1424 #endif
1425  delete scaledpixmap;
1426  scaledpixmap = 0;
1427  delete cachedimage;
1428  cachedimage = 0;
1429  delete pixmap;
1430  pixmap = 0;
1431 
1432  text.clear();
1433  Q_Q(QLabel);
1434 #ifndef QT_NO_SHORTCUT
1435  if (shortcutId)
1436  q->releaseShortcut(shortcutId);
1437  shortcutId = 0;
1438 #endif
1439 #ifndef QT_NO_MOVIE
1440  if (movie) {
1443  }
1444  movie = 0;
1445 #endif
1446 #ifndef QT_NO_CURSOR
1447  if (onAnchor) {
1448  if (validCursor)
1449  q->setCursor(cursor);
1450  else
1451  q->unsetCursor();
1452  }
1453  validCursor = false;
1454  onAnchor = false;
1455 #endif
1456 }
QString text
Definition: qlabel_p.h:87
uint isTextLabel
Definition: qlabel_p.h:112
void _q_movieResized(const QSize &)
Definition: qlabel.cpp:1367
QTextControl * control
Definition: qlabel_p.h:115
QImage * cachedimage
Definition: qlabel_p.h:90
QPixmap * scaledpixmap
Definition: qlabel_p.h:89
#define SLOT(a)
Definition: qobjectdefs.h:226
uint onAnchor
Definition: qlabel_p.h:144
QPicture * picture
Definition: qlabel_p.h:92
#define Q_Q(Class)
Definition: qglobal.h:2483
#define SIGNAL(a)
Definition: qobjectdefs.h:227
uint hasShortcut
Definition: qlabel_p.h:113
void _q_movieUpdated(const QRect &)
Definition: qlabel.cpp:1344
static bool disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *member)
Disconnects signal in object sender from method in object receiver.
Definition: qobject.cpp:2895
QPixmap * pixmap
Definition: qlabel_p.h:88
QCursor cursor
Definition: qlabel_p.h:145
uint validCursor
Definition: qlabel_p.h:143
void clear()
Clears the contents of the string and makes it empty.
Definition: qstring.h:723
int shortcutId
Definition: qlabel_p.h:104
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
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53
QPointer< QMovie > movie
Definition: qlabel_p.h:95

◆ createStandardContextMenu()

QMenu * QLabelPrivate::createStandardContextMenu ( const QPoint pos)

Definition at line 1759 of file qlabel.cpp.

Referenced by needTextControl().

1760 {
1761  QString linkToCopy;
1762  QPoint p;
1763  if (control && isRichText) {
1764  p = layoutPoint(pos);
1765  linkToCopy = control->document()->documentLayout()->anchorAt(p);
1766  }
1767 
1768  if (linkToCopy.isEmpty() && !control)
1769  return 0;
1770 
1771  return control->createStandardContextMenu(p, q_func());
1772 }
QPoint layoutPoint(const QPoint &p) const
Definition: qlabel.cpp:1752
QTextControl * control
Definition: qlabel_p.h:115
The QString class provides a Unicode character string.
Definition: qstring.h:83
QString anchorAt(const QPointF &pos) const
Returns the reference of the anchor the given position, or an empty string if no anchor exists at tha...
QMenu * createStandardContextMenu(const QPointF &pos, QWidget *parent)
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
Definition: qstring.h:704
QTextDocument * document() const
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
QAbstractTextDocumentLayout * documentLayout() const
Returns the document layout for this document.
uint isRichText
Definition: qlabel_p.h:111

◆ documentRect()

QRect QLabelPrivate::documentRect ( ) const

Definition at line 1587 of file qlabel.cpp.

Referenced by needTextControl().

1588 {
1589  Q_Q(const QLabel);
1590  Q_ASSERT_X(isTextLabel, "documentRect", "document rect called for label that is not a text label!");
1591  QRect cr = q->contentsRect();
1592  cr.adjust(margin, margin, -margin, -margin);
1594  : q->layoutDirection(), QFlag(this->align));
1595  int m = indent;
1596  if (m < 0 && q->frameWidth()) // no indent, but we do have a frame
1597  m = q->fontMetrics().width(QLatin1Char('x')) / 2 - margin;
1598  if (m > 0) {
1599  if (align & Qt::AlignLeft)
1600  cr.setLeft(cr.left() + m);
1601  if (align & Qt::AlignRight)
1602  cr.setRight(cr.right() - m);
1603  if (align & Qt::AlignTop)
1604  cr.setTop(cr.top() + m);
1605  if (align & Qt::AlignBottom)
1606  cr.setBottom(cr.bottom() - m);
1607  }
1608  return cr;
1609 }
ushort align
Definition: qlabel_p.h:106
void setBottom(int pos)
Sets the bottom edge of the rectangle to the given y coordinate.
Definition: qrect.h:267
uint isTextLabel
Definition: qlabel_p.h:112
The QFlag class is a helper data type for QFlags.
Definition: qglobal.h:2289
int left() const
Returns the x-coordinate of the rectangle&#39;s left edge.
Definition: qrect.h:240
int bottom() const
Returns the y-coordinate of the rectangle&#39;s bottom edge.
Definition: qrect.h:249
#define Q_Q(Class)
Definition: qglobal.h:2483
short frameWidth
Definition: qframe_p.h:74
Qt::LayoutDirection textDirection() const
Definition: qlabel.cpp:1564
void setTop(int pos)
Sets the top edge of the rectangle to the given y coordinate.
Definition: qrect.h:261
void adjust(int x1, int y1, int x2, int y2)
Adds dx1, dy1, dx2 and dy2 respectively to the existing coordinates of the rectangle.
Definition: qrect.h:434
void setRight(int pos)
Sets the right edge of the rectangle to the given x coordinate.
Definition: qrect.h:264
#define Q_ASSERT_X(cond, where, what)
Definition: qglobal.h:1837
int top() const
Returns the y-coordinate of the rectangle&#39;s top edge.
Definition: qrect.h:243
static Qt::Alignment visualAlignment(Qt::LayoutDirection direction, Qt::Alignment alignment)
Transforms an alignment of Qt::AlignLeft or Qt::AlignRight without Qt::AlignAbsolute into Qt::AlignLe...
Definition: qstyle.cpp:2149
int right() const
Returns the x-coordinate of the rectangle&#39;s right edge.
Definition: qrect.h:246
void setLeft(int pos)
Sets the left edge of the rectangle to the given x coordinate.
Definition: qrect.h:258
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 QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
Definition: qchar.h:55

◆ ensureTextControl()

void QLabelPrivate::ensureTextControl ( ) const

Definition at line 1676 of file qlabel.cpp.

Referenced by needTextControl().

1677 {
1678  Q_Q(const QLabel);
1679  if (!isTextLabel)
1680  return;
1681  if (!control) {
1682  control = new QTextControl(const_cast<QLabel *>(q));
1683  control->document()->setUndoRedoEnabled(false);
1684  control->document()->setDefaultFont(q->font());
1687  control->setPalette(q->palette());
1688  control->setFocus(q->hasFocus());
1689  QObject::connect(control, SIGNAL(updateRequest(QRectF)),
1690  q, SLOT(update()));
1691  QObject::connect(control, SIGNAL(linkHovered(QString)),
1692  q, SLOT(_q_linkHovered(QString)));
1693  QObject::connect(control, SIGNAL(linkActivated(QString)),
1694  q, SIGNAL(linkActivated(QString)));
1695  textLayoutDirty = true;
1696  textDirty = true;
1697  }
1698 }
void _q_linkHovered(const QString &link)
Definition: qlabel.cpp:1710
uint isTextLabel
Definition: qlabel_p.h:112
QTextControl * control
Definition: qlabel_p.h:115
void setTextInteractionFlags(Qt::TextInteractionFlags flags)
void setPalette(const QPalette &pal)
#define SLOT(a)
Definition: qobjectdefs.h:226
The QString class provides a Unicode character string.
Definition: qstring.h:83
Qt::TextInteractionFlags textInteractionFlags
Definition: qlabel_p.h:117
uint textDirty
Definition: qlabel_p.h:110
#define Q_Q(Class)
Definition: qglobal.h:2483
#define SIGNAL(a)
Definition: qobjectdefs.h:227
The QRectF class defines a rectangle in the plane using floating point precision. ...
Definition: qrect.h:511
static bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
Creates a connection of the given type from the signal in the sender object to the method in the rece...
Definition: qobject.cpp:2580
QTextDocument * document() const
void setDefaultFont(const QFont &font)
Sets the default font to use in the document layout.
void setUndoRedoEnabled(bool enable)
The QLabel widget provides a text or image display.
Definition: qlabel.h:55
bool openExternalLinks
Definition: qlabel_p.h:140
void setFocus(bool focus, Qt::FocusReason=Qt::OtherFocusReason)
uint textLayoutDirty
Definition: qlabel_p.h:109
void setOpenExternalLinks(bool open)

◆ ensureTextLayouted()

void QLabelPrivate::ensureTextLayouted ( ) const

Definition at line 1650 of file qlabel.cpp.

Referenced by needTextControl().

1651 {
1652  if (!textLayoutDirty)
1653  return;
1655  if (control) {
1656  QTextDocument *doc = control->document();
1657  QTextOption opt = doc->defaultTextOption();
1658 
1659  opt.setAlignment(QFlag(this->align));
1660 
1661  if (this->align & Qt::TextWordWrap)
1663  else
1665 
1666  doc->setDefaultTextOption(opt);
1667 
1668  QTextFrameFormat fmt = doc->rootFrame()->frameFormat();
1669  fmt.setMargin(0);
1670  doc->rootFrame()->setFrameFormat(fmt);
1671  doc->setTextWidth(documentRect().width());
1672  }
1673  textLayoutDirty = false;
1674 }
ushort align
Definition: qlabel_p.h:106
QTextControl * control
Definition: qlabel_p.h:115
The QFlag class is a helper data type for QFlags.
Definition: qglobal.h:2289
void ensureTextPopulated() const
Definition: qlabel.cpp:1611
void setDefaultTextOption(const QTextOption &option)
Sets the default text option.
QTextFrame * rootFrame() const
Returns the document&#39;s root frame.
void setAlignment(Qt::Alignment alignment)
Sets the option&#39;s text alignment to the specified alignment.
Definition: qtextoption.h:148
QRect documentRect() const
Definition: qlabel.cpp:1587
QTextDocument * document() const
void setTextWidth(qreal width)
The QTextFrameFormat class provides formatting information for frames in a QTextDocument.
Definition: qtextformat.h:727
The QTextOption class provides a description of general rich text properties.
Definition: qtextoption.h:59
The QTextDocument class holds formatted text that can be viewed and edited using a QTextEdit...
void setMargin(qreal margin)
Sets the frame&#39;s margin in pixels.
void setWrapMode(WrapMode wrap)
Sets the option&#39;s text wrap mode to the given mode.
Definition: qtextoption.h:109
uint textLayoutDirty
Definition: qlabel_p.h:109
QTextOption defaultTextOption() const
the default text option will be set on all QTextLayout in the document.
void setFrameFormat(const QTextFrameFormat &format)
Sets the frame&#39;s format.
Definition: qtextobject.h:191
QTextFrameFormat frameFormat() const
Returns the frame&#39;s format.
Definition: qtextobject.h:131

◆ ensureTextPopulated()

void QLabelPrivate::ensureTextPopulated ( ) const

Definition at line 1611 of file qlabel.cpp.

Referenced by needTextControl().

1612 {
1613  if (!textDirty)
1614  return;
1615  if (control) {
1616  QTextDocument *doc = control->document();
1617  if (textDirty) {
1618 #ifndef QT_NO_TEXTHTMLPARSER
1619  if (isRichText)
1620  doc->setHtml(text);
1621  else
1622  doc->setPlainText(text);
1623 #else
1624  doc->setPlainText(text);
1625 #endif
1626  doc->setUndoRedoEnabled(false);
1627 
1628 #ifndef QT_NO_SHORTCUT
1629  if (hasShortcut) {
1630  // Underline the first character that follows an ampersand (and remove the others ampersands)
1631  int from = 0;
1632  bool found = false;
1634  while (!(cursor = control->document()->find((QLatin1String("&")), from)).isNull()) {
1635  cursor.deleteChar(); // remove the ampersand
1637  from = cursor.position();
1638  if (!found && cursor.selectedText() != QLatin1String("&")) { //not a second &
1639  found = true;
1641  }
1642  }
1643  }
1644 #endif
1645  }
1646  }
1647  textDirty = false;
1648 }
QString text
Definition: qlabel_p.h:87
QTextControl * control
Definition: qlabel_p.h:115
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
QString selectedText() const
Returns the current selection&#39;s text (which may be empty).
uint textDirty
Definition: qlabel_p.h:110
void setPlainText(const QString &text)
Replaces the entire contents of the document with the given plain text.
The QTextCursor class offers an API to access and modify QTextDocuments.
Definition: qtextcursor.h:70
void setHtml(const QString &html)
Replaces the entire contents of the document with the given HTML-formatted text in the html string...
QTextCursor shortcutCursor
Definition: qlabel_p.h:116
uint hasShortcut
Definition: qlabel_p.h:113
int position() const
Returns the absolute position of the cursor within the document.
QTextDocument * document() const
QCursor cursor
Definition: qlabel_p.h:145
QTextCursor find(const QString &subString, int from=0, FindFlags options=0) const
Finds the next occurrence of the string, subString, in the document.
uint isRichText
Definition: qlabel_p.h:111
void setUndoRedoEnabled(bool enable)
bool movePosition(MoveOperation op, MoveMode=MoveAnchor, int n=1)
Moves the cursor by performing the given operation n times, using the specified mode, and returns true if all operations were completed successfully; otherwise returns false.
The QTextDocument class holds formatted text that can be viewed and edited using a QTextEdit...
void deleteChar()
If there is no selected text, deletes the character at the current cursor position; otherwise deletes...
static bool isNull(const QVariant::Private *d)
Definition: qvariant.cpp:300

◆ init()

void QLabelPrivate::init ( )

Definition at line 292 of file qlabel.cpp.

Referenced by QLabelPrivate().

293 {
294  Q_Q(QLabel);
295 
296  valid_hints = false;
297  margin = 0;
298 #ifndef QT_NO_MOVIE
299  movie = 0;
300 #endif
301 #ifndef QT_NO_SHORTCUT
302  shortcutId = 0;
303 #endif
304  pixmap = 0;
305  scaledpixmap = 0;
306  cachedimage = 0;
307 #ifndef QT_NO_PICTURE
308  picture = 0;
309 #endif
311  indent = -1;
312  scaledcontents = false;
313  textLayoutDirty = false;
314  textDirty = false;
316  control = 0;
318  isRichText = false;
319  isTextLabel = false;
320 
323 
324 #ifndef QT_NO_CURSOR
325  validCursor = false;
326  onAnchor = false;
327 #endif
328 
329  openExternalLinks = false;
330 
332 }
ushort align
Definition: qlabel_p.h:106
uint isTextLabel
Definition: qlabel_p.h:112
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
uint onAnchor
Definition: qlabel_p.h:144
Qt::TextInteractionFlags textInteractionFlags
Definition: qlabel_p.h:117
void setLayoutItemMargins(int left, int top, int right, int bottom)
Definition: qwidget.cpp:12860
uint textDirty
Definition: qlabel_p.h:110
QPicture * picture
Definition: qlabel_p.h:92
#define Q_Q(Class)
Definition: qglobal.h:2483
QPixmap * pixmap
Definition: qlabel_p.h:88
uint validCursor
Definition: qlabel_p.h:143
Qt::TextFormat textformat
Definition: qlabel_p.h:114
int shortcutId
Definition: qlabel_p.h:104
uint isRichText
Definition: qlabel_p.h:111
The QLabel widget provides a text or image display.
Definition: qlabel.h:55
short indent
Definition: qlabel_p.h:107
bool openExternalLinks
Definition: qlabel_p.h:140
uint textLayoutDirty
Definition: qlabel_p.h:109
QPointer< QMovie > movie
Definition: qlabel_p.h:95

◆ layoutPoint()

QPoint QLabelPrivate::layoutPoint ( const QPoint p) const

Definition at line 1752 of file qlabel.cpp.

Referenced by needTextControl().

1753 {
1754  QRect lr = layoutRect().toRect();
1755  return p - lr.topLeft();
1756 }
QRectF layoutRect() const
Definition: qlabel.cpp:1735
QRect toRect() const
Returns a QRect based on the values of this rectangle.
Definition: qrect.h:845
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
QPoint topLeft() const
Returns the position of the rectangle&#39;s top-left corner.
Definition: qrect.h:288

◆ layoutRect()

QRectF QLabelPrivate::layoutRect ( ) const

Definition at line 1735 of file qlabel.cpp.

Referenced by needTextControl().

1736 {
1737  QRectF cr = documentRect();
1738  if (!control)
1739  return cr;
1741  // Caculate y position manually
1743  qreal yo = 0;
1744  if (align & Qt::AlignVCenter)
1745  yo = qMax((cr.height()-rh)/2, qreal(0));
1746  else if (align & Qt::AlignBottom)
1747  yo = qMax(cr.height()-rh, qreal(0));
1748  return QRectF(cr.x(), yo + cr.y(), cr.width(), cr.height());
1749 }
ushort align
Definition: qlabel_p.h:106
qreal y() const
Returns the y-coordinate of the rectangle&#39;s top edge.
Definition: qrect.h:667
double qreal
Definition: qglobal.h:1193
QTextControl * control
Definition: qlabel_p.h:115
qreal height() const
Returns the height.
Definition: qsize.h:287
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
Definition: qglobal.h:1217
The QRectF class defines a rectangle in the plane using floating point precision. ...
Definition: qrect.h:511
QRect documentRect() const
Definition: qlabel.cpp:1587
virtual QSizeF documentSize() const =0
Returns the total size of the document&#39;s layout.
qreal height() const
Returns the height of the rectangle.
Definition: qrect.h:710
void ensureTextLayouted() const
Definition: qlabel.cpp:1650
qreal width() const
Returns the width of the rectangle.
Definition: qrect.h:707
QTextDocument * document() const
qreal x() const
Returns the x-coordinate of the rectangle&#39;s left edge.
Definition: qrect.h:664
QAbstractTextDocumentLayout * documentLayout() const
Returns the document layout for this document.

◆ needTextControl()

bool QLabelPrivate::needTextControl ( ) const
inline

Definition at line 119 of file qlabel_p.h.

◆ sendControlEvent()

void QLabelPrivate::sendControlEvent ( QEvent e)

Definition at line 1700 of file qlabel.cpp.

Referenced by needTextControl().

1701 {
1702  Q_Q(QLabel);
1704  e->ignore();
1705  return;
1706  }
1707  control->processEvent(e, -layoutRect().topLeft(), q);
1708 }
uint isTextLabel
Definition: qlabel_p.h:112
QTextControl * control
Definition: qlabel_p.h:115
Qt::TextInteractionFlags textInteractionFlags
Definition: qlabel_p.h:117
virtual void processEvent(QEvent *e, const QMatrix &matrix, QWidget *contextWidget=0)
#define Q_Q(Class)
Definition: qglobal.h:2483
QRectF layoutRect() const
Definition: qlabel.cpp:1735
The QLabel widget provides a text or image display.
Definition: qlabel.h:55
void ignore()
Clears the accept flag parameter of the event object, the equivalent of calling setAccepted(false).
Definition: qcoreevent.h:310

◆ sizeForWidth()

QSize QLabelPrivate::sizeForWidth ( int  w) const

Returns the size that will be used if the width of the label is w.

If w is -1, the sizeHint() is returned. If w is 0 minimumSizeHint() is returned

Definition at line 667 of file qlabel.cpp.

Referenced by QLabelPrivate().

668 {
669  Q_Q(const QLabel);
670  if(q->minimumWidth() > 0)
671  w = qMax(w, q->minimumWidth());
672  QSize contentsMargin(leftmargin + rightmargin, topmargin + bottommargin);
673 
674  QRect br;
675 
676  int hextra = 2 * margin;
677  int vextra = hextra;
678  QFontMetrics fm = q->fontMetrics();
679 
680  if (pixmap && !pixmap->isNull())
681  br = pixmap->rect();
682 #ifndef QT_NO_PICTURE
683  else if (picture && !picture->isNull())
684  br = picture->boundingRect();
685 #endif
686 #ifndef QT_NO_MOVIE
687  else if (movie && !movie->currentPixmap().isNull())
688  br = movie->currentPixmap().rect();
689 #endif
690  else if (isTextLabel) {
691  int align = QStyle::visualAlignment(textDirection(), QFlag(this->align));
692  // Add indentation
693  int m = indent;
694 
695  if (m < 0 && q->frameWidth()) // no indent, but we do have a frame
696  m = fm.width(QLatin1Char('x')) - margin*2;
697  if (m > 0) {
698  if ((align & Qt::AlignLeft) || (align & Qt::AlignRight))
699  hextra += m;
700  if ((align & Qt::AlignTop) || (align & Qt::AlignBottom))
701  vextra += m;
702  }
703 
704  if (control) {
706  const qreal oldTextWidth = control->textWidth();
707  // Calculate the length of document if w is the width
708  if (align & Qt::TextWordWrap) {
709  if (w >= 0) {
710  w = qMax(w-hextra-contentsMargin.width(), 0); // strip margin and indent
711  control->setTextWidth(w);
712  } else {
713  control->adjustSize();
714  }
715  } else {
716  control->setTextWidth(-1);
717  }
718 
719  QSizeF controlSize = control->size();
720  br = QRect(QPoint(0, 0), QSize(qCeil(controlSize.width()), qCeil(controlSize.height())));
721 
722  // restore state
723  control->setTextWidth(oldTextWidth);
724  } else {
725  // Turn off center alignment in order to avoid rounding errors for centering,
726  // since centering involves a division by 2. At the end, all we want is the size.
727  int flags = align & ~(Qt::AlignVCenter | Qt::AlignHCenter);
728  if (hasShortcut) {
729  flags |= Qt::TextShowMnemonic;
730  QStyleOption opt;
731  opt.initFrom(q);
732  if (!q->style()->styleHint(QStyle::SH_UnderlineShortcut, &opt, q))
733  flags |= Qt::TextHideMnemonic;
734  }
735 
736  bool tryWidth = (w < 0) && (align & Qt::TextWordWrap);
737  if (tryWidth)
738 #ifdef Q_OS_SYMBIAN
739  w = qMin(S60->clientRect().Width(), q->maximumSize().width());
740 #else
741  w = qMin(fm.averageCharWidth() * 80, q->maximumSize().width());
742 #endif
743  else if (w < 0)
744  w = 2000;
745  w -= (hextra + contentsMargin.width());
746  br = fm.boundingRect(0, 0, w ,2000, flags, text);
747  if (tryWidth && br.height() < 4*fm.lineSpacing() && br.width() > w/2)
748  br = fm.boundingRect(0, 0, w/2, 2000, flags, text);
749  if (tryWidth && br.height() < 2*fm.lineSpacing() && br.width() > w/4)
750  br = fm.boundingRect(0, 0, w/4, 2000, flags, text);
751  }
752  } else {
753  br = QRect(QPoint(0, 0), QSize(fm.averageCharWidth(), fm.lineSpacing()));
754  }
755 
756  const QSize contentsSize(br.width() + hextra, br.height() + vextra);
757  return (contentsSize + contentsMargin).expandedTo(q->minimumSize());
758 }
QString text
Definition: qlabel_p.h:87
ushort align
Definition: qlabel_p.h:106
int width(const QString &, int len=-1) const
Returns the width in pixels of the first len characters of text.
double qreal
Definition: qglobal.h:1193
short rightmargin
Definition: qwidget_p.h:746
Q_DECL_CONSTEXPR const T & qMin(const T &a, const T &b)
Definition: qglobal.h:1215
The QFontMetrics class provides font metrics information.
Definition: qfontmetrics.h:65
uint isTextLabel
Definition: qlabel_p.h:112
QTextControl * control
Definition: qlabel_p.h:115
int qCeil(qreal v)
Definition: qmath.h:63
short topmargin
Definition: qwidget_p.h:745
QSizeF size() const
The QFlag class is a helper data type for QFlags.
Definition: qglobal.h:2289
qreal width() const
Returns the width.
Definition: qsize.h:284
qreal height() const
Returns the height.
Definition: qsize.h:287
QSize expandedTo(const QSize &) const
Returns a size holding the maximum width and height of this size and the given otherSize.
Definition: qsize.h:187
int width() const
Returns the width of the rectangle.
Definition: qrect.h:303
bool isNull() const
Returns true if the picture contains no data; otherwise returns false.
Definition: qpicture.cpp:215
int height() const
Returns the height of the rectangle.
Definition: qrect.h:306
The QSizeF class defines the size of a two-dimensional object using floating point precision...
Definition: qsize.h:202
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
Definition: qglobal.h:1217
QPicture * picture
Definition: qlabel_p.h:92
#define Q_Q(Class)
Definition: qglobal.h:2483
QRect boundingRect(QChar) const
Returns the rectangle that is covered by ink if character ch were to be drawn at the origin of the co...
QPixmap currentPixmap() const
Returns the current frame as a QPixmap.
Definition: qmovie.cpp:825
int averageCharWidth() const
Returns the average width of glyphs in the font.
qreal textWidth() const
short frameWidth
Definition: qframe_p.h:74
Qt::LayoutDirection textDirection() const
Definition: qlabel.cpp:1564
The QStyleOption class stores the parameters used by QStyle functions.
Definition: qstyleoption.h:67
void initFrom(const QWidget *w)
Definition: qstyleoption.h:99
QRect boundingRect() const
Returns the picture&#39;s bounding rectangle or an invalid rectangle if the picture contains no data...
Definition: qpicture.cpp:385
void ensureTextLayouted() const
Definition: qlabel.cpp:1650
short leftmargin
Definition: qwidget_p.h:744
uint hasShortcut
Definition: qlabel_p.h:113
QPixmap * pixmap
Definition: qlabel_p.h:88
static Qt::Alignment visualAlignment(Qt::LayoutDirection direction, Qt::Alignment alignment)
Transforms an alignment of Qt::AlignLeft or Qt::AlignRight without Qt::AlignAbsolute into Qt::AlignLe...
Definition: qstyle.cpp:2149
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
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
QRect rect() const
Returns the pixmap&#39;s enclosing rectangle.
Definition: qpixmap.cpp:676
int lineSpacing() const
Returns the distance from one base line to the next.
short bottommargin
Definition: qwidget_p.h:747
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53
void setTextWidth(qreal width)
bool isNull() const
Returns true if this is a null pixmap; otherwise returns false.
Definition: qpixmap.cpp:615
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
Definition: qchar.h:55
QPointer< QMovie > movie
Definition: qlabel_p.h:95

◆ textDirection()

Qt::LayoutDirection QLabelPrivate::textDirection ( ) const

Definition at line 1564 of file qlabel.cpp.

Referenced by needTextControl().

1565 {
1566  if (control) {
1568  return opt.textDirection();
1569  }
1570 
1572 }
QString text
Definition: qlabel_p.h:87
QTextControl * control
Definition: qlabel_p.h:115
bool isRightToLeft() const
Returns true if the string is read right to left.
Definition: qstring.cpp:7528
QTextDocument * document() const
Qt::LayoutDirection textDirection() const
Returns the direction of the text layout defined by the option.
Definition: qtextoption.h:100
The QTextOption class provides a description of general rich text properties.
Definition: qtextoption.h:59
QTextOption defaultTextOption() const
the default text option will be set on all QTextLayout in the document.

◆ updateLabel()

void QLabelPrivate::updateLabel ( )

Updates the label, but not the frame.

Definition at line 1253 of file qlabel.cpp.

Referenced by QLabelPrivate().

1254 {
1255  Q_Q(QLabel);
1256  valid_hints = false;
1257 
1258  if (isTextLabel) {
1259  QSizePolicy policy = q->sizePolicy();
1260  const bool wrap = align & Qt::TextWordWrap;
1261  policy.setHeightForWidth(wrap);
1262  if (policy != q->sizePolicy()) // ### should be replaced by WA_WState_OwnSizePolicy idiom
1263  q->setSizePolicy(policy);
1264  textLayoutDirty = true;
1265  }
1266  q->updateGeometry();
1267  q->update(q->contentsRect());
1268 }
ushort align
Definition: qlabel_p.h:106
uint isTextLabel
Definition: qlabel_p.h:112
bool valid_hints
Definition: qlabel_p.h:84
#define Q_Q(Class)
Definition: qglobal.h:2483
void setHeightForWidth(bool b)
Definition: qsizepolicy.h:135
The QLabel widget provides a text or image display.
Definition: qlabel.h:55
uint textLayoutDirty
Definition: qlabel_p.h:109

◆ updateShortcut()

void QLabelPrivate::updateShortcut ( )

Definition at line 1325 of file qlabel.cpp.

1326 {
1327  Q_Q(QLabel);
1328  Q_ASSERT(shortcutId == 0);
1329  // Introduce an extra boolean to indicate the presence of a shortcut in the
1330  // text. We cannot use the shortcutId itself because on the mac mnemonics are
1331  // off by default, so QKeySequence::mnemonic always returns an empty sequence.
1332  // But then we do want to hide the ampersands, so we can't use shortcutId.
1333  hasShortcut = false;
1334 
1335  if (!text.contains(QLatin1Char('&')))
1336  return;
1337  hasShortcut = true;
1338  shortcutId = q->grabShortcut(QKeySequence::mnemonic(text));
1339 }
QBool contains(QChar c, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Definition: qstring.h:904
QString text
Definition: qlabel_p.h:87
static QKeySequence mnemonic(const QString &text)
Returns the shortcut key sequence for the mnemonic in text, or an empty key sequence if no mnemonics ...
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
#define Q_Q(Class)
Definition: qglobal.h:2483
uint hasShortcut
Definition: qlabel_p.h:113
int shortcutId
Definition: qlabel_p.h:104
The QLabel widget provides a text or image display.
Definition: qlabel.h:55
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
Definition: qchar.h:55

Friends and Related Functions

◆ QMessageBoxPrivate

friend class QMessageBoxPrivate
friend

Definition at line 148 of file qlabel_p.h.

Properties

◆ align

ushort QLabelPrivate::align

Definition at line 106 of file qlabel_p.h.

◆ buddy

QPointer<QWidget> QLabelPrivate::buddy

Definition at line 103 of file qlabel_p.h.

◆ cachedimage

QImage* QLabelPrivate::cachedimage

Definition at line 90 of file qlabel_p.h.

◆ control

QTextControl* QLabelPrivate::control
mutable

Definition at line 115 of file qlabel_p.h.

◆ cursor

QCursor QLabelPrivate::cursor

Definition at line 145 of file qlabel_p.h.

◆ hasShortcut

uint QLabelPrivate::hasShortcut
mutable

Definition at line 113 of file qlabel_p.h.

◆ indent

short QLabelPrivate::indent

Definition at line 107 of file qlabel_p.h.

◆ isRichText

uint QLabelPrivate::isRichText
mutable

Definition at line 111 of file qlabel_p.h.

Referenced by needTextControl().

◆ isTextLabel

uint QLabelPrivate::isTextLabel
mutable

Definition at line 112 of file qlabel_p.h.

Referenced by needTextControl().

◆ margin

int QLabelPrivate::margin

Definition at line 86 of file qlabel_p.h.

◆ movie

QPointer<QMovie> QLabelPrivate::movie

Definition at line 95 of file qlabel_p.h.

◆ msh

QSize QLabelPrivate::msh
mutable

Definition at line 83 of file qlabel_p.h.

◆ onAnchor

uint QLabelPrivate::onAnchor

Definition at line 144 of file qlabel_p.h.

◆ openExternalLinks

bool QLabelPrivate::openExternalLinks

Definition at line 140 of file qlabel_p.h.

◆ picture

QPicture* QLabelPrivate::picture

Definition at line 92 of file qlabel_p.h.

◆ pixmap

QPixmap* QLabelPrivate::pixmap

Definition at line 88 of file qlabel_p.h.

◆ scaledcontents

uint QLabelPrivate::scaledcontents

Definition at line 108 of file qlabel_p.h.

◆ scaledpixmap

QPixmap* QLabelPrivate::scaledpixmap

Definition at line 89 of file qlabel_p.h.

◆ sh

QSize QLabelPrivate::sh
mutable

Definition at line 82 of file qlabel_p.h.

◆ shortcutCursor

QTextCursor QLabelPrivate::shortcutCursor
mutable

Definition at line 116 of file qlabel_p.h.

◆ shortcutId

int QLabelPrivate::shortcutId

Definition at line 104 of file qlabel_p.h.

◆ sizePolicy

QSizePolicy QLabelPrivate::sizePolicy
mutable

Definition at line 85 of file qlabel_p.h.

◆ text

QString QLabelPrivate::text

Definition at line 87 of file qlabel_p.h.

◆ textDirty

uint QLabelPrivate::textDirty
mutable

Definition at line 110 of file qlabel_p.h.

◆ textformat

Qt::TextFormat QLabelPrivate::textformat

Definition at line 114 of file qlabel_p.h.

◆ textInteractionFlags

Qt::TextInteractionFlags QLabelPrivate::textInteractionFlags

Definition at line 117 of file qlabel_p.h.

◆ textLayoutDirty

uint QLabelPrivate::textLayoutDirty
mutable

Definition at line 109 of file qlabel_p.h.

◆ valid_hints

bool QLabelPrivate::valid_hints
mutable

Definition at line 84 of file qlabel_p.h.

◆ validCursor

uint QLabelPrivate::validCursor

Definition at line 143 of file qlabel_p.h.


The documentation for this class was generated from the following files: