VirtualBox

Changeset 97704 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Nov 29, 2022 12:23:10 PM (2 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
154761
Message:

FE/Qt: bugref:9898: Migrating UIDesktopWidgetWatchdog class to Qt6; A bit of cleanup and build fix.

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

Legend:

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

    r97703 r97704  
    296296
    297297/* static */
    298 int UIDesktopWidgetWatchdog::overallDesktopWidth()
    299 {
    300 #ifdef VBOX_IS_QT6_OR_LATER
    301     /** @todo bird: Not sure if this is entirely correct. */
    302     return QGuiApplication::primaryScreen()->geometry().width();
    303 #else
    304     /* Redirect call to desktop-widget: */
    305     return QApplication::desktop()->width();
    306 #endif
    307 }
    308 
    309 /* static */
    310 int UIDesktopWidgetWatchdog::overallDesktopHeight()
    311 {
    312 #ifdef VBOX_IS_QT6_OR_LATER
    313     /** @todo bird: Not sure if this is entirely correct. */
    314     return QGuiApplication::primaryScreen()->geometry().height();
    315 #else
    316     /* Redirect call to desktop-widget: */
    317     return QApplication::desktop()->height();
    318 #endif
    319 }
    320 
    321 /* static */
    322298int UIDesktopWidgetWatchdog::screenCount()
    323299{
    324300    return QGuiApplication::screens().size();
    325 }
    326 
    327 /** Helper for generating qt5 screen indexes as best as we can. */
    328 static int screenToIndex(QScreen *pScreen)
    329 {
    330     if (pScreen)
    331     {
    332         /** @todo Not at all sure about the sensitibility of this.   */
    333         QList<QScreen *> screenList = QGuiApplication::screens();
    334         unsigned         iScreen    = 0;
    335         foreach (QScreen *pCurScreen, screenList)
    336         {
    337             if (   pCurScreen == pScreen
    338                 || (   pCurScreen->geometry() == pScreen->geometry()
    339                     && pCurScreen->serialNumber() == pScreen->serialNumber()))
    340                 return iScreen;
    341             iScreen++;
    342         }
    343     }
    344     return -1;
    345301}
    346302
     
    524480    /* Return region: */
    525481    return region;
     482}
     483
     484/* static */
     485int UIDesktopWidgetWatchdog::overallDesktopWidth()
     486{
     487#ifdef VBOX_IS_QT6_OR_LATER
     488    /** @todo bird: Not sure if this is entirely correct. */
     489    return QGuiApplication::primaryScreen()->geometry().width();
     490#else
     491    /* Redirect call to desktop-widget: */
     492    return QApplication::desktop()->width();
     493#endif
     494}
     495
     496/* static */
     497int UIDesktopWidgetWatchdog::overallDesktopHeight()
     498{
     499#ifdef VBOX_IS_QT6_OR_LATER
     500    /** @todo bird: Not sure if this is entirely correct. */
     501    return QGuiApplication::primaryScreen()->geometry().height();
     502#else
     503    /* Redirect call to desktop-widget: */
     504    return QApplication::desktop()->height();
     505#endif
    526506}
    527507
     
    10841064
    10851065/* static */
     1066int UIDesktopWidgetWatchdog::screenToIndex(QScreen *pScreen)
     1067{
     1068    if (pScreen)
     1069    {
     1070        unsigned iScreen = 0;
     1071        foreach (QScreen *pCurScreen, QGuiApplication::screens())
     1072        {
     1073            if (   pCurScreen == pScreen
     1074                || (   pCurScreen->geometry() == pScreen->geometry()
     1075                    && pCurScreen->serialNumber() == pScreen->serialNumber()))
     1076                return iScreen;
     1077            ++iScreen;
     1078        }
     1079    }
     1080    return -1;
     1081}
     1082
     1083/* static */
    10861084QRegion UIDesktopWidgetWatchdog::flip(const QRegion &region)
    10871085{
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIDesktopWidgetWatchdog.h

    r97703 r97704  
    8282    /** Destroys the static instance of the desktop-widget watchdog. */
    8383    static void destroy();
    84 
    85     /** Returns overall desktop width. */
    86     static int overallDesktopWidth();
    87     /** Returns overall desktop height. */
    88     static int overallDesktopHeight();
    8984
    9085    /** Returns the number of host-screens currently available on the system. */
     
    123118    /** Returns overall region unifying all the host-screen available-geometries. */
    124119    QRegion overallAvailableRegion() const;
     120    /** Returns overall desktop width. */
     121    static int overallDesktopWidth();
     122    /** Returns overall desktop height. */
     123    static int overallDesktopHeight();
    125124
    126125#ifdef VBOX_WS_X11
     
    190189    void cleanup();
    191190
     191    /** Returns index of passed @a pScreen. */
     192    static int screenToIndex(QScreen *pScreen);
     193
    192194    /** Returns the flipped (transposed) @a region. */
    193195    static QRegion flip(const QRegion &region);
Note: See TracChangeset for help on using the changeset viewer.

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