VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox/src/extensions/QIRichTextLabel.h

Last change on this file was 106061, checked in by vboxsync, 3 weeks ago

Copyright year updates by scm.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.5 KB
Line 
1/* $Id: QIRichTextLabel.h 106061 2024-09-16 14:03:52Z vboxsync $ */
2/** @file
3 * VBox Qt GUI - Qt extensions: QIRichTextLabel class declaration.
4 */
5
6/*
7 * Copyright (C) 2012-2024 Oracle and/or its affiliates.
8 *
9 * This file is part of VirtualBox base platform packages, as
10 * available from https://www.virtualbox.org.
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation, in version 3 of the
15 * License.
16 *
17 * This program is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, see <https://www.gnu.org/licenses>.
24 *
25 * SPDX-License-Identifier: GPL-3.0-only
26 */
27
28#ifndef FEQT_INCLUDED_SRC_extensions_QIRichTextLabel_h
29#define FEQT_INCLUDED_SRC_extensions_QIRichTextLabel_h
30#ifndef RT_WITHOUT_PRAGMA_ONCE
31# pragma once
32#endif
33
34/* Qt includes: */
35#include <QTextBrowser>
36
37/* GUI includes: */
38#include "UILibraryDefs.h"
39
40/* Forward declarations: */
41class QAction;
42
43/** QLabel analog to reflect rich-text,
44 ** based on private QTextBrowser functionality. */
45class SHARED_LIBRARY_STUFF QIRichTextLabel : public QWidget
46{
47 Q_OBJECT;
48 Q_PROPERTY(QString text READ text WRITE setText);
49
50signals:
51
52 /** Notifies listeners about @a link clicked. */
53 void sigLinkClicked(const QUrl &link);
54
55public:
56
57 /** Constructs rich text-label passing @a pParent to the base-class. */
58 QIRichTextLabel(QWidget *pParent = 0);
59
60 /** Returns text. */
61 QString text() const;
62 /** Returns plain text. */
63 QString plainText() const;
64
65 /** Registers @a image under a passed @a strName. */
66 void registerImage(const QImage &image, const QString &strName);
67 /** Registers @a pixmap under a passed @a strName. */
68 void registerPixmap(const QPixmap &pixmap, const QString &strName);
69
70 /** Returns word wrapping policy. */
71 QTextOption::WrapMode wordWrapMode() const;
72 /** Defines word wrapping @a policy. */
73 void setWordWrapMode(QTextOption::WrapMode policy);
74
75 /** Installs event filter for a passed @ pFilterObj. */
76 void installEventFilter(QObject *pFilterObj);
77
78 /** Returns browser font. */
79 QFont browserFont() const;
80 /** Defines @a newFont for browser. */
81 void setBrowserFont(const QFont &newFont);
82
83public slots:
84
85 /** Returns minimum text width. */
86 int minimumTextWidth() const;
87 /** Defines @a iMinimumTextWidth. */
88 void setMinimumTextWidth(int iMinimumTextWidth);
89
90 /** Defines @a strText. */
91 void setText(const QString &strText);
92
93 /** Copies text-browser text into clipboard. */
94 void copy();
95
96private slots:
97
98 /** Handles the fact of text-browser text copy available.
99 * @param fYes Brings whether some text is selected and can
100 * be copied directly by QTextBrowser::copy() call. */
101 void sltHandleCopyAvailable(bool fYes) { m_fCopyAvailable = fYes; }
102 /** Handles translation event. */
103 void sltRetranslateUI();
104
105private:
106
107 /** Holds the text-browser instance. */
108 QTextBrowser *m_pTextBrowser;
109
110 /** Holds the context-menu Copy action instance. */
111 QAction *m_pActionCopy;
112 /** Holds whether text-browser text copy is available. */
113 bool m_fCopyAvailable;
114
115 /** Holds the minimum text-width. */
116 int m_iMinimumTextWidth;
117};
118
119#endif /* !FEQT_INCLUDED_SRC_extensions_QIRichTextLabel_h */
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette