VirtualBox

Changeset 67375 in vbox for trunk/src


Ignore:
Timestamp:
Jun 13, 2017 2:57:26 PM (8 years ago)
Author:
vboxsync
Message:

FE/Qt: Selector UI: Tools pane: Snapshot pane: Using the flow-layout for snapshot details elements.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/UISnapshotDetailsWidget.cpp

    r67374 r67375  
    3737
    3838/* GUI includes: */
     39# include "QIFlowLayout.h"
    3940# include "UIConverter.h"
    4041# include "UIDesktopWidgetWatchdog.h"
     
    566567        const CMachine comMachine = m_comSnapshot.GetMachine();
    567568
    568         /* Translate the picture tool-tip: */
    569         const QString strToolTip = m_pixmapScreenshot.isNull() ? QString() : tr("Click to enlarge the screenshot.");
    570         m_details.value(DetailsElementType_Preview)->setToolTip(strToolTip);
     569        /* Update the picture tool-tip and visibility: */
     570        m_details.value(DetailsElementType_Preview)->setToolTip(tr("Click to enlarge the screenshot."));
     571        if (!m_pixmapScreenshot.isNull() && m_details.value(DetailsElementType_Preview)->isHidden())
     572            m_details.value(DetailsElementType_Preview)->setHidden(false);
     573        else if (m_pixmapScreenshot.isNull() && !m_details.value(DetailsElementType_Preview)->isHidden())
     574            m_details.value(DetailsElementType_Preview)->setHidden(true);
    571575
    572576        /* Rebuild the details report: */
     
    576580    else
    577581    {
    578         /* Clear the picture tool-tip: */
    579         m_details.value(DetailsElementType_Preview)->setToolTip(QString());
    580 
    581582        /* Clear the details report: */
    582583        // WORKAROUND:
     
    766767        {
    767768            /* Create 'Details' layout: */
    768             m_pLayoutDetails = new QGridLayout(pWidgetDetails);
     769            m_pLayoutDetails = new QVBoxLayout(pWidgetDetails);
    769770            AssertPtrReturnVoid(m_pLayoutDetails);
    770771            {
    771                 /* Configure layout: */
    772                 m_pLayoutDetails->setSpacing(5);
    773 
    774                 /* Create 'General' element: */
    775                 m_details[DetailsElementType_General] = createDetailsElement(DetailsElementType_General);
    776                 AssertPtrReturnVoid(m_details[DetailsElementType_General]);
    777                 m_pLayoutDetails->addWidget(m_details[DetailsElementType_General], 0, 0);
    778 
    779                 /* Create 'System' element: */
    780                 m_details[DetailsElementType_System] = createDetailsElement(DetailsElementType_System);
    781                 AssertPtrReturnVoid(m_details[DetailsElementType_System]);
    782                 m_pLayoutDetails->addWidget(m_details[DetailsElementType_System], 1, 0);
    783 
    784                 /* Create 'Preview' element: */
    785                 m_details[DetailsElementType_Preview] = createDetailsElement(DetailsElementType_Preview);
    786                 AssertPtrReturnVoid(m_details[DetailsElementType_Preview]);
    787                 connect(m_details[DetailsElementType_Preview], &UISnapshotDetailsElement::sigAnchorClicked,
    788                         this, &UISnapshotDetailsWidget::sltHandleAnchorClicked);
    789                 m_pLayoutDetails->addWidget(m_details[DetailsElementType_Preview], 0, 1, 2, 1);
    790 
    791                 /* Create 'Display' element: */
    792                 m_details[DetailsElementType_Display] = createDetailsElement(DetailsElementType_Display);
    793                 AssertPtrReturnVoid(m_details[DetailsElementType_Display]);
    794                 m_pLayoutDetails->addWidget(m_details[DetailsElementType_Display], 2, 0, 1, 2);
    795 
    796                 /* Create 'Storage' element: */
    797                 m_details[DetailsElementType_Storage] = createDetailsElement(DetailsElementType_Storage);
    798                 AssertPtrReturnVoid(m_details[DetailsElementType_Storage]);
    799                 m_pLayoutDetails->addWidget(m_details[DetailsElementType_Storage], 3, 0, 1, 2);
    800 
    801                 /* Create 'Audio' element: */
    802                 m_details[DetailsElementType_Audio] = createDetailsElement(DetailsElementType_Audio);
    803                 AssertPtrReturnVoid(m_details[DetailsElementType_Audio]);
    804                 m_pLayoutDetails->addWidget(m_details[DetailsElementType_Audio], 4, 0, 1, 2);
    805 
    806                 /* Create 'Network' element: */
    807                 m_details[DetailsElementType_Network] = createDetailsElement(DetailsElementType_Network);
    808                 AssertPtrReturnVoid(m_details[DetailsElementType_Network]);
    809                 m_pLayoutDetails->addWidget(m_details[DetailsElementType_Network], 5, 0, 1, 2);
    810 
    811                 /* Create 'Serial' element: */
    812                 m_details[DetailsElementType_Serial] = createDetailsElement(DetailsElementType_Serial);
    813                 AssertPtrReturnVoid(m_details[DetailsElementType_Serial]);
    814                 m_pLayoutDetails->addWidget(m_details[DetailsElementType_Serial], 6, 0, 1, 2);
     772                /* Create flow-layout 1: */
     773                QIFlowLayout *pLayoutForm1 = new QIFlowLayout;
     774                AssertPtrReturnVoid(pLayoutForm1);
     775                {
     776                    /* Create left widget: */
     777                    QWidget *pWidgetLeft = new QWidget;
     778                    AssertPtrReturnVoid(pWidgetLeft);
     779                    {
     780                        /* Create left layout: */
     781                        QVBoxLayout *pLayoutLeft = new QVBoxLayout(pWidgetLeft);
     782                        AssertPtrReturnVoid(pLayoutLeft);
     783                        {
     784                            /* Configure layout: */
     785                            pLayoutLeft->setContentsMargins(0, 0, 0, 0);
     786
     787                            /* Create 'General' element: */
     788                            m_details[DetailsElementType_General] = createDetailsElement(DetailsElementType_General);
     789                            AssertPtrReturnVoid(m_details[DetailsElementType_General]);
     790                            pLayoutLeft->addWidget(m_details[DetailsElementType_General]);
     791
     792                            /* Create 'System' element: */
     793                            m_details[DetailsElementType_System] = createDetailsElement(DetailsElementType_System);
     794                            AssertPtrReturnVoid(m_details[DetailsElementType_System]);
     795                            pLayoutLeft->addWidget(m_details[DetailsElementType_System]);
     796                        }
     797
     798                        /* Add to layout: */
     799                        pLayoutForm1->addWidget(pWidgetLeft);
     800                    }
     801
     802                    /* Create right widget: */
     803                    QWidget *pWidgetRight = new QWidget;
     804                    AssertPtrReturnVoid(pWidgetRight);
     805                    {
     806                        /* Create right layout: */
     807                        QVBoxLayout *pLayoutRight = new QVBoxLayout(pWidgetRight);
     808                        AssertPtrReturnVoid(pLayoutRight);
     809                        {
     810                            /* Configure layout: */
     811                            pLayoutRight->setContentsMargins(0, 0, 0, 0);
     812
     813                            /* Create 'Preview' element: */
     814                            m_details[DetailsElementType_Preview] = createDetailsElement(DetailsElementType_Preview);
     815                            AssertPtrReturnVoid(m_details[DetailsElementType_Preview]);
     816                            connect(m_details[DetailsElementType_Preview], &UISnapshotDetailsElement::sigAnchorClicked,
     817                                    this, &UISnapshotDetailsWidget::sltHandleAnchorClicked);
     818                            pLayoutRight->addWidget(m_details[DetailsElementType_Preview]);
     819                            pLayoutRight->addStretch();
     820                        }
     821
     822                        /* Add to layout: */
     823                        pLayoutForm1->addWidget(pWidgetRight);
     824                    }
     825
     826                    /* Add into layout: */
     827                    m_pLayoutDetails->addLayout(pLayoutForm1);
     828                }
     829
     830                /* Create form layout 2: */
     831                QIFlowLayout *pLayoutForm2 = new QIFlowLayout;
     832                {
     833                    /* Create 'Display' element: */
     834                    m_details[DetailsElementType_Display] = createDetailsElement(DetailsElementType_Display);
     835                    AssertPtrReturnVoid(m_details[DetailsElementType_Display]);
     836                    pLayoutForm2->addWidget(m_details[DetailsElementType_Display]);
     837
     838                    /* Create 'Audio' element: */
     839                    m_details[DetailsElementType_Audio] = createDetailsElement(DetailsElementType_Audio);
     840                    AssertPtrReturnVoid(m_details[DetailsElementType_Audio]);
     841                    pLayoutForm2->addWidget(m_details[DetailsElementType_Audio]);
     842
     843                    /* Add into layout: */
     844                    m_pLayoutDetails->addLayout(pLayoutForm2);
     845                }
     846
     847                /* Create form layout 3: */
     848                QIFlowLayout *pLayoutForm3 = new QIFlowLayout;
     849                {
     850                    /* Create 'Storage' element: */
     851                    m_details[DetailsElementType_Storage] = createDetailsElement(DetailsElementType_Storage);
     852                    AssertPtrReturnVoid(m_details[DetailsElementType_Storage]);
     853                    pLayoutForm3->addWidget(m_details[DetailsElementType_Storage]);
     854
     855                    /* Create 'Network' element: */
     856                    m_details[DetailsElementType_Network] = createDetailsElement(DetailsElementType_Network);
     857                    AssertPtrReturnVoid(m_details[DetailsElementType_Network]);
     858                    pLayoutForm3->addWidget(m_details[DetailsElementType_Network]);
     859
     860                    /* Add into layout: */
     861                    m_pLayoutDetails->addLayout(pLayoutForm3);
     862                }
     863
     864                /* Create form layout 4: */
     865                QIFlowLayout *pLayoutForm4 = new QIFlowLayout;
     866                {
     867                    /* Create 'Serial' element: */
     868                    m_details[DetailsElementType_Serial] = createDetailsElement(DetailsElementType_Serial);
     869                    AssertPtrReturnVoid(m_details[DetailsElementType_Serial]);
     870                    pLayoutForm4->addWidget(m_details[DetailsElementType_Serial]);
    815871
    816872#ifdef VBOX_WITH_PARALLEL_PORTS
    817                 /* Create 'Parallel' element: */
    818                 m_details[DetailsElementType_Parallel] = createDetailsElement(DetailsElementType_Parallel);
    819                 AssertPtrReturnVoid(m_details[DetailsElementType_Parallel]);
    820                 m_pLayoutDetails->addWidget(m_details[DetailsElementType_Parallel], 7, 0, 1, 2);
     873                    /* Create 'Parallel' element: */
     874                    m_details[DetailsElementType_Parallel] = createDetailsElement(DetailsElementType_Parallel);
     875                    AssertPtrReturnVoid(m_details[DetailsElementType_Parallel]);
     876                    pLayoutForm4->addWidget(m_details[DetailsElementType_Parallel]);
    821877#endif
    822878
    823                 /* Create 'USB' element: */
    824                 m_details[DetailsElementType_USB] = createDetailsElement(DetailsElementType_USB);
    825                 AssertPtrReturnVoid(m_details[DetailsElementType_USB]);
    826                 m_pLayoutDetails->addWidget(m_details[DetailsElementType_USB], 8, 0, 1, 2);
    827 
    828                 /* Create 'SF' element: */
    829                 m_details[DetailsElementType_SF] = createDetailsElement(DetailsElementType_SF);
    830                 AssertPtrReturnVoid(m_details[DetailsElementType_SF]);
    831                 m_pLayoutDetails->addWidget(m_details[DetailsElementType_SF], 9, 0, 1, 2);
     879                    /* Create 'USB' element: */
     880                    m_details[DetailsElementType_USB] = createDetailsElement(DetailsElementType_USB);
     881                    AssertPtrReturnVoid(m_details[DetailsElementType_USB]);
     882                    pLayoutForm4->addWidget(m_details[DetailsElementType_USB]);
     883
     884                    /* Create 'SF' element: */
     885                    m_details[DetailsElementType_SF] = createDetailsElement(DetailsElementType_SF);
     886                    AssertPtrReturnVoid(m_details[DetailsElementType_SF]);
     887                    pLayoutForm4->addWidget(m_details[DetailsElementType_SF]);
     888
     889                    /* Add into layout: */
     890                    m_pLayoutDetails->addLayout(pLayoutForm4);
     891                }
    832892            }
    833893
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/UISnapshotDetailsWidget.h

    r67312 r67375  
    3737class QTabWidget;
    3838class QTextEdit;
     39class QVBoxLayout;
    3940class QWidget;
    4041class UISnapshotDetailsElement;
     
    169170
    170171    /** Holds the 'Details' layout instance. */
    171     QGridLayout *m_pLayoutDetails;
     172    QVBoxLayout *m_pLayoutDetails;
    172173
    173174    /** Holds the details scroll-area instance. */
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