Changeset 101159 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Sep 18, 2023 3:45:32 PM (15 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/settings/UIAdvancedSettingsDialog.cpp
r101147 r101159 115 115 virtual bool eventFilter(QObject *pObject, QEvent *pEvent) RT_OVERRIDE; 116 116 117 private slots: 118 119 /** Handles editor @a strText change. */ 120 void sltHandleEditorTextChanged(const QString &strText); 121 /** Handles button click. */ 122 void sltHandleButtonClicked(); 123 117 124 private: 118 125 … … 136 143 /** Holds the filter editor instance. */ 137 144 QILineEdit *m_pLineEdit; 138 #if 0139 145 /** Holds the filter reset button instance. */ 140 146 QIToolButton *m_pToolButton; 141 #endif142 147 143 148 /** Holds whether filter editor focused. */ … … 179 184 : QWidget(pParent) 180 185 , m_pLineEdit(0) 181 #if 0182 186 , m_pToolButton(0) 183 #endif184 187 , m_fFocused(false) 185 188 , m_iUnfocusedEditorWidth(0) … … 242 245 } 243 246 247 void UIFilterEditor::sltHandleEditorTextChanged(const QString &strText) 248 { 249 m_pToolButton->setHidden(m_pLineEdit->text().isEmpty()); 250 emit sigTextChanged(strText); 251 } 252 253 void UIFilterEditor::sltHandleButtonClicked() 254 { 255 m_pLineEdit->clear(); 256 } 257 244 258 void UIFilterEditor::prepare() 245 259 { … … 250 264 m_pLineEdit->installEventFilter(this); 251 265 connect(m_pLineEdit, &QILineEdit::textChanged, 252 this, &UIFilterEditor::sigTextChanged); 253 } 254 255 #if 0 266 this, &UIFilterEditor::sltHandleEditorTextChanged); 267 } 268 256 269 /* Prepare filter reset button: */ 257 270 m_pToolButton = new QIToolButton(this); 258 271 if (m_pToolButton) 259 m_pToolButton->setIcon(UIIconPool::iconSet(":/search_16px.png")); 260 #endif 272 { 273 m_pToolButton->hide(); 274 m_pToolButton->setIconSize(QSize(10, 10)); 275 m_pToolButton->setIcon(UIIconPool::iconSet(":/close_16px.png")); 276 connect(m_pToolButton, &QIToolButton::clicked, 277 this, &UIFilterEditor::sltHandleButtonClicked); 278 } 261 279 262 280 /* Install 'unfocus/focus' animation to 'editorWidth' property: */ … … 279 297 void UIFilterEditor::adjustEditorGeometry() 280 298 { 299 /* Acquire maximum widget width: */ 300 const int iWidth = width(); 301 302 /* Update filter editor geometry: */ 303 const QSize esh = m_pLineEdit->minimumSizeHint(); 304 const int iMinimumEditorWidth = esh.width(); 305 const int iMinimumEditorHeight = esh.height(); 281 306 /* Update minimum/maximum filter editor width: */ 282 const int iWidth = width(); 283 const int iMinimumWidth = m_pLineEdit->minimumSizeHint().width(); 284 m_iUnfocusedEditorWidth = qMax(iWidth / 2, iMinimumWidth); 285 m_iFocusedEditorWidth = qMax(iWidth, iMinimumWidth);; 307 m_iUnfocusedEditorWidth = qMax(iWidth / 2, iMinimumEditorWidth); 308 m_iFocusedEditorWidth = qMax(iWidth, iMinimumEditorWidth); 286 309 m_pAnimation->update(); 287 288 /* Update filter editor geometry: */289 310 setEditorWidth(m_fFocused ? m_iFocusedEditorWidth : m_iUnfocusedEditorWidth); 311 312 /* Update filter button geometry: */ 313 const QSize bsh = m_pToolButton->minimumSizeHint(); 314 const int iMinimumButtonWidth = bsh.width(); 315 const int iMinimumButtonHeight = bsh.height(); 316 const int iButtonY = iMinimumEditorHeight > iMinimumButtonHeight 317 ? (iMinimumEditorHeight - iMinimumButtonHeight) / 2 318 : 0; 319 m_pToolButton->setGeometry(iWidth - iMinimumButtonWidth, iButtonY, iMinimumButtonWidth, iMinimumButtonHeight); 290 320 } 291 321
Note:
See TracChangeset
for help on using the changeset viewer.