VirtualBox

Changeset 71866 in vbox for trunk


Ignore:
Timestamp:
Apr 16, 2018 2:23:01 PM (7 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9049: Full and heavy cleanup for QILabelSeparator and move it to VBoxGlobal library.

Location:
trunk/src/VBox/Frontends/VirtualBox
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/Makefile.kmk

    r71865 r71866  
    441441        src/UITakeSnapshotDialog.h \
    442442        src/extensions/QIFlowLayout.h \
    443         src/extensions/QILabelSeparator.h \
    444443        src/extensions/QIMainDialog.h \
    445444        src/extensions/QIManagerDialog.h \
     
    658657        src/extensions/QIFileDialog.h \
    659658        src/extensions/QILabel.h \
     659        src/extensions/QILabelSeparator.h \
    660660        src/extensions/QIMainWindow.h \
    661661        src/extensions/QIMessageBox.h \
     
    732732        src/extensions/QIFileDialog.h \
    733733        src/extensions/QILabel.h \
     734        src/extensions/QILabelSeparator.h \
    734735        src/extensions/QIMainWindow.h \
    735736        src/extensions/QIMessageBox.h \
     
    906907        src/UITakeSnapshotDialog.cpp \
    907908        src/extensions/QIFlowLayout.cpp \
    908         src/extensions/QILabelSeparator.cpp \
    909909        src/extensions/QILineEdit.cpp \
    910910        src/extensions/QIMainDialog.cpp \
     
    11561156        src/extensions/QIFileDialog.cpp \
    11571157        src/extensions/QILabel.cpp \
     1158        src/extensions/QILabelSeparator.cpp \
    11581159        src/extensions/QIMainWindow.cpp \
    11591160        src/extensions/QIMessageBox.cpp \
     
    12571258        src/extensions/QIFileDialog.cpp \
    12581259        src/extensions/QILabel.cpp \
     1260        src/extensions/QILabelSeparator.cpp \
    12591261        src/extensions/QIMainWindow.cpp \
    12601262        src/extensions/QIMessageBox.cpp \
  • trunk/src/VBox/Frontends/VirtualBox/src/extensions/QILabelSeparator.cpp

    r69500 r71866  
    11/* $Id$ */
    22/** @file
    3  * VBox Qt GUI - VirtualBox Qt extensions: QILabelSeparator class implementation.
     3 * VBox Qt GUI - Qt extensions: QILabelSeparator class implementation.
    44 */
    55
    66/*
    7  * Copyright (C) 2008-2017 Oracle Corporation
     7 * Copyright (C) 2008-2018 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    2020#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
    2121
    22 /* Global includes */
     22/* Qt includes: */
     23# include <QHBoxLayout>
    2324# include <QLabel>
    24 # include <QHBoxLayout>
    2525
    26 /* Local includes */
     26/* GUI includes: */
    2727# include "QILabelSeparator.h"
    2828
     
    3030
    3131
    32 QILabelSeparator::QILabelSeparator (QWidget *aParent /* = NULL */, Qt::WindowFlags aFlags /* = 0 */)
    33     : QWidget (aParent, aFlags)
    34     , mLabel (0)
     32QILabelSeparator::QILabelSeparator(QWidget *pParent /* = 0 */, Qt::WindowFlags fFlags /* = 0 */)
     33    : QWidget(pParent, fFlags)
     34    , m_pLabel(0)
    3535{
    36     init();
     36    prepare();
    3737}
    3838
    39 QILabelSeparator::QILabelSeparator (const QString &aText, QWidget *aParent /* = NULL */, Qt::WindowFlags aFlags /* = 0 */)
    40     : QWidget (aParent, aFlags)
    41     , mLabel (0)
     39QILabelSeparator::QILabelSeparator(const QString &strText, QWidget *pParent /* = 0 */, Qt::WindowFlags fFlags /* = 0 */)
     40    : QWidget(pParent, fFlags)
     41    , m_pLabel(0)
    4242{
    43     init();
    44     setText (aText);
     43    prepare();
     44    setText(strText);
    4545}
    4646
    4747QString QILabelSeparator::text() const
    4848{
    49     return mLabel->text();
     49    return m_pLabel->text();
    5050}
    5151
    52 void QILabelSeparator::setBuddy (QWidget *aBuddy)
     52void QILabelSeparator::setBuddy(QWidget *pBuddy)
    5353{
    54     mLabel->setBuddy (aBuddy);
     54    m_pLabel->setBuddy(pBuddy);
    5555}
    5656
    5757void QILabelSeparator::clear()
    5858{
    59     mLabel->clear();
     59    m_pLabel->clear();
    6060}
    6161
    62 void QILabelSeparator::setText (const QString &aText)
     62void QILabelSeparator::setText(const QString &strText)
    6363{
    64     mLabel->setText (aText);
     64    m_pLabel->setText(strText);
    6565}
    6666
    67 void QILabelSeparator::init()
     67void QILabelSeparator::prepare()
    6868{
    69     mLabel = new QLabel();
    70     QFrame *separator = new QFrame();
    71     separator->setFrameShape (QFrame::HLine);
    72     separator->setFrameShadow (QFrame::Sunken);
    73     separator->setEnabled (false);
    74     separator->setContentsMargins (0, 0, 0, 0);
    75     // separator->setStyleSheet ("QFrame {border: 1px outset black; }");
    76     separator->setSizePolicy (QSizePolicy::MinimumExpanding, QSizePolicy::Preferred);
     69    /* Create layout: */
     70    QHBoxLayout *pLayout = new QHBoxLayout(this);
     71    if (pLayout)
     72    {
     73        /* Configure layout: */
     74        pLayout->setContentsMargins(0, 0, 0, 0);
    7775
    78     QHBoxLayout *pLayout = new QHBoxLayout (this);
    79     pLayout->setContentsMargins(0, 0, 0, 0);
    80     pLayout->addWidget (mLabel);
    81     pLayout->addWidget (separator, Qt::AlignBottom);
     76        /* Create label: */
     77        m_pLabel = new QLabel;
     78        if (m_pLabel)
     79        {
     80            /* Add into layout: */
     81            pLayout->addWidget(m_pLabel);
     82        }
     83
     84        /* Create separator: */
     85        QFrame *pSeparator = new QFrame;
     86        {
     87            /* Configure separator: */
     88            pSeparator->setFrameShape(QFrame::HLine);
     89            pSeparator->setFrameShadow(QFrame::Sunken);
     90            pSeparator->setEnabled(false);
     91            pSeparator->setContentsMargins(0, 0, 0, 0);
     92            // pSeparator->setStyleSheet("QFrame {border: 1px outset black; }");
     93            pSeparator->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred);
     94
     95            /* Add into layout: */
     96            pLayout->addWidget(pSeparator, Qt::AlignBottom);
     97        }
     98    }
    8299}
    83 
  • trunk/src/VBox/Frontends/VirtualBox/src/extensions/QILabelSeparator.h

    r69500 r71866  
    55
    66/*
    7  * Copyright (C) 2008-2017 Oracle Corporation
     7 * Copyright (C) 2008-2018 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    1616 */
    1717
    18 #ifndef __QILabelSeparator_h__
    19 #define __QILabelSeparator_h__
     18#ifndef ___QILabelSeparator_h___
     19#define ___QILabelSeparator_h___
    2020
    21 /* Global includes */
     21/* Qt includes: */
    2222#include <QWidget>
    2323
    24 /* Global forwards */
     24/* GUI inlcudes: */
     25#include "UILibraryDefs.h"
     26
     27/* Forward declarations: */
    2528class QLabel;
     29class QString;
     30class QWidget;
    2631
    27 class QILabelSeparator: public QWidget
     32/** QWidget extension providing GUI with label-separator. */
     33class SHARED_LIBRARY_STUFF QILabelSeparator : public QWidget
    2834{
    2935    Q_OBJECT;
     
    3137public:
    3238
    33     QILabelSeparator (QWidget *aParent = 0, Qt::WindowFlags aFlags = 0);
    34     QILabelSeparator (const QString &aText, QWidget *aParent = 0, Qt::WindowFlags aFlags = 0);
     39    /** Constructs label-separator passing @a pParent and @a fFlags to the base-class. */
     40    QILabelSeparator(QWidget *pParent = 0, Qt::WindowFlags fFlags = 0);
     41    /** Constructs label-separator passing @a pParent and @a fFlags to the base-class.
     42      * @param  strText  Brings the label text. */
     43    QILabelSeparator(const QString &strText, QWidget *pParent = 0, Qt::WindowFlags fFlags = 0);
    3544
     45    /** Returns the label text. */
    3646    QString text() const;
    37     void setBuddy (QWidget *aBuddy);
     47    /** Defines the label buddy. */
     48    void setBuddy(QWidget *pBuddy);
    3849
    3950public slots:
    4051
     52    /** Clears the label text. */
    4153    void clear();
    42     void setText (const QString &aText);
     54    /** Defines the label @a strText. */
     55    void setText(const QString &strText);
    4356
    4457protected:
    4558
    46     virtual void init();
     59    /** Prepares all. */
     60    virtual void prepare();
    4761
    48     QLabel *mLabel;
     62    /** Holds the label instance. */
     63    QLabel *m_pLabel;
    4964};
    5065
    51 #endif // __QILabelSeparator_h__
    52 
     66#endif /* !___QILabelSeparator_h___ */
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