Commit 520c36a9 authored by WINTZ Julien's avatar WINTZ Julien

Extending menu framework

parent cc00ff72
......@@ -29,6 +29,7 @@ public:
QWidget *widget = nullptr;
QSizePolicy::Policy policy = QSizePolicy::Fixed;
bool show_title = true;
};
......@@ -54,12 +55,14 @@ dtkWidgetsMenuItemDIY::~dtkWidgetsMenuItemDIY(void)
void dtkWidgetsMenuItemDIY::addLayout(QLayout *layout)
{
d->source->layout()->addItem(layout);
if(QBoxLayout *l = dynamic_cast<QBoxLayout *>(d->source->layout()))
l->addLayout(layout);
}
void dtkWidgetsMenuItemDIY::addWidget(QWidget *widget)
{
d->source->layout()->addWidget(widget);
if(QBoxLayout *l = dynamic_cast<QBoxLayout *>(d->source->layout()))
l->addWidget(widget);
}
QWidget *dtkWidgetsMenuItemDIY::widget(void)
......@@ -70,8 +73,10 @@ QWidget *dtkWidgetsMenuItemDIY::widget(void)
} else {
d->widget = new QWidget;
QFormLayout *layout = new QFormLayout;
layout->addRow(this->title(), d->source);
QVBoxLayout *layout = new QVBoxLayout;
layout->addWidget(new QLabel(this->title()));
layout->addWidget(d->source);
d->widget->setLayout(layout);
}
}
......
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