Changeset 79842 in vbox
- Timestamp:
- Jul 17, 2019 4:51:51 PM (5 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/manager/details
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/manager/details/UIDetails.cpp
r79461 r79842 65 65 pMainLayout->addWidget(m_pDetailsView); 66 66 } 67 68 /* Init model: */ 69 m_pDetailsModel->init(); 67 70 } 68 71 } … … 77 80 connect(m_pDetailsModel, &UIDetailsModel::sigRootItemMinimumWidthHintChanged, 78 81 m_pDetailsView, &UIDetailsView::sltMinimumWidthHintChanged); 79 connect(m_pDetailsModel, &UIDetailsModel::sigRootItemMinimumHeightHintChanged,80 m_pDetailsView, &UIDetailsView::sltMinimumHeightHintChanged);81 82 connect(m_pDetailsModel, &UIDetailsModel::sigLinkClicked, 82 83 this, &UIDetails::sigLinkClicked); -
trunk/src/VBox/Frontends/VirtualBox/src/manager/details/UIDetailsGroup.cpp
r79841 r79842 24 24 25 25 /* GUI includes: */ 26 #include "UIGraphicsScrollArea.h" 26 27 #include "UIDetailsGroup.h" 27 28 #include "UIDetailsModel.h" … … 36 37 : UIDetailsItem(0) 37 38 , m_pBuildStep(0) 39 , m_pScrollArea(0) 38 40 , m_pContainer(0) 39 41 , m_pLayout(0) 40 42 , m_iPreviousMinimumWidthHint(0) 41 , m_iPreviousMinimumHeightHint(0) 42 { 43 /* Prepare container: */ 44 m_pContainer = new QIGraphicsWidget(this); 45 if (m_pContainer) 46 { 47 /* Prepare layout: */ 48 m_pLayout = new QGraphicsLinearLayout(Qt::Vertical, m_pContainer); 49 if (m_pLayout) 43 { 44 /* Prepare scroll-area: */ 45 m_pScrollArea = new UIGraphicsScrollArea(Qt::Vertical, this); 46 if (m_pScrollArea) 47 { 48 /* Prepare container: */ 49 m_pContainer = new QIGraphicsWidget; 50 if (m_pContainer) 50 51 { 51 m_pLayout->setContentsMargins(0, 0, 0, 0); 52 m_pLayout->setSpacing(0); 52 /* Prepare layout: */ 53 m_pLayout = new QGraphicsLinearLayout(Qt::Vertical, m_pContainer); 54 if (m_pLayout) 55 { 56 m_pLayout->setContentsMargins(0, 0, 0, 0); 57 m_pLayout->setSpacing(0); 58 } 59 60 /* Assign to scroll-area: */ 61 m_pScrollArea->setViewport(m_pContainer); 53 62 } 54 63 } … … 102 111 } 103 112 113 void UIDetailsGroup::installEventFilterHelper(QObject *pSource) 114 { 115 /* The only object which need's that filter for now is scroll-area: */ 116 pSource->installEventFilter(m_pScrollArea); 117 } 118 104 119 QList<UIDetailsItem*> UIDetailsGroup::items(UIDetailsItemType enmType /* = UIDetailsItemType_Set */) const 105 120 { … … 118 133 UIDetailsView *pView = model()->view(); 119 134 120 /* Adjust children container geometry: */121 m_p Container->resize(pView->viewport()->size());122 m_p Container->setPos(0, 0);135 /* Adjust children scroll-area: */ 136 m_pScrollArea->resize(pView->size()); 137 m_pScrollArea->setPos(0, 0); 123 138 124 139 /* Layout all the sets: */ … … 242 257 emit sigMinimumWidthHintChanged(m_iPreviousMinimumWidthHint); 243 258 } 244 /* Group-item should notify details-view if minimum-height-hint was changed: */245 int iMinimumHeightHint = minimumHeightHint();246 if (m_iPreviousMinimumHeightHint != iMinimumHeightHint)247 {248 /* Save new minimum-height-hint, notify listener: */249 m_iPreviousMinimumHeightHint = iMinimumHeightHint;250 emit sigMinimumHeightHintChanged(m_iPreviousMinimumHeightHint);251 }252 259 } 253 260 … … 257 264 connect(this, SIGNAL(sigMinimumWidthHintChanged(int)), 258 265 model(), SIGNAL(sigRootItemMinimumWidthHintChanged(int))); 259 connect(this, SIGNAL(sigMinimumHeightHintChanged(int)),260 model(), SIGNAL(sigRootItemMinimumHeightHintChanged(int)));261 266 } 262 267 -
trunk/src/VBox/Frontends/VirtualBox/src/manager/details/UIDetailsGroup.h
r79841 r79842 28 28 class QGraphicsLinearLayout; 29 29 class QGraphicsScene; 30 class UIGraphicsScrollArea; 30 31 class UIVirtualMachineItem; 31 32 … … 41 42 /** Notifies listeners about @a iMinimumWidthHint changed. */ 42 43 void sigMinimumWidthHintChanged(int iMinimumWidthHint); 43 /** Notifies listeners about @a iMinimumHeightHint changed. */44 void sigMinimumHeightHintChanged(int iMinimumHeightHint);45 44 /** @} */ 46 45 … … 63 62 /** Stops currently building group. */ 64 63 void stopBuildingGroup(); 64 65 /** Installs event-filter for @a pSource object. */ 66 virtual void installEventFilterHelper(QObject *pSource) /* override */; 65 67 /** @} */ 66 68 … … 152 154 /** @name Children stuff. 153 155 * @{ */ 156 /** Holds the children scroll-area instance. */ 157 UIGraphicsScrollArea *m_pScrollArea; 154 158 /** Holds the children container instance. */ 155 159 QIGraphicsWidget *m_pContainer; … … 166 170 /** @name Layout stuff. 167 171 * @{ */ 172 /** Holds previous minimum width hint. */ 168 173 int m_iPreviousMinimumWidthHint; 169 int m_iPreviousMinimumHeightHint;170 174 /** @} */ 171 175 }; -
trunk/src/VBox/Frontends/VirtualBox/src/manager/details/UIDetailsItem.h
r76581 r79842 89 89 /** Returns the description of the item. */ 90 90 virtual QString description() const = 0; 91 92 /** Installs event-filter for @a pSource object. 93 * @note Base-class implementation does nothing. */ 94 virtual void installEventFilterHelper(QObject *pSource) { Q_UNUSED(pSource); } 91 95 /** @} */ 92 96 -
trunk/src/VBox/Frontends/VirtualBox/src/manager/details/UIDetailsModel.cpp
r79839 r79842 56 56 } 57 57 58 void UIDetailsModel::init() 59 { 60 /* Install root as event-filter for scene view, 61 * we need QEvent::Scroll events from it: */ 62 root()->installEventFilterHelper(view()); 63 } 64 58 65 QGraphicsScene *UIDetailsModel::scene() const 59 66 { -
trunk/src/VBox/Frontends/VirtualBox/src/manager/details/UIDetailsModel.h
r79839 r79842 58 58 /** Notifies listeners about model root item @a iMinimumWidthHint changed. */ 59 59 void sigRootItemMinimumWidthHintChanged(int iMinimumWidthHint); 60 /** Notifies listeners about model root item @a iMinimumHeightHint changed. */61 void sigRootItemMinimumHeightHintChanged(int iMinimumHeightHint);62 60 63 61 /** Notifies listeners about element link clicked. … … 74 72 /** Destructs a details model. */ 75 73 virtual ~UIDetailsModel() /* override */; 74 75 /** Inits model. */ 76 void init(); 76 77 77 78 /** Returns graphics scene this model belongs to. */ -
trunk/src/VBox/Frontends/VirtualBox/src/manager/details/UIDetailsView.cpp
r76606 r79842 110 110 , m_pDetails(pParent) 111 111 , m_iMinimumWidthHint(0) 112 , m_iMinimumHeightHint(0)113 112 { 114 113 /* Install Details-view accessibility interface factory: */ … … 122 121 /* Setup scroll-bars policy: */ 123 122 setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); 123 setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); 124 124 125 125 /* Update scene-rect: */ … … 148 148 } 149 149 150 void UIDetailsView::sltMinimumHeightHintChanged(int iMinimumHeightHint)151 {152 /* Is there something changed? */153 if (m_iMinimumHeightHint == iMinimumHeightHint)154 return;155 156 /* Remember new value: */157 m_iMinimumHeightHint = iMinimumHeightHint;158 if (m_iMinimumHeightHint <= 0)159 m_iMinimumHeightHint = 1;160 161 /* Update scene-rect: */162 updateSceneRect();163 }164 165 150 void UIDetailsView::retranslateUi() 166 151 { … … 177 162 /* Notify listeners: */ 178 163 emit sigResized(); 164 165 /* Update scene-rect: */ 166 updateSceneRect(); 179 167 } 180 168 181 169 void UIDetailsView::updateSceneRect() 182 170 { 183 setSceneRect(0, 0, m_iMinimumWidthHint, m_iMinimumHeightHint);171 setSceneRect(0, 0, m_iMinimumWidthHint, height()); 184 172 } 185 173 -
trunk/src/VBox/Frontends/VirtualBox/src/manager/details/UIDetailsView.h
r76581 r79842 52 52 /* Handlers: Size-hint stuff: */ 53 53 void sltMinimumWidthHintChanged(int iMinimumWidthHint); 54 void sltMinimumHeightHintChanged(int iMinimumHeightHint);55 54 56 55 private: … … 70 69 /* Variables: */ 71 70 int m_iMinimumWidthHint; 72 int m_iMinimumHeightHint;73 71 }; 74 72
Note:
See TracChangeset
for help on using the changeset viewer.