- Timestamp:
- Jun 13, 2017 2:52:18 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/selector/UISnapshotDetailsWidget.cpp
r67372 r67374 27 27 # include <QLabel> 28 28 # include <QLineEdit> 29 # include <QPainter> 29 30 # include <QPushButton> 30 31 # include <QScrollArea> … … 91 92 QSize minimumSizeHint() const; 92 93 94 protected: 95 96 /** Handles paint @a pEvent. */ 97 virtual void paintEvent(QPaintEvent *pEvent) /* override */; 98 93 99 private: 94 100 … … 210 216 } 211 217 218 void UISnapshotDetailsElement::paintEvent(QPaintEvent * /* pEvent */) 219 { 220 /* Prepare painter: */ 221 QPainter painter(this); 222 223 /* Prepare palette colors: */ 224 const QPalette pal = palette(); 225 QColor color0 = pal.color(QPalette::Window); 226 QColor color1 = pal.color(QPalette::Window).lighter(110); 227 color1.setAlpha(0); 228 QColor color2 = pal.color(QPalette::Window).darker(200); 229 230 /* Top-left corner: */ 231 QRadialGradient grad1(QPointF(5, 5), 5); 232 { 233 grad1.setColorAt(0, color2); 234 grad1.setColorAt(1, color1); 235 } 236 /* Top-right corner: */ 237 QRadialGradient grad2(QPointF(width() - 5, 5), 5); 238 { 239 grad2.setColorAt(0, color2); 240 grad2.setColorAt(1, color1); 241 } 242 /* Bottom-left corner: */ 243 QRadialGradient grad3(QPointF(5, height() - 5), 5); 244 { 245 grad3.setColorAt(0, color2); 246 grad3.setColorAt(1, color1); 247 } 248 /* Botom-right corner: */ 249 QRadialGradient grad4(QPointF(width() - 5, height() - 5), 5); 250 { 251 grad4.setColorAt(0, color2); 252 grad4.setColorAt(1, color1); 253 } 254 255 /* Top line: */ 256 QLinearGradient grad5(QPointF(5, 0), QPointF(5, 5)); 257 { 258 grad5.setColorAt(0, color1); 259 grad5.setColorAt(1, color2); 260 } 261 /* Bottom line: */ 262 QLinearGradient grad6(QPointF(5, height()), QPointF(5, height() - 5)); 263 { 264 grad6.setColorAt(0, color1); 265 grad6.setColorAt(1, color2); 266 } 267 /* Left line: */ 268 QLinearGradient grad7(QPointF(0, height() - 5), QPointF(5, height() - 5)); 269 { 270 grad7.setColorAt(0, color1); 271 grad7.setColorAt(1, color2); 272 } 273 /* Right line: */ 274 QLinearGradient grad8(QPointF(width(), height() - 5), QPointF(width() - 5, height() - 5)); 275 { 276 grad8.setColorAt(0, color1); 277 grad8.setColorAt(1, color2); 278 } 279 280 /* Paint shape/shadow: */ 281 painter.fillRect(QRect(5, 5, width() - 5 * 2, height() - 5 * 2), color0); // background 282 painter.fillRect(QRect(0, 0, 5, 5), grad1); // top-left corner 283 painter.fillRect(QRect(width() - 5, 0, 5, 5), grad2); // top-right corner 284 painter.fillRect(QRect(0, height() - 5, 5, 5), grad3); // bottom-left corner 285 painter.fillRect(QRect(width() - 5, height() - 5, 5, 5), grad4); // bottom-right corner 286 painter.fillRect(QRect(5, 0, width() - 5 * 2, 5), grad5); // top line 287 painter.fillRect(QRect(5, height() - 5, width() - 5 * 2, 5), grad6); // bottom line 288 painter.fillRect(QRect(0, 5, 5, height() - 5 * 2), grad7); // left line 289 painter.fillRect(QRect(width() - 5, 5, 5, height() - 5 * 2), grad8); // right line 290 } 291 212 292 void UISnapshotDetailsElement::prepare() 213 293 { … … 217 297 { 218 298 /* Configure layout: */ 219 layout()->setContentsMargins( 0, 0, 0, 0);299 layout()->setContentsMargins(5, 5, 5, 5); 220 300 221 301 /* Create text-browser if requested, text-edit otherwise: */ … … 227 307 m_pTextEdit->setFocusPolicy(Qt::NoFocus); 228 308 m_pTextEdit->setFrameShape(QFrame::NoFrame); 309 m_pTextEdit->viewport()->setAutoFillBackground(false); 229 310 m_pTextEdit->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); 230 311 m_pTextEdit->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
Note:
See TracChangeset
for help on using the changeset viewer.

