VirtualBox

Changeset 51394 in vbox


Ignore:
Timestamp:
May 26, 2014 1:39:05 PM (11 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
93915
Message:

FE/Qt: Global Preferences: Allow to open dialog on predefined page.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialogSpecific.cpp

    r51345 r51394  
    316316UISettingsSerializer* UISettingsSerializer::m_pInstance = 0;
    317317
    318 UISettingsDialogGlobal::UISettingsDialogGlobal(QWidget *pParent)
     318UISettingsDialogGlobal::UISettingsDialogGlobal(QWidget *pParent,
     319                                               const QString &strCategory /* = QString() */,
     320                                               const QString &strControl /* = QString() */)
    319321    : UISettingsDialog(pParent)
    320322{
     
    418420    retranslateUi();
    419421
    420     /* Choose first item by default: */
    421     m_pSelector->selectById(GlobalSettingsPageType_General);
     422    /* Setup settings window: */
     423    if (!strCategory.isNull())
     424    {
     425        m_pSelector->selectByLink(strCategory);
     426        /* Search for a widget with the given name: */
     427        if (!strControl.isNull())
     428        {
     429            printf("Looking for widget %s..\n", strControl.toAscii().constData());
     430            if (QWidget *pWidget = m_pStack->findChild<QWidget*>(strControl))
     431            {
     432                printf("Widget %s found!\n", strControl.toAscii().constData());
     433                QList<QWidget*> parents;
     434                QWidget *pParentWidget = pWidget;
     435                while ((pParentWidget = pParentWidget->parentWidget()) != 0)
     436                {
     437                    if (QTabWidget *pTabWidget = qobject_cast<QTabWidget*>(pParentWidget))
     438                    {
     439                        /* The tab contents widget is two steps down
     440                         * (QTabWidget -> QStackedWidget -> QWidget): */
     441                        QWidget *pTabPage = parents[parents.count() - 1];
     442                        if (pTabPage)
     443                            pTabPage = parents[parents.count() - 2];
     444                        if (pTabPage)
     445                            pTabWidget->setCurrentWidget(pTabPage);
     446                    }
     447                    parents.append(pParentWidget);
     448                }
     449                pWidget->setFocus();
     450            }
     451        }
     452    }
     453    /* First item as default: */
     454    else
     455        m_pSelector->selectById(GlobalSettingsPageType_General);
    422456}
    423457
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialogSpecific.h

    r50906 r51394  
    3636public:
    3737
    38     UISettingsDialogGlobal(QWidget *pParent);
     38    UISettingsDialogGlobal(QWidget *pParent,
     39                           const QString &strCategory = QString(),
     40                           const QString &strControl = QString());
    3941    ~UISettingsDialogGlobal();
    4042
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