revert: unique_ptr actionbox

This commit is contained in:
Alfredo Monclus
2025-02-16 19:51:59 -03:00
parent 1500082923
commit 188b782147
2 changed files with 9 additions and 12 deletions

View File

@@ -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");

View File

@@ -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