Commit 10020cb1 authored by WINTZ Julien's avatar WINTZ Julien

Better DIY Menu Item API.

parent c2c0e283
......@@ -36,6 +36,12 @@ public:
// dtkWidgetsMenuItemDIY implementation
// ///////////////////////////////////////////////////////////////////
dtkWidgetsMenuItemDIY::dtkWidgetsMenuItemDIY(const QString& title) : dtkWidgetsMenuItemCustom(title), d(new dtkWidgetsMenuItemDIYPrivate)
{
d->source = new QWidget;
d->source->setLayout(new QVBoxLayout);
}
dtkWidgetsMenuItemDIY::dtkWidgetsMenuItemDIY(const QString& title, QWidget *widget) : dtkWidgetsMenuItemCustom(title), d(new dtkWidgetsMenuItemDIYPrivate)
{
d->source = widget;
......@@ -46,6 +52,16 @@ dtkWidgetsMenuItemDIY::~dtkWidgetsMenuItemDIY(void)
delete d;
}
void dtkWidgetsMenuItemDIY::addLayout(QLayout *layout)
{
d->source->layout()->addItem(layout);
}
void dtkWidgetsMenuItemDIY::addWidget(QWidget *widget)
{
d->source->layout()->addWidget(widget);
}
QWidget *dtkWidgetsMenuItemDIY::widget(void)
{
if (!d->widget) {
......
......@@ -27,12 +27,17 @@ class DTKWIDGETS_EXPORT dtkWidgetsMenuItemDIY : public dtkWidgetsMenuItemCustom
Q_OBJECT
public:
dtkWidgetsMenuItemDIY(const QString& title);
dtkWidgetsMenuItemDIY(const QString& title, QWidget *widget);
~dtkWidgetsMenuItemDIY(void);
public:
QWidget *widget(void) override;
public:
void addLayout(QLayout *);
void addWidget(QWidget *);
public:
void setShowTitle(bool);
bool showTitle(void);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment