Changeset 45588 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Apr 17, 2013 1:49:06 PM (12 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/widgets
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIPopupPane.cpp
r45586 r45588 82 82 signals: 83 83 84 /* Notifiers: Hoverstuff: */84 /* Notifiers: Animation stuff: */ 85 85 void sigHoverEnter(); 86 86 void sigHoverLeave(); 87 void sigFocusEnter(); 88 void sigFocusLeave(); 87 89 88 90 public: … … 121 123 signals: 122 124 123 /* Notifier s: Hoverstuff: */125 /* Notifier: Animation stuff: */ 124 126 void sigHoverEnter(); 125 127 void sigHoverLeave(); 128 void sigFocusEnter(); 129 void sigFocusLeave(); 126 130 void sigGeometryChanged(); 127 131 … … 180 184 , m_iButtonEsc(0) 181 185 , m_fHovered(false) 186 , m_fFocused(false) 182 187 , m_pMainFrame(0), m_pTextPane(0), m_pButtonBox(0) 183 188 , m_pButton1(0), m_pButton2(0), m_pButton3(0) … … 292 297 break; 293 298 } 299 case QEvent::FocusIn: 300 { 301 if (!m_fFocused) 302 { 303 m_fFocused = true; 304 emit sigFocusEnter(); 305 } 306 break; 307 } 308 case QEvent::FocusOut: 309 { 310 if (m_fFocused && (pWatched == m_pButton1 || 311 pWatched == m_pButton2 || 312 pWatched == m_pButton3)) 313 { 314 m_fFocused = false; 315 emit sigFocusLeave(); 316 } 317 break; 318 } 294 319 /* Default case: */ 295 320 default: break; … … 415 440 /* Prepare this: */ 416 441 installEventFilter(this); 417 setFocusPolicy(Qt::StrongFocus);418 442 /* Create main-frame: */ 419 443 m_pMainFrame = new UIPopupPaneFrame(this); … … 421 445 /* Prepare frame: */ 422 446 m_pMainFrame->installEventFilter(this); 447 m_pMainFrame->setFocusPolicy(Qt::StrongFocus); 423 448 /* Create message-label: */ 424 449 m_pTextPane = new UIPopupPaneTextPane(m_pMainFrame); … … 463 488 if (pButton && pButton->isDefault()) 464 489 { 465 setFocusProxy(pButton);490 m_pMainFrame->setFocusProxy(pButton); 466 491 m_pTextPane->setFocusProxy(pButton); 467 492 break; … … 472 497 if (m_pButton1) 473 498 { 499 m_pButton1->installEventFilter(this); 474 500 connect(m_pButton1, SIGNAL(clicked()), SLOT(done1())); 475 501 if (!m_strButtonText1.isEmpty()) … … 480 506 if (m_pButton2) 481 507 { 508 m_pButton2->installEventFilter(this); 482 509 connect(m_pButton2, SIGNAL(clicked()), SLOT(done2())); 483 510 if (!m_strButtonText2.isEmpty()) … … 488 515 if (m_pButton3) 489 516 { 517 m_pButton3->installEventFilter(this); 490 518 connect(m_pButton3, SIGNAL(clicked()), SLOT(done3())); 491 519 if (!m_strButtonText3.isEmpty()) … … 547 575 QPushButton *pButton = pButtonBox->addButton(strText, role); 548 576 577 /* Configure button: */ 578 pButton->setFocusPolicy(Qt::StrongFocus); 579 549 580 /* Configure 'default' button: */ 550 581 if (iButton & AlertButtonOption_Default) 551 {552 582 pButton->setDefault(true); 553 pButton->setFocusPolicy(Qt::StrongFocus);554 pButton->setFocus();555 }556 583 557 584 /* Return button: */ … … 579 606 void UIPopupPaneFrame::prepare() 580 607 { 581 /* Install 'hover' animation for 'opacity' property: */608 /* Propagate parent signals: */ 582 609 connect(parent(), SIGNAL(sigHoverEnter()), this, SIGNAL(sigHoverEnter())); 583 610 connect(parent(), SIGNAL(sigHoverLeave()), this, SIGNAL(sigHoverLeave())); 611 connect(parent(), SIGNAL(sigFocusEnter()), this, SIGNAL(sigFocusEnter())); 612 connect(parent(), SIGNAL(sigFocusLeave()), this, SIGNAL(sigFocusLeave())); 613 /* Install 'hover' animation for 'opacity' property: */ 584 614 UIAnimationFramework::installPropertyAnimation(this, QByteArray("opacity"), 585 615 m_iDefaultOpacity, m_iHoveredOpacity, m_iHoverAnimationDuration, … … 677 707 void UIPopupPaneTextPane::prepare() 678 708 { 679 /* Install 'hover' animation for 'height' property: */709 /* Propagate parent signals: */ 680 710 connect(parent(), SIGNAL(sigHoverEnter()), this, SIGNAL(sigHoverEnter())); 681 711 connect(parent(), SIGNAL(sigHoverLeave()), this, SIGNAL(sigHoverLeave())); 712 connect(parent(), SIGNAL(sigFocusEnter()), this, SIGNAL(sigFocusEnter())); 713 connect(parent(), SIGNAL(sigFocusLeave()), this, SIGNAL(sigFocusLeave())); 714 /* Install 'focus' animation for 'height' property: */ 682 715 UIAnimationFramework::installPropertyAnimation(this, QByteArray("percentage"), 683 716 m_iDefaultPercentage, m_iHoveredPercentage, m_iHoverAnimationDuration, 684 SIGNAL(sig HoverEnter()), SIGNAL(sigHoverLeave()));717 SIGNAL(sigFocusEnter()), SIGNAL(sigFocusLeave())); 685 718 /* Prepare content: */ 686 719 prepareContent(); -
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIPopupPane.h
r45586 r45588 50 50 signals: 51 51 52 /* Notifiers: Hoverstuff: */52 /* Notifiers: Animation stuff: */ 53 53 void sigHoverEnter(); 54 54 void sigHoverLeave(); 55 void sigFocusEnter(); 56 void sigFocusLeave(); 55 57 56 58 /* Notifier: Complete stuff: */ … … 133 135 int m_iButtonEsc; 134 136 135 /* Variables: Hoverstuff: */137 /* Variables: Animation stuff: */ 136 138 bool m_fHovered; 139 bool m_fFocused; 137 140 138 141 /* Widgets: */
Note:
See TracChangeset
for help on using the changeset viewer.