Changeset 63767 in vbox
- Timestamp:
- Sep 8, 2016 1:57:48 PM (8 years ago)
- svn:sync-xref-src-repo-rev:
- 110581
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetailsElement.cpp
r63764 r63767 119 119 } 120 120 121 UITextTable &UIGDetailsElement::text() const 122 { 123 /* Retrieve text from text-pane: */ 124 return m_pTextPane->text(); 125 } 126 127 void UIGDetailsElement::setText(const UITextTable &text) 128 { 129 /* Pass text to text-pane: */ 130 m_pTextPane->setText(text); 131 } 132 121 133 void UIGDetailsElement::sltToggleButtonClicked() 122 134 { … … 265 277 updateMinimumHeaderWidth(); 266 278 updateMinimumHeaderHeight(); 267 }268 269 const UITextTable& UIGDetailsElement::text() const270 {271 /* Retrieve text from text-pane: */272 return m_pTextPane->text();273 }274 275 void UIGDetailsElement::setText(const UITextTable &text)276 {277 /* Pass text to text-pane: */278 m_pTextPane->setText(text);279 279 } 280 280 -
trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetailsElement.h
r63764 r63767 34 34 class QStateMachine; 35 35 class QPropertyAnimation; 36 class UITextTableLine; 36 37 37 38 /* Typedefs: */ 38 typedef QPair<QString, QString> UITextTableLine;39 39 typedef QList<UITextTableLine> UITextTable; 40 40 41 41 42 /* Details element … … 84 85 /* API: Animation stuff: */ 85 86 void markAnimationFinished(); 87 88 /** Returns the reference to the text table. */ 89 UITextTable &text() const; 90 /** Defines the @a text table as the passed one. */ 91 void setText(const UITextTable &text); 86 92 87 93 protected slots: … … 130 136 /* API: Name stuff: */ 131 137 void setName(const QString &strName); 132 133 /* API: Text stuff: */134 const UITextTable& text() const;135 void setText(const UITextTable &text);136 138 137 139 /* API: Machine stuff: */ -
trunk/src/VBox/Frontends/VirtualBox/src/widgets/graphics/UIGraphicsTextPane.cpp
r62493 r63767 64 64 { 65 65 /* Lines: */ 66 QString strLeftLine = line. first;67 QString strRightLine = line.s econd;66 QString strLeftLine = line.string1(); 67 QString strRightLine = line.string2(); 68 68 69 69 /* If 2nd line is NOT empty: */ … … 71 71 { 72 72 /* Take both lines 'as is': */ 73 m_text << UITextTableLine(strLeftLine, strRightLine );73 m_text << UITextTableLine(strLeftLine, strRightLine, parent()); 74 74 } 75 75 /* If 2nd line is empty: */ … … 79 79 QStringList subLines = strLeftLine.split(QRegExp("\\n")); 80 80 foreach (const QString &strSubLine, subLines) 81 m_text << UITextTableLine(strSubLine, QString() );81 m_text << UITextTableLine(strSubLine, QString(), parent()); 82 82 } 83 83 } … … 120 120 foreach (const UITextTableLine &line, m_text) 121 121 { 122 bool fRightColumnPresent = !line.s econd.isEmpty();122 bool fRightColumnPresent = !line.string2().isEmpty(); 123 123 if (fRightColumnPresent) 124 124 fSingleColumnText = false; 125 QString strLeftLine = fRightColumnPresent ? line. first + ":" : line.first;126 QString strRightLine = line.s econd;125 QString strLeftLine = fRightColumnPresent ? line.string1() + ":" : line.string1(); 126 QString strRightLine = line.string2(); 127 127 iMaximumLeftColumnWidth = qMax(iMaximumLeftColumnWidth, fm.width(strLeftLine)); 128 128 iMaximumRightColumnWidth = qMax(iMaximumRightColumnWidth, fm.width(strRightLine)); … … 182 182 /* Left layout: */ 183 183 int iLeftColumnHeight = 0; 184 if (!line. first.isEmpty())185 { 186 bool fRightColumnPresent = !line.s econd.isEmpty();184 if (!line.string1().isEmpty()) 185 { 186 bool fRightColumnPresent = !line.string2().isEmpty(); 187 187 m_leftList << buildTextLayout(font(), m_pPaintDevice, 188 fRightColumnPresent ? line. first + ":" : line.first,188 fRightColumnPresent ? line.string1() + ":" : line.string1(), 189 189 iLeftColumnWidth, iLeftColumnHeight, 190 190 m_strHoveredAnchor); … … 194 194 /* Right layout: */ 195 195 int iRightColumnHeight = 0; 196 if (!line.s econd.isEmpty())196 if (!line.string2().isEmpty()) 197 197 { 198 198 m_rightList << buildTextLayout(font(), m_pPaintDevice, 199 line.s econd,199 line.string2(), 200 200 iRightColumnWidth, iRightColumnHeight, 201 201 m_strHoveredAnchor); -
trunk/src/VBox/Frontends/VirtualBox/src/widgets/graphics/UIGraphicsTextPane.h
r62493 r63767 25 25 class QTextLayout; 26 26 27 /* Typedefs: */ 28 typedef QPair<QString, QString> UITextTableLine; 27 28 /** QObject extension used as an 29 * accessible wrapper for QString pairs. */ 30 class UITextTableLine : public QObject 31 { 32 Q_OBJECT; 33 34 public: 35 36 /** Constructs text-table line passing @a pParent to the base-class. 37 * @param str1 Brings the 1st table string. 38 * @param str2 Brings the 2nd table string. */ 39 UITextTableLine(const QString &str1, const QString &str2, QObject *pParent = 0) 40 : QObject(pParent) 41 , m_str1(str1) 42 , m_str2(str2) 43 {} 44 45 /** Constructs text-table line on the basis of passed @a other. */ 46 UITextTableLine(const UITextTableLine &other) 47 : QObject(other.parent()) 48 , m_str1(other.string1()) 49 , m_str2(other.string2()) 50 {} 51 52 /** Assigns @a other to this. */ 53 UITextTableLine &operator=(const UITextTableLine &other) 54 { 55 setParent(other.parent()); 56 set1(other.string1()); 57 set2(other.string2()); 58 return *this; 59 } 60 61 /** Compares @a other to this. */ 62 bool operator==(const UITextTableLine &other) const 63 { 64 return string1() == other.string1() 65 && string2() == other.string2(); 66 } 67 68 /** Defines 1st table @a strString. */ 69 void set1(const QString &strString) { m_str1 = strString; } 70 /** Returns 1st table string. */ 71 const QString &string1() const { return m_str1; } 72 73 /** Defines 2nd table @a strString. */ 74 void set2(const QString &strString) { m_str2 = strString; } 75 /** Returns 2nd table string. */ 76 const QString &string2() const { return m_str2; } 77 78 private: 79 80 /** Holds the 1st table string. */ 81 QString m_str1; 82 /** Holds the 2nd table string. */ 83 QString m_str2; 84 }; 85 86 /** Defines the list of UITextTableLine instances. */ 29 87 typedef QList<UITextTableLine> UITextTable; 30 88 Q_DECLARE_METATYPE(UITextTable); 89 31 90 32 91 /** QIGraphicsWidget reimplementation to draw QTextLayout content. */ … … 53 112 bool isEmpty() const { return m_text.isEmpty(); } 54 113 /** Returns contained text. */ 55 const UITextTable& text() const{ return m_text; }114 UITextTable &text() { return m_text; } 56 115 /** Defines contained text. */ 57 116 void setText(const UITextTable &text);
Note:
See TracChangeset
for help on using the changeset viewer.