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

Extending menu framework

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