Changeset 50846 in vbox
- Timestamp:
- Mar 21, 2014 4:08:02 PM (11 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/widgets/graphics
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/widgets/graphics/UIGraphicsTextPane.cpp
r50845 r50846 30 30 , m_iSpacing(10) 31 31 , m_iMinimumTextColumnWidth(100) 32 , m_fMinimumSizeHintInvalidated(true) 32 33 , m_iMinimumTextWidth(0) 33 34 , m_iMinimumTextHeight(0) … … 63 64 } 64 65 65 /* Update minimum textsize-hint: */66 /* Update minimum size-hint: */ 66 67 updateMinimumTextWidthHint(); 67 68 updateMinimumTextHeightHint(); 69 updateGeometry(); 68 70 } 69 71 70 72 void UIGraphicsTextPane::updateGeometry() 71 73 { 74 /* Discard cached minimum size-hint: */ 75 m_fMinimumSizeHintInvalidated = true; 76 72 77 /* Call to base-class to notify layout if any: */ 73 78 QIGraphicsWidget::updateGeometry(); … … 121 126 /* Remember new value: */ 122 127 m_iMinimumTextWidth = iMinimumTextWidth; 123 124 /* Notify listeners: */125 updateGeometry();126 128 } 127 129 … … 198 200 /* Remember new value: */ 199 201 m_iMinimumTextHeight = iMinimumTextHeight; 200 201 /* Notify listeners: */ 202 } 203 204 QSizeF UIGraphicsTextPane::sizeHint(Qt::SizeHint which, const QSizeF &constraint /* = QSizeF() */) const 205 { 206 /* For minimum size-hint: */ 207 if (which == Qt::MinimumSize) 208 { 209 /* If minimum size-hint invalidated: */ 210 if (m_fMinimumSizeHintInvalidated) 211 { 212 /* Recache minimum size-hint: */ 213 m_minimumSizeHint = QSizeF(2 * m_iMargin + m_iMinimumTextWidth, 214 2 * m_iMargin + m_iMinimumTextHeight); 215 m_fMinimumSizeHintInvalidated = false; 216 } 217 /* Return cached minimum size-hint: */ 218 return m_minimumSizeHint; 219 } 220 /* Call to base-class for other size-hints: */ 221 return QIGraphicsWidget::sizeHint(which, constraint); 222 } 223 224 void UIGraphicsTextPane::resizeEvent(QGraphicsSceneResizeEvent*) 225 { 226 /* Update minimum height-hint: */ 227 updateMinimumTextHeightHint(); 202 228 updateGeometry(); 203 }204 205 QSizeF UIGraphicsTextPane::sizeHint(Qt::SizeHint which, const QSizeF &constraint /* = QSizeF() */) const206 {207 /* Calculate minimum size-hint: */208 if (which == Qt::MinimumSize)209 {210 int iWidth = 2 * m_iMargin + m_iMinimumTextWidth;211 int iHeight = 2 * m_iMargin + m_iMinimumTextHeight;212 return QSize(iWidth, iHeight);213 }214 /* Call to base-class: */215 return QIGraphicsWidget::sizeHint(which, constraint);216 }217 218 void UIGraphicsTextPane::resizeEvent(QGraphicsSceneResizeEvent*)219 {220 /* Update minimum text height-hint: */221 updateMinimumTextHeightHint();222 229 } 223 230 -
trunk/src/VBox/Frontends/VirtualBox/src/widgets/graphics/UIGraphicsTextPane.h
r50845 r50846 82 82 const int m_iMinimumTextColumnWidth; 83 83 84 /** Minimum size-hint invalidation flag. */ 85 mutable bool m_fMinimumSizeHintInvalidated; 86 /** Minimum size-hint cache. */ 87 mutable QSizeF m_minimumSizeHint; 84 88 /** Minimum text-width. */ 85 89 int m_iMinimumTextWidth;
Note:
See TracChangeset
for help on using the changeset viewer.