Changeset 95661 in vbox
- Timestamp:
- Jul 15, 2022 11:06:18 AM (2 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/extensions/QIRichTextLabel.cpp
r93995 r95661 17 17 18 18 /* Qt includes: */ 19 #include <QAccessibleWidget> 19 20 #include <QtMath> 20 21 #include <QUrl> … … 24 25 #include "QIRichTextLabel.h" 25 26 27 /* Other VBox includes: */ 28 #include "iprt/assert.h" 29 30 /* Forward declarations: */ 31 class QIRichTextLabel; 32 33 34 /** QAccessibleObject extension used as an accessibility interface for QIRichTextLabel. */ 35 class UIAccessibilityInterfaceForQIRichTextLabel : public QAccessibleWidget 36 { 37 public: 38 39 /** Returns an accessibility interface for passed @a strClassname and @a pObject. */ 40 static QAccessibleInterface *pFactory(const QString &strClassname, QObject *pObject) 41 { 42 /* Creating QIRichTextLabel accessibility interface: */ 43 if (pObject && strClassname == QLatin1String("QIRichTextLabel")) 44 return new UIAccessibilityInterfaceForQIRichTextLabel(qobject_cast<QWidget*>(pObject)); 45 46 /* Null by default: */ 47 return 0; 48 } 49 50 /** Constructs an accessibility interface passing @a pWidget to the base-class. */ 51 UIAccessibilityInterfaceForQIRichTextLabel(QWidget *pWidget) 52 : QAccessibleWidget(pWidget, QAccessible::StaticText) 53 {} 54 55 /** Returns a text for the passed @a enmTextRole. */ 56 virtual QString text(QAccessible::Text enmTextRole) const RT_OVERRIDE; 57 58 private: 59 60 /** Returns corresponding QIRichTextLabel. */ 61 QIRichTextLabel *label() const; 62 }; 63 64 65 /********************************************************************************************************************************* 66 * Class UIAccessibilityInterfaceForQIRichTextLabel implementation. * 67 *********************************************************************************************************************************/ 68 69 QString UIAccessibilityInterfaceForQIRichTextLabel::text(QAccessible::Text enmTextRole) const 70 { 71 /* Make sure label still alive: */ 72 AssertPtrReturn(label(), QString()); 73 74 /* Return the description: */ 75 if (enmTextRole == QAccessible::Description) 76 return label()->plainText(); 77 78 /* Null-string by default: */ 79 return QString(); 80 } 81 82 QIRichTextLabel *UIAccessibilityInterfaceForQIRichTextLabel::label() const 83 { 84 return qobject_cast<QIRichTextLabel*>(widget()); 85 } 86 87 88 /********************************************************************************************************************************* 89 * Class QIRichTextLabel implementation. * 90 *********************************************************************************************************************************/ 26 91 27 92 QIRichTextLabel::QIRichTextLabel(QWidget *pParent) … … 30 95 , m_iMinimumTextWidth(0) 31 96 { 97 /* Install QIRichTextLabel accessibility interface factory: */ 98 QAccessible::installFactory(UIAccessibilityInterfaceForQIRichTextLabel::pFactory); 99 32 100 /* Configure self: */ 33 101 setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed); … … 74 142 } 75 143 144 QString QIRichTextLabel::plainText() const 145 { 146 return m_pTextBrowser->toPlainText(); 147 } 148 76 149 void QIRichTextLabel::registerImage(const QImage &image, const QString &strName) 77 150 { -
trunk/src/VBox/Frontends/VirtualBox/src/extensions/QIRichTextLabel.h
r93115 r95661 47 47 /** Returns text. */ 48 48 QString text() const; 49 /** Returns plain text. */ 50 QString plainText() const; 49 51 50 52 /** Registers @a image under a passed @a strName. */ -
trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialog.cpp
r94064 r95661 590 590 591 591 if (pWhatsThisWidget && !strWhatsThisText.isEmpty()) 592 pWhatsThisWidget->setToolTip( QString("<qt>%1</qt>").arg(strWhatsThisText));592 pWhatsThisWidget->setToolTip(strWhatsThisText); 593 593 } 594 594
Note:
See TracChangeset
for help on using the changeset viewer.