Commit 0acc25f6 authored by SZPYRKA Jean-Luc's avatar SZPYRKA Jean-Luc
Browse files

Merge branch 'feature/programmatic-toggle-menubar' into 'develop'

added the option to programmatically expand and collapse the menu bar.

See merge request !58
parents 79914934 a84cf7bb
Pipeline #135140 passed with stage
in 0 seconds
......@@ -714,6 +714,27 @@ dtkWidgetsMenuBar::dtkWidgetsMenuBar(QWidget *parent) : QFrame(parent), d(new dt
this->setFixedWidth(d->size + 2 * d->margin);
}
void dtkWidgetsMenuBar::toggle(void)
{
d->toggle->collapsed = !d->toggle->collapsed;
emit d->toggle->clicked();
d->toggle->touch();
}
void dtkWidgetsMenuBar::collapse(void)
{
if (d->toggle->collapsed == false) {
this->toggle();
}
}
void dtkWidgetsMenuBar::expand(void)
{
if (d->toggle->collapsed) {
this->toggle();
}
}
dtkWidgetsMenuBar::~dtkWidgetsMenuBar(void)
{
delete d;
......
......@@ -101,14 +101,19 @@ public:
void setOffset(int);
#pragma mark - Dynamism
public slots:
void touch(void);
void decr(void);
public:
public slots:
void toggle(void);
void collapse(void);
void expand(void);
public:
void reset(void);
protected:
void resizeEvent(QResizeEvent *) override;
void mousePressEvent(QMouseEvent *event) override;
......@@ -123,7 +128,7 @@ protected:
friend class dtkWidgetsMenuBarContainer;
friend class dtkWidgetsMenuBarContainerSlide;
private:
private:
friend QDebug operator<<(QDebug debug, const dtkWidgetsMenuBar &c);
friend QDebug operator<<(QDebug debug, dtkWidgetsMenuBar *c);
};
......
Supports Markdown
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