- Timestamp:
- Nov 13, 2017 11:22:25 AM (7 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/runtime
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMenuBarEditorWindow.cpp
r69500 r69669 874 874 int iLeft, iTop, iRight, iBottom; 875 875 m_pMainLayout->getContentsMargins(&iLeft, &iTop, &iRight, &iBottom); 876 /* Standard margins should not be too big: */ 877 iLeft = qMin(iLeft, 10); 878 iTop = qMin(iTop, 10); 879 iRight = qMin(iRight, 10); 880 iBottom = qMin(iBottom, 10); 876 /* Acquire metric: */ 877 const int iStandardMetric = QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize) / 2; 878 const int iMinimumMetric = QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize) / 4; 879 /* Standard margins should not be too small: */ 880 iLeft = qMax(iLeft, iStandardMetric); 881 iTop = qMax(iTop, iStandardMetric); 882 iRight = qMax(iRight, iStandardMetric); 883 iBottom = qMax(iBottom, iStandardMetric); 881 884 /* Top margin should be smaller for the common case: */ 882 if (iTop >= 5)883 iTop -= 5;885 if (iTop >= iMinimumMetric) 886 iTop -= iMinimumMetric; 884 887 #ifndef VBOX_WS_MAC 885 888 /* Right margin should be bigger for the settings case: */ 886 889 if (m_fStartedFromVMSettings) 887 iRight += 5;890 iRight += iMinimumMetric; 888 891 #endif /* !VBOX_WS_MAC */ 889 892 /* Apply margins/spacing finally: */ … … 1325 1328 #endif /* VBOX_WS_WIN || VBOX_WS_X11 */ 1326 1329 1330 /* Acquire metric: */ 1331 const int iMetric = QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize) / 4; 1332 1327 1333 /* Left corner: */ 1328 QRadialGradient grad1(QPointF( 5, height() - 5), 5);1334 QRadialGradient grad1(QPointF(iMetric, height() - iMetric), iMetric); 1329 1335 { 1330 1336 grad1.setColorAt(0, color2); … … 1332 1338 } 1333 1339 /* Right corner: */ 1334 QRadialGradient grad2(QPointF(width() - 5, height() - 5), 5);1340 QRadialGradient grad2(QPointF(width() - iMetric, height() - iMetric), iMetric); 1335 1341 { 1336 1342 grad2.setColorAt(0, color2); … … 1338 1344 } 1339 1345 /* Bottom line: */ 1340 QLinearGradient grad3(QPointF( 5, height()), QPointF(5, height() - 5));1346 QLinearGradient grad3(QPointF(iMetric, height()), QPointF(iMetric, height() - iMetric)); 1341 1347 { 1342 1348 grad3.setColorAt(0, color1); … … 1344 1350 } 1345 1351 /* Left line: */ 1346 QLinearGradient grad4(QPointF(0, height() - 5), QPointF(5, height() - 5));1352 QLinearGradient grad4(QPointF(0, height() - iMetric), QPointF(iMetric, height() - iMetric)); 1347 1353 { 1348 1354 grad4.setColorAt(0, color1); … … 1350 1356 } 1351 1357 /* Right line: */ 1352 QLinearGradient grad5(QPointF(width(), height() - 5), QPointF(width() - 5, height() - 5));1358 QLinearGradient grad5(QPointF(width(), height() - iMetric), QPointF(width() - iMetric, height() - iMetric)); 1353 1359 { 1354 1360 grad5.setColorAt(0, color1); … … 1357 1363 1358 1364 /* Paint shape/shadow: */ 1359 painter.fillRect(QRect( 5, 0, width() - 5 * 2, height() - 5), color0); // background1360 painter.fillRect(QRect(0, height() - 5, 5, 5), grad1); // left corner1361 painter.fillRect(QRect(width() - 5, height() - 5, 5, 5), grad2); // right corner1362 painter.fillRect(QRect( 5, height() - 5, width() - 5 * 2, 5), grad3); // bottom line1363 painter.fillRect(QRect(0, 0, 5, height() - 5), grad4); // left line1364 painter.fillRect(QRect(width() - 5, 0, 5, height() - 5), grad5); // right line1365 painter.fillRect(QRect(iMetric, 0, width() - iMetric * 2, height() - iMetric), color0); // background 1366 painter.fillRect(QRect(0, height() - iMetric, iMetric, iMetric), grad1); // left corner 1367 painter.fillRect(QRect(width() - iMetric, height() - iMetric, iMetric, iMetric), grad2); // right corner 1368 painter.fillRect(QRect(iMetric, height() - iMetric, width() - iMetric * 2, iMetric), grad3); // bottom line 1369 painter.fillRect(QRect(0, 0, iMetric, height() - iMetric), grad4); // left line 1370 painter.fillRect(QRect(width() - iMetric, 0, iMetric, height() - iMetric), grad5); // right line 1365 1371 1366 1372 #if defined(VBOX_WS_WIN) || defined(VBOX_WS_X11) … … 1368 1374 painter.save(); 1369 1375 painter.setPen(color3); 1370 painter.drawLine(QLine(QPoint(5 + 1, 0), QPoint(5 + 1, height() - 1 - 5 - 1))); 1371 painter.drawLine(QLine(QPoint(5 + 1, height() - 1 - 5 - 1), QPoint(width() - 1 - 5 - 1, height() - 1 - 5 - 1))); 1372 painter.drawLine(QLine(QPoint(width() - 1 - 5 - 1, height() - 1 - 5 - 1), QPoint(width() - 1 - 5 - 1, 0))); 1376 painter.drawLine(QLine(QPoint(iMetric + 1, 0), 1377 QPoint(iMetric + 1, height() - 1 - iMetric - 1))); 1378 painter.drawLine(QLine(QPoint(iMetric + 1, height() - 1 - iMetric - 1), 1379 QPoint(width() - 1 - iMetric - 1, height() - 1 - iMetric - 1))); 1380 painter.drawLine(QLine(QPoint(width() - 1 - iMetric - 1, height() - 1 - iMetric - 1), 1381 QPoint(width() - 1 - iMetric - 1, 0))); 1373 1382 if (m_fStartedFromVMSettings) 1374 painter.drawLine(QLine(QPoint(width() - 1 - 5 - 1, 0), QPoint(5+ 1, 0)));1383 painter.drawLine(QLine(QPoint(width() - 1 - iMetric - 1, 0), QPoint(iMetric + 1, 0))); 1375 1384 painter.restore(); 1376 1385 #endif /* VBOX_WS_WIN || VBOX_WS_X11 */ -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIStatusBarEditorWindow.cpp
r69500 r69669 493 493 int iLeft, iTop, iRight, iBottom; 494 494 m_pMainLayout->getContentsMargins(&iLeft, &iTop, &iRight, &iBottom); 495 /* Standard margins should not be too big: */ 496 iLeft = qMin(iLeft, 10); 497 iTop = qMin(iTop, 10); 498 iRight = qMin(iRight, 10); 499 iBottom = qMin(iBottom, 10); 495 /* Acquire metric: */ 496 const int iStandardMetric = QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize) / 2; 497 const int iMinimumMetric = QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize) / 4; 498 /* Standard margins should not be too small: */ 499 iLeft = qMax(iLeft, iStandardMetric); 500 iTop = qMax(iTop, iStandardMetric); 501 iRight = qMax(iRight, iStandardMetric); 502 iBottom = qMax(iBottom, iStandardMetric); 500 503 /* Bottom margin should be smaller for the common case: */ 501 if (iBottom >= 5)502 iBottom -= 5;504 if (iBottom >= iMinimumMetric) 505 iBottom -= iMinimumMetric; 503 506 /* Left margin should be bigger for the settings case: */ 504 507 if (m_fStartedFromVMSettings) 505 iLeft += 5;508 iLeft += iMinimumMetric; 506 509 /* Apply margins/spacing finally: */ 507 510 m_pMainLayout->setContentsMargins(iLeft, iTop, iRight, iBottom); … … 623 626 #endif /* VBOX_WS_WIN || VBOX_WS_X11 */ 624 627 628 /* Acquire metric: */ 629 const int iMetric = QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize) / 4; 630 625 631 /* Left corner: */ 626 QRadialGradient grad1(QPointF( 5, 5), 5);632 QRadialGradient grad1(QPointF(iMetric, iMetric), iMetric); 627 633 { 628 634 grad1.setColorAt(0, color2); … … 630 636 } 631 637 /* Right corner: */ 632 QRadialGradient grad2(QPointF(width() - 5, 5), 5);638 QRadialGradient grad2(QPointF(width() - iMetric, iMetric), iMetric); 633 639 { 634 640 grad2.setColorAt(0, color2); … … 636 642 } 637 643 /* Top line: */ 638 QLinearGradient grad3(QPointF( 5, 0), QPointF(5, 5));644 QLinearGradient grad3(QPointF(iMetric, 0), QPointF(iMetric, iMetric)); 639 645 { 640 646 grad3.setColorAt(0, color1); … … 642 648 } 643 649 /* Left line: */ 644 QLinearGradient grad4(QPointF(0, 5), QPointF(5, 5));650 QLinearGradient grad4(QPointF(0, iMetric), QPointF(iMetric, iMetric)); 645 651 { 646 652 grad4.setColorAt(0, color1); … … 648 654 } 649 655 /* Right line: */ 650 QLinearGradient grad5(QPointF(width(), 5), QPointF(width() - 5, 5));656 QLinearGradient grad5(QPointF(width(), iMetric), QPointF(width() - iMetric, iMetric)); 651 657 { 652 658 grad5.setColorAt(0, color1); … … 655 661 656 662 /* Paint shape/shadow: */ 657 painter.fillRect(QRect( 5, 5, width() - 5 * 2, height() - 5), color0); // background658 painter.fillRect(QRect(0, 0, 5, 5), grad1); // left corner659 painter.fillRect(QRect(width() - 5, 0, 5, 5), grad2); // right corner660 painter.fillRect(QRect( 5, 0, width() - 5 * 2, 5), grad3); // bottom line661 painter.fillRect(QRect(0, 5, 5, height() - 5), grad4); // left line662 painter.fillRect(QRect(width() - 5, 5, 5, height() - 5), grad5); // right line663 painter.fillRect(QRect(iMetric, iMetric, width() - iMetric * 2, height() - iMetric), color0); // background 664 painter.fillRect(QRect(0, 0, iMetric, iMetric), grad1); // left corner 665 painter.fillRect(QRect(width() - iMetric, 0, iMetric, iMetric), grad2); // right corner 666 painter.fillRect(QRect(iMetric, 0, width() - iMetric * 2, iMetric), grad3); // bottom line 667 painter.fillRect(QRect(0, iMetric, iMetric, height() - iMetric), grad4); // left line 668 painter.fillRect(QRect(width() - iMetric, iMetric, iMetric, height() - iMetric), grad5); // right line 663 669 664 670 #if defined(VBOX_WS_WIN) || defined(VBOX_WS_X11) … … 666 672 painter.save(); 667 673 painter.setPen(color3); 668 painter.drawLine(QLine(QPoint(5 + 1, 5 + 1), QPoint(width() - 1 - 5 - 1, 5 + 1))); 669 painter.drawLine(QLine(QPoint(width() - 1 - 5 - 1, 5 + 1), QPoint(width() - 1 - 5 - 1, height() - 1))); 670 painter.drawLine(QLine(QPoint(width() - 1 - 5 - 1, height() - 1), QPoint(5 + 1, height() - 1))); 671 painter.drawLine(QLine(QPoint(5 + 1, height() - 1), QPoint(5 + 1, 5 + 1))); 674 painter.drawLine(QLine(QPoint(iMetric + 1, iMetric + 1), 675 QPoint(width() - 1 - iMetric - 1, iMetric + 1))); 676 painter.drawLine(QLine(QPoint(width() - 1 - iMetric - 1, iMetric + 1), 677 QPoint(width() - 1 - iMetric - 1, height() - 1))); 678 painter.drawLine(QLine(QPoint(width() - 1 - iMetric - 1, height() - 1), 679 QPoint(iMetric + 1, height() - 1))); 680 painter.drawLine(QLine(QPoint(iMetric + 1, height() - 1), 681 QPoint(iMetric + 1, iMetric + 1))); 672 682 painter.restore(); 673 683 #endif /* VBOX_WS_WIN || VBOX_WS_X11 */ … … 680 690 const QRect geo = m_pButtonDropToken->geometry(); 681 691 option.rect = !m_fDropAfterTokenButton ? 682 QRect(geo.topLeft() - QPoint( 5, 5),683 geo.bottomLeft() + QPoint(0, 5)) :684 QRect(geo.topRight() - QPoint(0, 5),685 geo.bottomRight() + QPoint( 5, 5));692 QRect(geo.topLeft() - QPoint(iMetric, iMetric), 693 geo.bottomLeft() + QPoint(0, iMetric)) : 694 QRect(geo.topRight() - QPoint(0, iMetric), 695 geo.bottomRight() + QPoint(iMetric, iMetric)); 686 696 QApplication::style()->drawPrimitive(QStyle::PE_IndicatorToolBarSeparator, 687 697 &option, &painter);
Note:
See TracChangeset
for help on using the changeset viewer.