- Timestamp:
- Nov 22, 2023 3:19:20 PM (15 months ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/settings
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/settings/UIAdvancedSettingsDialog.cpp
r102260 r102262 210 210 Q_PROPERTY(int verticalScrollBarPosition READ verticalScrollBarPosition WRITE setVerticalScrollBarPosition); 211 211 212 signals: 213 214 /** Notifies listeners about wheel-event. */ 215 void sigWheelEvent(); 216 212 217 public: 213 218 … … 227 232 /** Returns the minimum widget size. */ 228 233 virtual QSize minimumSizeHint() const RT_OVERRIDE; 234 235 /** Handles wheel @a pEvent. */ 236 virtual void wheelEvent(QWheelEvent *pEvent) RT_OVERRIDE; 229 237 230 238 private: … … 568 576 (int)(iMinWidth / 1.6)); 569 577 return QSize(iMinWidth, iMinHeight); 578 } 579 580 void UIVerticalScrollArea::wheelEvent(QWheelEvent *pEvent) 581 { 582 /* Call to base-class: */ 583 QScrollArea::wheelEvent(pEvent); 584 585 /* Notify listeners: */ 586 emit sigWheelEvent(); 570 587 } 571 588 … … 1136 1153 } 1137 1154 1155 void UIAdvancedSettingsDialog::sltHandleVerticalScrollAreaWheelEvent() 1156 { 1157 /* Acquire layout info: */ 1158 int iL = 0, iT = 0, iR = 0, iB = 0; 1159 if ( m_pScrollViewport 1160 && m_pScrollViewport->layout()) 1161 m_pScrollViewport->layout()->getContentsMargins(&iL, &iT, &iR, &iB); 1162 1163 /* Search through all the frame keys we have: */ 1164 int iActualKey = -1; 1165 foreach (int iKey, m_frames.keys()) 1166 { 1167 /* Let's calculate scroll-bar position for enumerated frame: */ 1168 int iPosition = 0; 1169 /* We'll have to take upper content's margin into account: */ 1170 iPosition -= iT; 1171 /* And actual page position according to parent: */ 1172 const QPoint pnt = m_frames.value(iKey)->pos(); 1173 iPosition += pnt.y(); 1174 1175 /* Check if scroll-bar haven't passed this position yet: */ 1176 if (m_pScrollArea->verticalScrollBarPosition() < iPosition) 1177 break; 1178 1179 /* Remember last suitable frame key: */ 1180 iActualKey = iKey; 1181 } 1182 1183 /* Silently update the selector with frame number we found: */ 1184 if (iActualKey != -1) 1185 m_pSelector->selectById(iActualKey, true /* silently */); 1186 } 1187 1138 1188 void UIAdvancedSettingsDialog::prepare() 1139 1189 { … … 1233 1283 m_pScrollArea->setWidgetResizable(true); 1234 1284 m_pScrollArea->setFrameShape(QFrame::NoFrame); 1285 connect(m_pScrollArea, &UIVerticalScrollArea::sigWheelEvent, 1286 this, &UIAdvancedSettingsDialog::sltHandleVerticalScrollAreaWheelEvent); 1235 1287 1236 1288 /* Prepare scroll-viewport: */ -
trunk/src/VBox/Frontends/VirtualBox/src/settings/UIAdvancedSettingsDialog.h
r102140 r102262 211 211 void sltHandleFrameVisibilityChange(bool fVisible); 212 212 213 /** Handles signal about vertical scroll-area wheel-event. */ 214 void sltHandleVerticalScrollAreaWheelEvent(); 215 213 216 private: 214 217
Note:
See TracChangeset
for help on using the changeset viewer.