Changeset 61979 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Jul 1, 2016 2:32:54 PM (9 years ago)
- svn:sync-xref-src-repo-rev:
- 108426
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/widgets
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIMiniToolBar.cpp
r61965 r61979 34 34 # include <QWindow> 35 35 # endif /* VBOX_WS_WIN */ 36 # if defined(VBOX_WS_X11) && QT_VERSION >= 0x050000 37 # include <QWindowStateChangeEvent> 38 # endif /* VBOX_WS_X11 && QT_VERSION >= 0x050000 */ 36 39 37 40 /* GUI includes: */ … … 422 425 , m_pHoverLeaveTimer(0) 423 426 , m_pAnimation(0) 427 #if defined(VBOX_WS_X11) && QT_VERSION >= 0x050000 428 , m_fIsParentMinimized(false) 429 #endif /* VBOX_WS_X11 && QT_VERSION >= 0x050000 */ 424 430 { 425 431 /* Prepare: */ … … 833 839 } 834 840 841 #if defined(VBOX_WS_X11) && QT_VERSION >= 0x050000 842 /* If that's window event: */ 843 if (pWatched == this) 844 { 845 switch (pEvent->type()) 846 { 847 case QEvent::WindowStateChange: 848 { 849 /* Watch for window state changes: */ 850 QWindowStateChangeEvent *pChangeEvent = static_cast<QWindowStateChangeEvent*>(pEvent); 851 LogRel2(("GUI: UIMiniToolBar::eventFilter: Window state changed from %d to %d\n", 852 (int)pChangeEvent->oldState(), (int)windowState())); 853 if ( windowState() != Qt::WindowMinimized 854 && pChangeEvent->oldState() == Qt::WindowMinimized) 855 { 856 /* Asynchronously call for sltShow(): */ 857 LogRel2(("GUI: UIMiniToolBar::eventFilter: Window restored\n")); 858 QMetaObject::invokeMethod(this, "sltShow", Qt::QueuedConnection); 859 } 860 break; 861 } 862 default: 863 break; 864 } 865 } 866 #endif /* VBOX_WS_X11 && QT_VERSION >= 0x050000 */ 867 835 868 /* If that's parent window event: */ 836 869 if (pWatched == parent()) … … 840 873 case QEvent::Hide: 841 874 { 875 /* Skip if parent or we are minimized: */ 876 if ( isParentMinimized() 877 || isMinimized()) 878 break; 879 842 880 /* Asynchronously call for sltHide(): */ 843 881 LogRel2(("GUI: UIMiniToolBar::eventFilter: Parent hide event\n")); … … 847 885 case QEvent::Show: 848 886 { 887 /* Skip if parent or we are minimized: */ 888 if ( isParentMinimized() 889 || isMinimized()) 890 break; 891 849 892 /* Asynchronously call for sltShow(): */ 850 893 LogRel2(("GUI: UIMiniToolBar::eventFilter: Parent show event\n")); … … 858 901 if ( !parentWidget()->isVisible() 859 902 || !isVisible()) 903 break; 904 /* Skip if parent or we are minimized: */ 905 if ( isParentMinimized() 906 || isMinimized()) 860 907 break; 861 908 … … 875 922 break; 876 923 } 924 #if defined(VBOX_WS_X11) && QT_VERSION >= 0x050000 925 case QEvent::WindowStateChange: 926 { 927 /* Watch for parent window state changes: */ 928 QWindowStateChangeEvent *pChangeEvent = static_cast<QWindowStateChangeEvent*>(pEvent); 929 LogRel2(("GUI: UIMiniToolBar::eventFilter: Parent window state changed from %d to %d\n", 930 (int)pChangeEvent->oldState(), (int)parentWidget()->windowState())); 931 if (parentWidget()->windowState() & Qt::WindowMinimized) 932 { 933 /* Mark parent window minimized, isMinimized() is not enough due to Qt5vsX11 fight: */ 934 LogRel2(("GUI: UIMiniToolBar::eventFilter: Parent window minimized\n")); 935 m_fIsParentMinimized = true; 936 } 937 else 938 if (parentWidget()->windowState() == Qt::WindowFullScreen) 939 { 940 /* Mark parent window non-minimized, isMinimized() is not enough due to Qt5vsX11 fight: */ 941 LogRel2(("GUI: UIMiniToolBar::eventFilter: Parent window is full-screen\n")); 942 m_fIsParentMinimized = false; 943 } 944 break; 945 } 946 #endif /* VBOX_WS_X11 && QT_VERSION >= 0x050000 */ 877 947 default: 878 948 break; … … 917 987 } 918 988 989 bool UIMiniToolBar::isParentMinimized() const 990 { 991 #if defined(VBOX_WS_X11) && QT_VERSION >= 0x050000 992 return m_fIsParentMinimized; 993 #else /* !VBOX_WS_X11 || QT_VERSION < 0x050000 */ 994 return parentWidget()->isMinimized(); 995 #endif /* !VBOX_WS_X11 || QT_VERSION < 0x050000 */ 996 } 997 919 998 #include "UIMiniToolBar.moc" 920 999 -
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIMiniToolBar.h
r61965 r61979 153 153 QPoint shownToolbarPosition() const { return m_shownToolbarPosition; } 154 154 155 /** Returns whether the parent is currently minimized. */ 156 bool isParentMinimized() const; 157 155 158 /** Holds the geometry type. */ 156 159 const GeometryType m_geometryType; … … 180 183 /** Holds the animation framework object. */ 181 184 UIAnimation *m_pAnimation; 185 186 #if defined(VBOX_WS_X11) && QT_VERSION >= 0x050000 187 /** Holds whether the parent is currently minimized. 188 * Used to restore full-screen state when the parent restored again. */ 189 bool m_fIsParentMinimized; 190 #endif /* VBOX_WS_X11 && QT_VERSION >= 0x050000 */ 182 191 }; 183 192
Note:
See TracChangeset
for help on using the changeset viewer.