Warning, file /include/QtWidgets/qlabel.h was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004 #ifndef QLABEL_H
0005 #define QLABEL_H
0006
0007 #include <QtWidgets/qtwidgetsglobal.h>
0008 #include <QtWidgets/qframe.h>
0009 #include <QtGui/qpicture.h>
0010 #include <QtGui/qtextdocument.h>
0011
0012 QT_REQUIRE_CONFIG(label);
0013
0014 QT_BEGIN_NAMESPACE
0015
0016
0017 class QLabelPrivate;
0018
0019 class Q_WIDGETS_EXPORT QLabel : public QFrame
0020 {
0021 Q_OBJECT
0022 Q_PROPERTY(QString text READ text WRITE setText)
0023 Q_PROPERTY(Qt::TextFormat textFormat READ textFormat WRITE setTextFormat)
0024 Q_PROPERTY(QPixmap pixmap READ pixmap WRITE setPixmap)
0025 Q_PROPERTY(bool scaledContents READ hasScaledContents WRITE setScaledContents)
0026 Q_PROPERTY(Qt::Alignment alignment READ alignment WRITE setAlignment)
0027 Q_PROPERTY(bool wordWrap READ wordWrap WRITE setWordWrap)
0028 Q_PROPERTY(int margin READ margin WRITE setMargin)
0029 Q_PROPERTY(int indent READ indent WRITE setIndent)
0030 Q_PROPERTY(bool openExternalLinks READ openExternalLinks WRITE setOpenExternalLinks)
0031 Q_PROPERTY(Qt::TextInteractionFlags textInteractionFlags READ textInteractionFlags
0032 WRITE setTextInteractionFlags)
0033 Q_PROPERTY(bool hasSelectedText READ hasSelectedText)
0034 Q_PROPERTY(QString selectedText READ selectedText)
0035
0036 public:
0037 explicit QLabel(QWidget *parent=nullptr, Qt::WindowFlags f=Qt::WindowFlags());
0038 explicit QLabel(const QString &text, QWidget *parent=nullptr, Qt::WindowFlags f=Qt::WindowFlags());
0039 ~QLabel();
0040
0041 QString text() const;
0042
0043 #if QT_DEPRECATED_SINCE(6,6)
0044 QPixmap pixmap(Qt::ReturnByValueConstant) const { return pixmap(); }
0045 #endif
0046 QPixmap pixmap() const;
0047
0048 #ifndef QT_NO_PICTURE
0049 #if QT_DEPRECATED_SINCE(6,6)
0050 QPicture picture(Qt::ReturnByValueConstant) const { return picture(); }
0051 #endif
0052 QPicture picture() const;
0053 #endif
0054 #if QT_CONFIG(movie)
0055 QMovie *movie() const;
0056 #endif
0057
0058 Qt::TextFormat textFormat() const;
0059 void setTextFormat(Qt::TextFormat);
0060
0061 QTextDocument::ResourceProvider resourceProvider() const;
0062 void setResourceProvider(const QTextDocument::ResourceProvider &provider);
0063
0064 Qt::Alignment alignment() const;
0065 void setAlignment(Qt::Alignment);
0066
0067 void setWordWrap(bool on);
0068 bool wordWrap() const;
0069
0070 int indent() const;
0071 void setIndent(int);
0072
0073 int margin() const;
0074 void setMargin(int);
0075
0076 bool hasScaledContents() const;
0077 void setScaledContents(bool);
0078 QSize sizeHint() const override;
0079 QSize minimumSizeHint() const override;
0080 #ifndef QT_NO_SHORTCUT
0081 void setBuddy(QWidget *);
0082 QWidget *buddy() const;
0083 #endif
0084 int heightForWidth(int) const override;
0085
0086 bool openExternalLinks() const;
0087 void setOpenExternalLinks(bool open);
0088
0089 void setTextInteractionFlags(Qt::TextInteractionFlags flags);
0090 Qt::TextInteractionFlags textInteractionFlags() const;
0091
0092 void setSelection(int, int);
0093 bool hasSelectedText() const;
0094 QString selectedText() const;
0095 int selectionStart() const;
0096
0097 public Q_SLOTS:
0098 void setText(const QString &);
0099 void setPixmap(const QPixmap &);
0100 #ifndef QT_NO_PICTURE
0101 void setPicture(const QPicture &);
0102 #endif
0103 #if QT_CONFIG(movie)
0104 void setMovie(QMovie *movie);
0105 #endif
0106 void setNum(int);
0107 void setNum(double);
0108 void clear();
0109
0110 Q_SIGNALS:
0111 void linkActivated(const QString& link);
0112 void linkHovered(const QString& link);
0113
0114 protected:
0115 bool event(QEvent *e) override;
0116 void keyPressEvent(QKeyEvent *ev) override;
0117 void paintEvent(QPaintEvent *) override;
0118 void changeEvent(QEvent *) override;
0119 void mousePressEvent(QMouseEvent *ev) override;
0120 void mouseMoveEvent(QMouseEvent *ev) override;
0121 void mouseReleaseEvent(QMouseEvent *ev) override;
0122 #ifndef QT_NO_CONTEXTMENU
0123 void contextMenuEvent(QContextMenuEvent *ev) override;
0124 #endif
0125 void focusInEvent(QFocusEvent *ev) override;
0126 void focusOutEvent(QFocusEvent *ev) override;
0127 bool focusNextPrevChild(bool next) override;
0128
0129
0130 private:
0131 Q_DISABLE_COPY(QLabel)
0132 Q_DECLARE_PRIVATE(QLabel)
0133 friend class QTipLabel;
0134 friend class QMessageBoxPrivate;
0135 friend class QBalloonTip;
0136 };
0137
0138 QT_END_NAMESPACE
0139
0140 #endif