Changeset 72716 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Jun 28, 2018 10:59:17 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerFilterPanel.cpp
r72706 r72716 79 79 virtual void mouseReleaseEvent(QMouseEvent *){} 80 80 virtual void paintEvent(QPaintEvent *event) /* override */; 81 virtual void resizeEvent(QResizeEvent *event) /* override */; 81 82 82 83 private slots: … … 143 144 } 144 145 145 void UIVMFilterLineEdit:: paintEvent(QPaintEvent *event)146 { 147 QLineEdit:: paintEvent(event);148 146 void UIVMFilterLineEdit::resizeEvent(QResizeEvent *event) 147 { 148 QLineEdit::resizeEvent(event); 149 149 150 if (!m_pClearAllButton || !m_pRemoveTermButton) 150 151 createButtons(); 151 152 int clearButtonSize = height(); 152 153 int deltaY = 0.5 * (height() - m_pClearAllButton->height()); 154 m_pClearAllButton->setGeometry(width() - clearButtonSize, deltaY, clearButtonSize, clearButtonSize); 153 154 int deltaHeight = 0.5 * (height() - m_pClearAllButton->height()); 155 m_pClearAllButton->setGeometry(width() - clearButtonSize, deltaHeight, clearButtonSize, clearButtonSize); 156 } 157 158 void UIVMFilterLineEdit::paintEvent(QPaintEvent *event) 159 { 160 QLineEdit::paintEvent(event); 161 int clearButtonSize = height(); 155 162 /* If we have a selected term move the m_pRemoveTermButton to the end of the 156 163 or start of the word (depending on the location of the word within line edit itself: */ 157 164 if (hasSelectedText()) 158 165 { 166 int deltaHeight = 0.5 * (height() - m_pClearAllButton->height()); 159 167 m_pRemoveTermButton->show(); 160 int buttonY = 0.5 * (height() - 16);161 168 int buttonSize = m_iRemoveTermButtonSize; 162 169 int charWidth = fontMetrics().width('x'); 163 170 int buttonLeft = cursorRect().right() - 0.5 * charWidth; 164 /* If buttonLeft is in far left of the line edit, move the171 /* If buttonLeft is in far right of the line edit, move the 165 172 button to left side of the selected word: */ 166 173 if (buttonLeft + buttonSize >= width() - clearButtonSize) … … 169 176 buttonLeft -= (selectionWidth + buttonSize); 170 177 } 171 m_pRemoveTermButton->setGeometry(buttonLeft, buttonY, buttonSize, buttonSize);178 m_pRemoveTermButton->setGeometry(buttonLeft, deltaHeight, buttonSize, buttonSize); 172 179 } 173 180 else
Note:
See TracChangeset
for help on using the changeset viewer.