Commit 51e44eb4 authored by LE BRETON Come's avatar LE BRETON Come

Fix build again of menubar : make sure headers are added.

parent 96d2669c
......@@ -184,7 +184,8 @@ void dtkWidgetsMenuItemFacade::paintEvent(QPaintEvent *event)
void dtkWidgetsMenuItemFacade::mousePressEvent(QMouseEvent *)
{
qDebug() << Q_FUNC_INFO;
if( menu_item->isCustom())
return;
emit clicked();
}
......
......@@ -363,6 +363,15 @@ void dtkWidgetsMenuBarContainerSlide::update(dtkWidgetsMenuBar *bar)
bool got = 0;
for(int i = 0; i < this->layout()->count(); i++)
if(this->layout()->itemAt(i)->widget() == header)
got = true;
if(!got)
this->layout()->addWidget(header);
got = 0;
for(int i = 0; i < this->layout()->count(); i++)
if(this->layout()->itemAt(i)->widget() == widget)
got = true;
......
......@@ -25,7 +25,8 @@ class DTKWIDGETS_EXPORT dtkWidgetsMenuItemDIY : public dtkWidgetsMenuItemCustom
Q_OBJECT
public:
dtkWidgetsMenuItemDIY(const QString& title, QWidget *widget) : dtkWidgetsMenuItemCustom(title), m_widget(widget) {
dtkWidgetsMenuItemDIY(const QString& title, QWidget *widget) : dtkWidgetsMenuItemCustom(title), s_widget(widget)
{
}
......@@ -34,12 +35,25 @@ public:
}
public:
QWidget *widget(void) {
return m_widget;
QWidget *widget(void) override {
if( this->title().isEmpty())
return s_widget;
if(!this->d_widget) {
this->d_widget = new QWidget;
QFormLayout *layout = new QFormLayout;
layout->addRow(this->title(), this->s_widget);
d_widget->setLayout(layout);
}
return d_widget;
};
private:
QWidget *m_widget = nullptr;
QWidget *s_widget = nullptr;
QWidget *d_widget = nullptr;
};
// /////////////////////////////////////////////////////////////////////////////
......
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