revert: unique_ptr actionbox
This commit is contained in:
@@ -8,28 +8,24 @@
|
||||
#include "actionbox.h"
|
||||
|
||||
#include <QVariant>
|
||||
#include <memory>
|
||||
|
||||
namespace QSint
|
||||
{
|
||||
|
||||
ActionBox::ActionBox(QWidget *parent)
|
||||
: QFrame(parent),
|
||||
dataLayout(std::make_unique<QVBoxLayout>())
|
||||
: QFrame(parent)
|
||||
{
|
||||
init();
|
||||
}
|
||||
|
||||
ActionBox::ActionBox(const QString & headerText, QWidget *parent)
|
||||
: QFrame(parent),
|
||||
dataLayout(std::make_unique<QVBoxLayout>() )
|
||||
: QFrame(parent)
|
||||
{
|
||||
init(headerText);
|
||||
}
|
||||
|
||||
ActionBox::ActionBox(const QPixmap & icon, const QString & headerText, QWidget *parent)
|
||||
: QFrame(parent),
|
||||
dataLayout(std::make_unique<QVBoxLayout>())
|
||||
: QFrame(parent)
|
||||
{
|
||||
init(headerText);
|
||||
setIcon(icon);
|
||||
@@ -48,7 +44,8 @@ void ActionBox::init(const QString &headerText)
|
||||
iconLayout->addWidget(iconLabel);
|
||||
iconLayout->addStretch();
|
||||
|
||||
mainLayout->addLayout(dataLayout.get());
|
||||
dataLayout = new QVBoxLayout();
|
||||
mainLayout->addLayout(dataLayout);
|
||||
|
||||
headerLabel = createItem(headerText);
|
||||
headerLabel->setProperty("class", "header");
|
||||
|
||||
@@ -121,7 +121,7 @@ public:
|
||||
* @brief Returns the default layout used for actions.
|
||||
* @return The default layout.
|
||||
*/
|
||||
inline QLayout* itemLayout() const { return dataLayout.get(); }
|
||||
inline QLayout* itemLayout() const { return dataLayout; }
|
||||
|
||||
/**
|
||||
* @brief Adds a layout.
|
||||
@@ -150,9 +150,9 @@ protected:
|
||||
*/
|
||||
void init(const QString &headerText = QString());
|
||||
|
||||
std::unique_ptr<QVBoxLayout> dataLayout; ///< Default layout for actions/widgets.
|
||||
QLabel *iconLabel = nullptr; ///< Label for the ActionBox icon.
|
||||
ActionLabel *headerLabel = nullptr; ///< Label for the header.
|
||||
QVBoxLayout *dataLayout; ///< Default layout for actions/widgets.
|
||||
QLabel *iconLabel; ///< Label for the ActionBox icon.
|
||||
ActionLabel *headerLabel; ///< Label for the header.
|
||||
};
|
||||
} // namespace
|
||||
|
||||
|
||||
Reference in New Issue
Block a user