Changeset 77268 in vbox
- Timestamp:
- Feb 11, 2019 4:40:49 PM (6 years ago)
- svn:sync-xref-src-repo-rev:
- 128777
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/widgets/graphics/UIGraphicsScrollBar.cpp
r77267 r77268 390 390 { 391 391 /* We have to calculate the X coord of the token, leaving Y untouched: */ 392 #ifdef VBOX_WS_MAC 393 const int iMin = 0; 394 const int iMax = size().width() - m_iExtent; 395 #else 392 396 const int iMin = m_iExtent; 393 397 const int iMax = size().width() - 2 * m_iExtent; 398 #endif 394 399 int iX = pos.x() - m_iExtent / 2; 395 400 iX = qMax(iX, iMin); … … 402 407 { 403 408 /* We have to calculate the Y coord of the token, leaving X untouched: */ 409 #ifdef VBOX_WS_MAC 410 const int iMin = 0; 411 const int iMax = size().height() - m_iExtent; 412 #else 404 413 const int iMin = m_iExtent; 405 414 const int iMax = size().height() - 2 * m_iExtent; 415 #endif 406 416 int iY = pos.y() - m_iExtent / 2; 407 417 iY = qMax(iY, iMin); … … 421 431 void UIGraphicsScrollBar::sltStateLeftDefault() 422 432 { 423 m_pButton1->hide(); 424 m_pButton2->hide(); 425 m_pToken->hide(); 433 if (m_pButton1) 434 m_pButton1->hide(); 435 if (m_pButton2) 436 m_pButton2->hide(); 437 if (m_pToken) 438 m_pToken->hide(); 426 439 } 427 440 428 441 void UIGraphicsScrollBar::sltStateLeftHovered() 429 442 { 430 m_pButton1->hide(); 431 m_pButton2->hide(); 432 m_pToken->hide(); 443 if (m_pButton1) 444 m_pButton1->hide(); 445 if (m_pButton2) 446 m_pButton2->hide(); 447 if (m_pToken) 448 m_pToken->hide(); 433 449 } 434 450 435 451 void UIGraphicsScrollBar::sltStateEnteredDefault() 436 452 { 437 m_pButton1->hide(); 438 m_pButton2->hide(); 439 m_pToken->hide(); 453 if (m_pButton1) 454 m_pButton1->hide(); 455 if (m_pButton2) 456 m_pButton2->hide(); 457 if (m_pToken) 458 m_pToken->hide(); 440 459 } 441 460 442 461 void UIGraphicsScrollBar::sltStateEnteredHovered() 443 462 { 444 m_pButton1->show(); 445 m_pButton2->show(); 446 m_pToken->show(); 463 if (m_pButton1) 464 m_pButton1->show(); 465 if (m_pButton2) 466 m_pButton2->show(); 467 if (m_pToken) 468 m_pToken->show(); 447 469 } 448 470 … … 469 491 void UIGraphicsScrollBar::prepareButtons() 470 492 { 493 #ifndef VBOX_WS_MAC 471 494 /* Create buttons depending on orientation: */ 472 495 switch (m_enmOrientation) … … 504 527 this, &UIGraphicsScrollBar::sltButton2Clicked); 505 528 } 529 #endif 506 530 } 507 531 … … 591 615 /* Make sure extent value is not smaller than the button size: */ 592 616 m_iExtent = QApplication::style()->pixelMetric(QStyle::PM_ScrollBarExtent); 617 #ifndef VBOX_WS_MAC 593 618 m_iExtent = qMax(m_iExtent, (int)m_pButton1->minimumSizeHint().width()); 594 619 m_iExtent = qMax(m_iExtent, (int)m_pButton2->minimumSizeHint().width()); 620 #endif 595 621 updateGeometry(); 596 622 } … … 604 630 void UIGraphicsScrollBar::layoutButtons() 605 631 { 632 #ifndef VBOX_WS_MAC 606 633 // WORKAROUND: 607 634 // We are calculating proper button shift delta, because … … 617 644 iDelta2 = (m_iExtent - m_pButton2->minimumSizeHint().width() + 1) / 2; 618 645 m_pButton2->setPos(size().width() - m_iExtent + iDelta2, size().height() - m_iExtent + iDelta2); 646 #endif 619 647 } 620 648 … … 638 666 { 639 667 /* We have to adjust the X coord of the token, leaving Y unchanged: */ 668 #ifdef VBOX_WS_MAC 669 const int iMin = 0; 670 const int iMax = size().width() - m_iExtent; 671 #else 640 672 const int iMin = m_iExtent; 641 673 const int iMax = size().width() - 2 * m_iExtent; 674 #endif 642 675 int iX = dRatio * (iMax - iMin) + iMin; 643 676 position = QPoint(iX, 0); … … 647 680 { 648 681 /* We have to adjust the Y coord of the token, leaving X unchanged: */ 682 #ifdef VBOX_WS_MAC 683 const int iMin = 0; 684 const int iMax = size().height() - m_iExtent; 685 #else 649 686 const int iMin = m_iExtent; 650 687 const int iMax = size().height() - 2 * m_iExtent; 688 #endif 651 689 int iY = dRatio * (iMax - iMin) + iMin; 652 690 position = QPoint(0, iY);
Note:
See TracChangeset
for help on using the changeset viewer.