VirtualBox

Changeset 62990 in vbox for trunk/src


Ignore:
Timestamp:
Aug 4, 2016 1:58:32 PM (9 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
109599
Message:

FE/Qt: bugref:8422: Desktop-widget watchdog rework (part 05): Qt5 migration, e.g. QDesktopWidget screen count change signal is no more reliable (at least under XCB), using QApplication screen add/remove signals instead.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/globals
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIDesktopWidgetWatchdog.cpp

    r62989 r62990  
    2323# include <QApplication>
    2424# include <QDesktopWidget>
     25# if QT_VERSION >= 0x050000
     26#  include <QScreen>
     27# endif /* QT_VERSION >= 0x050000 */
    2528
    2629/* GUI includes: */
     
    140143}
    141144
     145#if QT_VERSION < 0x050000
     146
    142147void UIDesktopWidgetWatchdog::sltHandleHostScreenCountChanged(int cHostScreenCount)
    143148{
     
    147152    updateHostScreenConfiguration(cHostScreenCount);
    148153}
     154
     155#else /* QT_VERSION >= 0x050000 */
     156
     157void UIDesktopWidgetWatchdog::sltHostScreenAdded(QScreen *pHostScreen)
     158{
     159//    printf("UIDesktopWidgetWatchdog::sltHostScreenAdded(%d)\n", m_pDesktopWidget->screenCount());
     160
     161    /* Update host-screen configuration: */
     162    updateHostScreenConfiguration();
     163}
     164
     165void UIDesktopWidgetWatchdog::sltHostScreenRemoved(QScreen *pHostScreen)
     166{
     167//    printf("UIDesktopWidgetWatchdog::sltHostScreenRemoved(%d)\n", m_pDesktopWidget->screenCount());
     168
     169    /* Update host-screen configuration: */
     170    updateHostScreenConfiguration();
     171}
     172
     173#endif /* QT_VERSION >= 0x050000 */
    149174
    150175void UIDesktopWidgetWatchdog::sltHandleHostScreenResized(int iHostScreenIndex)
     
    173198{
    174199    /* Prepare connections: */
     200#if QT_VERSION < 0x050000
    175201    connect(m_pDesktopWidget, SIGNAL(screenCountChanged(int)), this, SLOT(sltHandleHostScreenCountChanged(int)));
     202#else /* QT_VERSION >= 0x050000 */
     203    connect(qApp, SIGNAL(screenAdded(QScreen *)), this, SLOT(sltHostScreenAdded(QScreen *)));
     204    connect(qApp, SIGNAL(screenRemoved(QScreen *)), this, SLOT(sltHostScreenRemoved(QScreen *)));
     205#endif /* QT_VERSION >= 0x050000 */
    176206    connect(m_pDesktopWidget, SIGNAL(resized(int)), this, SLOT(sltHandleHostScreenResized(int)));
    177207
     
    183213{
    184214    /* Cleanup connections: */
     215#if QT_VERSION < 0x050000
    185216    disconnect(m_pDesktopWidget, SIGNAL(screenCountChanged(int)), this, SLOT(sltHandleHostScreenCountChanged(int)));
     217#else /* QT_VERSION >= 0x050000 */
     218    disconnect(qApp, SIGNAL(screenAdded(QScreen *)), this, SLOT(sltHostScreenAdded(QScreen *)));
     219    disconnect(qApp, SIGNAL(screenRemoved(QScreen *)), this, SLOT(sltHostScreenRemoved(QScreen *)));
     220#endif /* QT_VERSION >= 0x050000 */
    186221    disconnect(m_pDesktopWidget, SIGNAL(resized(int)), this, SLOT(sltHandleHostScreenResized(int)));
    187222
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIDesktopWidgetWatchdog.h

    r62989 r62990  
    2626/* Forward declarations: */
    2727class QDesktopWidget;
     28#if QT_VERSION >= 0x050000
     29class QScreen;
     30#endif /* QT_VERSION >= 0x050000 */
    2831
    2932/** QObject extension used as
     
    5053private slots:
    5154
     55#if QT_VERSION < 0x050000
    5256    /** Handles host-screen count change to @a cHostScreenCount. */
    5357    void sltHandleHostScreenCountChanged(int cHostScreenCount);
     58#else /* QT_VERSION >= 0x050000 */
     59    /** Handles @a pHostScreen adding. */
     60    void sltHostScreenAdded(QScreen *pHostScreen);
     61    /** Handles @a pHostScreen removing. */
     62    void sltHostScreenRemoved(QScreen *pHostScreen);
     63#endif /* QT_VERSION >= 0x050000 */
    5464
    5565    /** Handles resize for the host-screen with @a iHostScreenIndex. */
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette