diff options
author | David Faure <faure@kde.org> | 2010-02-02 13:29:11 (GMT) |
---|---|---|
committer | Leonardo Sobral Cunha <leo.cunha@nokia.com> | 2010-02-02 13:29:11 (GMT) |
commit | 42e181a6feba241997b041a2a58903f308264559 (patch) | |
tree | d6b0994ce1f73957f0cfea310e21b8ed1ad1ab8c /src/gui/widgets/qlabel.h | |
parent | e9b0c9a1d25a2260bd7c0e7ead840cacb31ce424 (diff) | |
download | Qt-42e181a6feba241997b041a2a58903f308264559.zip Qt-42e181a6feba241997b041a2a58903f308264559.tar.gz Qt-42e181a6feba241997b041a2a58903f308264559.tar.bz2 |
QLabel: add setSelection, hasSelectedText, selectedText, selectionStart.
When using TextSelectableByMouse or TextSelectableByKeyboard, this
allows to programmatically control the selection. Needed in KDE's
KSqueezedTextLabel, so that mouseReleaseEvent can get the selection
and copy the un-squeezed text instead of the squeezed one.
Merge-request: 454
Reviewed-by: Leonardo Sobral Cunha <leo.cunha@nokia.com>
Diffstat (limited to 'src/gui/widgets/qlabel.h')
-rw-r--r-- | src/gui/widgets/qlabel.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/gui/widgets/qlabel.h b/src/gui/widgets/qlabel.h index d916078..54babb1 100644 --- a/src/gui/widgets/qlabel.h +++ b/src/gui/widgets/qlabel.h @@ -65,6 +65,8 @@ class Q_GUI_EXPORT QLabel : public QFrame Q_PROPERTY(int indent READ indent WRITE setIndent) Q_PROPERTY(bool openExternalLinks READ openExternalLinks WRITE setOpenExternalLinks) Q_PROPERTY(Qt::TextInteractionFlags textInteractionFlags READ textInteractionFlags WRITE setTextInteractionFlags) + Q_PROPERTY(bool hasSelectedText READ hasSelectedText) + Q_PROPERTY(QString selectedText READ selectedText) public: explicit QLabel(QWidget *parent=0, Qt::WindowFlags f=0); @@ -111,6 +113,11 @@ public: void setTextInteractionFlags(Qt::TextInteractionFlags flags); Qt::TextInteractionFlags textInteractionFlags() const; + void setSelection(int, int); + bool hasSelectedText() const; + QString selectedText() const; + int selectionStart() const; + public Q_SLOTS: void setText(const QString &); void setPixmap(const QPixmap &); |