- Timestamp:
- Jul 16, 2014 5:09:15 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineWindowNormal.cpp
r52053 r52056 239 239 return QWidget::mouseMoveEvent(pEvent); 240 240 241 /* Revoke hovered state: */ 242 m_fHovered = false; 243 /* Update: */ 244 update(); 245 241 246 /* Initialize dragging: */ 242 247 m_mousePressPosition = QPoint(); … … 285 290 void sltParentGeometryChanged(const QRect &rect); 286 291 292 /** Handles 3D overlay visibility change. */ 293 void sltHandle3DOverlayVisibilityChange(); 294 287 295 /** Handles configuration change. */ 288 296 void sltHandleConfigurationChange(); … … 304 312 /** Prepare animation routine. */ 305 313 void prepareAnimation(); 314 /** Prepare geometry. */ 315 void prepareGeometry(); 306 316 307 317 /** Updates status buttons. */ … … 412 422 } 413 423 424 void UIStatusBarEditorWindow::sltHandle3DOverlayVisibilityChange() 425 { 426 /* Reactivate window when 3D overlay covered us: */ 427 activateWindow(); 428 } 429 414 430 void UIStatusBarEditorWindow::sltHandleConfigurationChange() 415 431 { … … 457 473 /* Delete window when closed: */ 458 474 setAttribute(Qt::WA_DeleteOnClose); 459 /* Make window background translucent: */ 475 /* Make sure we have no background 476 * until the first one paint-event: */ 477 setAttribute(Qt::WA_NoSystemBackground); 478 #if defined(Q_WS_MAC) 479 /* Using native API to enable translucent background for the Mac host. 480 * - We also want to disable window-shadows which is possible 481 * using Qt::WA_MacNoShadow only since Qt 4.8, 482 * while minimum supported version is 4.7.1 for now: */ 483 ::darwinSetShowsWindowTransparent(this, true); 484 #elif defined(Q_WS_WIN) 485 /* Using Qt API to enable translucent background: 486 * - Under Win host Qt conflicts with 3D stuff (black seamless regions). 487 * - Under Mac host Qt doesn't allows to disable window-shadows 488 * until version 4.8, but minimum supported version is 4.7.1 for now. 489 * - Under x11 host Qt has it broken with KDE 4.9 (black background): */ 460 490 setAttribute(Qt::WA_TranslucentBackground); 491 #endif /* Q_WS_WIN */ 461 492 /* Track D&D events: */ 462 493 setAcceptDrops(true); … … 467 498 { 468 499 /* Configure main-layout: */ 500 #if defined(Q_WS_WIN) 501 /* Standard margins on Windows: */ 469 502 int iLeft, iTop, iRight, iBottom; 470 503 m_pMainLayout->getContentsMargins(&iLeft, &iTop, &iRight, &iBottom); … … 472 505 iBottom -= 5; 473 506 m_pMainLayout->setContentsMargins(iLeft, iTop, iRight, iBottom); 507 #elif defined(Q_WS_MAC) 508 /* Standard margins on Mac OS X are too big: */ 509 m_pMainLayout->setContentsMargins(10, 10, 10, 5); 510 #endif /* Q_WS_MAC */ 474 511 m_pMainLayout->setSpacing(0); 475 512 /* Create close-button: */ … … 478 515 { 479 516 /* Configure close-button: */ 517 m_pButtonClose->setFocusPolicy(Qt::StrongFocus); 480 518 m_pButtonClose->setMinimumSize(QSize(1, 1)); 481 519 m_pButtonClose->setShortcut(Qt::Key_Escape); … … 506 544 /* Prepare animation: */ 507 545 prepareAnimation(); 546 /* Prepare geometry: */ 547 prepareGeometry(); 508 548 509 549 /* Activate window: */ … … 558 598 /* Update animation: */ 559 599 updateAnimation(); 600 } 601 602 void UIStatusBarEditorWindow::prepareGeometry() 603 { 604 /* Prepare geometry based on minimum size-hint: */ 605 const QSize msh = minimumSizeHint(); 606 setGeometry(m_rect.x(), m_rect.y() + m_rect.height() - m_statusBarRect.height() - msh.height(), 607 qMax(m_rect.width(), msh.width()), msh.height()); 608 #ifdef Q_WS_WIN 609 raise(); 610 #endif /* Q_WS_WIN */ 560 611 } 561 612 … … 608 659 setGeometry(m_rect.x(), m_rect.y() + m_rect.height() - m_statusBarRect.height() - sh.height(), 609 660 qMax(m_rect.width(), sh.width()), sh.height()); 661 #ifdef Q_WS_WIN 610 662 raise(); 663 #endif /* Q_WS_WIN */ 611 664 } 612 665 … … 660 713 color1.setAlpha(0); 661 714 QColor color2 = pal.color(QPalette::Window).darker(200); 715 #ifdef Q_WS_WIN 662 716 QColor color3 = pal.color(QPalette::Window).darker(120); 717 #endif /* Q_WS_WIN */ 663 718 664 719 /* Left corner: */ … … 700 755 painter.fillRect(QRect(0, 5, 5, height() - 5), grad4); 701 756 painter.fillRect(QRect(width() - 5, 5, 5, height() - 5), grad5); 757 #ifdef Q_WS_WIN 702 758 painter.save(); 703 759 painter.setPen(color3); … … 707 763 painter.drawLine(QLine(QPoint(5 + 1, height() - 1), QPoint(5 + 1, 5 + 1))); 708 764 painter.restore(); 765 #endif /* Q_WS_WIN */ 709 766 710 767 /* Paint drop token: */ … … 927 984 connect(this, SIGNAL(sigGeometryChange(const QRect&)), 928 985 pStatusBarEditor, SLOT(sltParentGeometryChanged(const QRect&))); 986 connect(machineLogic(), SIGNAL(sigNotifyAbout3DOverlayVisibilityChange(bool)), 987 pStatusBarEditor, SLOT(sltHandle3DOverlayVisibilityChange())); 929 988 connect(pStatusBarEditor, SIGNAL(destroyed(QObject*)), 930 989 this, SLOT(sltStatusBarEditorWindowClosed())); … … 1018 1077 AssertPtrReturnVoid(statusBar()); 1019 1078 { 1020 #if def Q_WS_WIN1079 #if defined(Q_WS_WIN) || defined (Q_WS_MAC) 1021 1080 /* Configure status-bar: */ 1022 1081 statusBar()->setContextMenuPolicy(Qt::CustomContextMenu); 1023 1082 connect(statusBar(), SIGNAL(customContextMenuRequested(const QPoint&)), 1024 1083 this, SLOT(sltShowStatusBarContextMenu(const QPoint&))); 1025 #endif /* Q_WS_WIN */1084 #endif /* Q_WS_WIN || Q_WS_MAC */ 1026 1085 /* Create indicator-pool: */ 1027 1086 m_pIndicatorsPool = new UIIndicatorsPool(machineLogic()->uisession());
Note:
See TracChangeset
for help on using the changeset viewer.