Commit 182672b5 authored by LE BRETON Come's avatar LE BRETON Come

Merge branch 'feature/new-dtk-widgets' into 'develop'

Feature/new dtk widgets

See merge request !16
parents 1969a3d1 3e3e357e
......@@ -132,7 +132,9 @@ void setup(dtkApplication *application)
menubar_generator_1.populate(application->window()->menubar());
menubar_generator_2.populate(application->window()->menubar());
application->window()->menubar()->build();
application->window()->populate();
application->window()->menubar()->touch();
}
//
......
......@@ -49,7 +49,7 @@ public:
this->menubar->addMenu(menu_1);
this->menubar->addMenu(menu_2);
this->menubar->addMenu(menu_3);
this->menubar->build();
this->menubar->touch();
};
~dummyWorkspaceA(void) {};
......@@ -191,7 +191,7 @@ dummyWindow::dummyWindow(QWidget *parent) : QFrame(parent)
this->menubar->addMenu(this->menu_1);
this->menubar->addMenu(this->menu_2);
this->menubar->addMenu(this->menu_3);
this->menubar->build();
this->menubar->touch();
QHBoxLayout *l = new QHBoxLayout(this);
l->setContentsMargins(0, 0, 0, 0);
......
......@@ -19,6 +19,7 @@
#include "dtkWidgetsWidget.h"
#include <dtkFonts>
#include <dtkThemes>
#include <QtCore>
#include <QtWidgets>
......@@ -27,29 +28,32 @@
// dtkWidgetsLayoutItemButton
// ///////////////////////////////////////////////////////////////////
class dtkWidgetsLayoutItemButton : public QLabel
class dtkWidgetsLayoutItemButton : public QFrame
{
Q_OBJECT
public:
dtkWidgetsLayoutItemButton(fa::icon icon, QWidget *parent = Q_NULLPTR);
dtkWidgetsLayoutItemButton(fa::icon icon, QWidget *parent = nullptr);
~dtkWidgetsLayoutItemButton(void);
signals:
void clicked(void);
public:
QSize sizeHint(void) const;
QSize sizeHint(void) const override;
protected:
void mousePressEvent(QMouseEvent *);
void mousePressEvent(QMouseEvent *) override;
void paintEvent(QPaintEvent *) override;
private:
fa::icon m_icon;
};
dtkWidgetsLayoutItemButton::dtkWidgetsLayoutItemButton(fa::icon icon, QWidget *parent) : QLabel(parent)
dtkWidgetsLayoutItemButton::dtkWidgetsLayoutItemButton(fa::icon icon, QWidget *parent) : QFrame(parent)
{
dtkFontAwesome::instance()->initFontAwesome();
this->setPixmap(dtkFontAwesome::instance()->icon(icon).pixmap(this->sizeHint()));
this->m_icon = icon;
}
dtkWidgetsLayoutItemButton::~dtkWidgetsLayoutItemButton(void)
......@@ -67,6 +71,18 @@ void dtkWidgetsLayoutItemButton::mousePressEvent(QMouseEvent *)
emit clicked();
}
void dtkWidgetsLayoutItemButton::paintEvent(QPaintEvent *event)
{
QFrame::paintEvent(event);
QPainter painter(this);
painter.setRenderHints(QPainter::Antialiasing);
dtkFontAwesome::instance()->setDefaultOption("color", dtkThemesEngine::instance()->color("@fg"));
painter.drawPixmap(0, 0, 16, 16, dtkFontAwesome::instance()->icon(m_icon).pixmap(16, 16));
}
// ///////////////////////////////////////////////////////////////////
// dtkWidgetsLayoutItemProxy
// ///////////////////////////////////////////////////////////////////
......
......@@ -20,6 +20,7 @@
#include <dtkFonts>
#include <dtkThemes>
#include <dtkCore>
class dtkWidgetsMainWindowPrivate
{
......@@ -27,10 +28,10 @@ public:
dtkWidgetsMenuBar *menubar = nullptr;
public:
dtkWidgetsMenu *menu_files;
dtkWidgetsMenu *menu_window;
dtkWidgetsMenu *menu_themes;
dtkWidgetsMenu *menu_about;
dtkWidgetsMenu *menu_files = nullptr;
dtkWidgetsMenu *menu_window = nullptr;
dtkWidgetsMenu *menu_themes = nullptr;
dtkWidgetsMenu *menu_about = nullptr;
};
dtkWidgetsMainWindow::dtkWidgetsMainWindow(QWidget *parent) : dtkThemesWidgetsMainWindow(parent)
......@@ -94,8 +95,8 @@ dtkWidgetsMenu *dtkWidgetsMainWindow::populateThemesMenu(void)
d->menu_themes = d->menubar->addMenu(fa::paintbrush, "Themes");
foreach (const QString theme, dtkThemesEngine::instance()->themes()) {
connect(static_cast<dtkWidgetsMenuItemCustom *>(d->menu_themes->addItem(new dtkWidgetsMenuItemTheme(theme))), &dtkWidgetsMenuItemCustom::clicked, [=] (void) -> void {
for (const QString theme : dtkThemesEngine::instance()->themes()) {
connect(static_cast<dtkWidgetsMenuItem *>(d->menu_themes->addItem(new dtkWidgetsMenuItemTheme(theme))), &dtkWidgetsMenuItem::clicked, [=] (void) -> void {
dtkThemesEngine::instance()->apply(theme);
});
}
......@@ -108,8 +109,8 @@ dtkWidgetsMenu *dtkWidgetsMainWindow::populateAboutMenu(void)
{
if(!d->menu_about) {
d->menu_about = d->menubar->addMenu(fa::question, "About");
d->menu_about->addMenu(fa::question, "dtk");
d->menu_about->addMenu(fa::question, "dtk environment (conda)");
d->menu_about->addMenu(fa::question, "dtk")->addItem(0, "prout");
d->menu_about->addMenu(fa::question, "dtk environment (conda)")->addItem(0, "Pour Come");
}
return d->menu_about;
......
......@@ -15,8 +15,10 @@
#include "dtkWidgetsParameter.h" // TODO: Rename to dtkWidgetsParameterBase.h
#include "dtkWidgetsMenu+ux.h"
#include "dtkWidgetsParameter.h"
#include "dtkWidgetsMenuItem+custom.h"
#include <dtkFonts>
#include <dtkThemes>
// ///////////////////////////////////////////////////////////////////
// TODO: Substitute *inplace* with dtkThemesEngine
......@@ -28,6 +30,45 @@ static QColor fg_color = QColor("#88ffffff");
static int padding = 5;
static int margin = 10;
// ///////////////////////////////////////////////////////////////////
// dtkWidgetsMenuHelper
// ///////////////////////////////////////////////////////////////////
namespace dtkWidgetsMenuHelper {
static int margin = 16/2;
QWidget *build(QObject *source)
{
if(dtkWidgetsMenu *menu = dynamic_cast<dtkWidgetsMenu *>(source)) {
return new dtkWidgetsMenuInnerFacade(menu);
} else if(dtkWidgetsMenuItem *item = dynamic_cast<dtkWidgetsMenuItem *>(source)) {
if (item->isParameter()) {
return new dtkWidgetsMenuItemParameterFacade(static_cast<dtkWidgetsMenuItemParameter *>(item));
} else if (item->isCustom()) {
return new dtkWidgetsMenuItemCustomFacade(static_cast<dtkWidgetsMenuItemCustom *>(item));
} else if (item->isSeparator()) {
return new dtkWidgetsMenuItemSpacerFacade(margin, margin);
} else {
return new dtkWidgetsMenuItemFacade(item);
}
}
return nullptr;
}
}
// ///////////////////////////////////////////////////////////////////
// dtkWidgetsMenuNavigationFacade
// ///////////////////////////////////////////////////////////////////
......@@ -58,17 +99,17 @@ void dtkWidgetsMenuNavigationFacade::paintEvent(QPaintEvent *event)
{
QFrame::paintEvent(event);
dtkFontAwesome::instance()->setDefaultOption("color", ::fg_color);
dtkFontAwesome::instance()->setDefaultOption("color", dtkThemesEngine::instance()->color("@base0"));
QRect rect(5, 10, 28, 32); // qDebug() << Q_FUNC_INFO << rect;
QRect rect(5, 10, 28, 32);
QPainter painter(this);
painter.setRenderHints(QPainter::Antialiasing);
painter.setPen(Qt::NoPen);
painter.setBrush((bg_color));
painter.setBrush(dtkThemesEngine::instance()->color("@base7"));
painter.drawRoundedRect(rect, 5, 5);
painter.drawPixmap(10, 20, 16, 16, dtkFontAwesome::instance()->icon(fa::chevronleft).pixmap(16, 16));
painter.setPen(fg_color);
painter.setPen(dtkThemesEngine::instance()->color("@base8"));
if(this->menu)
painter.drawText(::margin*4, ::margin * 2 + 2 + 10, this->menu->title());
else
......@@ -95,11 +136,11 @@ void dtkWidgetsMenuHeaderFacade::paintEvent(QPaintEvent *event)
{
QFrame::paintEvent(event);
dtkFontAwesome::instance()->setDefaultOption("color", ::fg_color);
dtkFontAwesome::instance()->setDefaultOption("color", dtkThemesEngine::instance()->color("@fg"));
QPainter painter(this);
painter.setRenderHints(QPainter::Antialiasing);
painter.setPen(fg_color);
painter.setPen(dtkThemesEngine::instance()->color("@fg"));
painter.drawPixmap(::margin, ::margin, dtkFontAwesome::instance()->icon(this->menu->icon()).pixmap(16, 16));
painter.drawText(::margin + 16 + ::margin, ::margin * 2 + 2, this->menu->title());
}
......@@ -124,14 +165,11 @@ void dtkWidgetsMenuInnerFacade::paintEvent(QPaintEvent *event)
{
QFrame::paintEvent(event);
dtkFontAwesome::instance()->setDefaultOption("color", ::fg_color);
dtkFontAwesome::instance()->setDefaultOption("color", dtkThemesEngine::instance()->color("@base8"));
QPainter painter(this);
painter.setRenderHint(QPainter::Antialiasing);
// painter.setPen(::bg_color);
// painter.setBrush(::bg_color);
// painter.drawRoundedRect(event->rect(), 5, 5);
painter.setPen(::fg_color);
painter.setPen(dtkThemesEngine::instance()->color("@base8"));
painter.drawPixmap(10, 10, 16, 16, dtkFontAwesome::instance()->icon(this->menu->icon()).pixmap(16, 16));
painter.drawText(::margin + 16 + ::margin, ::margin * 2 + 2, this->menu->title());
painter.drawPixmap(this->width() - ::margin - 16, 10, 16, 16, dtkFontAwesome::instance()->icon(fa::chevronright).pixmap(16, 16));
......@@ -170,23 +208,17 @@ void dtkWidgetsMenuItemFacade::paintEvent(QPaintEvent *event)
if(menu_item->isCustom())
return;
dtkFontAwesome::instance()->setDefaultOption("color", ::fg_color);
dtkFontAwesome::instance()->setDefaultOption("color", dtkThemesEngine::instance()->color("@fg"));
QPainter painter(this);
painter.setRenderHint(QPainter::Antialiasing);
// painter.setPen(::bg_color);
// painter.setBrush(::bg_color);
// painter.drawRoundedRect(event->rect(), 5, 5);
painter.setPen(::fg_color);
painter.setPen(dtkThemesEngine::instance()->color("@fg"));
painter.drawPixmap(10, 10, 16, 16, dtkFontAwesome::instance()->icon(this->menu_item->icon()).pixmap(16, 16));
painter.drawText(::margin + 16 + ::margin, ::margin * 2 + 2, this->menu_item->title());
}
void dtkWidgetsMenuItemFacade::mousePressEvent(QMouseEvent *)
{
if( menu_item->isCustom())
return;
emit clicked();
}
......@@ -202,14 +234,27 @@ dtkWidgetsMenuItemParameterFacade::dtkWidgetsMenuItemParameterFacade(dtkWidgetsM
this->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
}
dtkWidgetsMenuItemParameterFacade::~dtkWidgetsMenuItemParameterFacade(void)
{
this->layout()->itemAt(1)->widget()->setParent(nullptr);
}
// ///////////////////////////////////////////////////////////////////
// dtkWidgetsMenuItemWorkspaceFacade
// dtkWidgetsMenuItemCustomFacade
// ///////////////////////////////////////////////////////////////////
dtkWidgetsMenuItemCustomFacade::dtkWidgetsMenuItemCustomFacade(dtkWidgetsMenuItemCustom *source, QWidget *parent) : dtkWidgetsMenuItemFacade(source, parent)
{
QVBoxLayout *layout = new QVBoxLayout(this);
layout->addWidget(source->widget());
if(dtkWidgetsMenuItemDIY *item = dynamic_cast<dtkWidgetsMenuItemDIY *>(source))
this->setSizePolicy(QSizePolicy::Expanding, item->policy());
}
dtkWidgetsMenuItemCustomFacade::~dtkWidgetsMenuItemCustomFacade(void)
{
this->layout()->itemAt(0)->widget()->setParent(nullptr);
}
// ///////////////////////////////////////////////////////////////////
......@@ -222,6 +267,10 @@ dtkWidgetsMenuFacade::dtkWidgetsMenuFacade(dtkWidgetsMenu *m, QWidget *parent) :
layout->setContentsMargins(0, 0, 0, 0);
layout->setSpacing(1);
layout->setAlignment(Qt::AlignTop);
for (QObject *object : m->objects()) {
this->addWidget(dtkWidgetsMenuHelper::build(object));
}
}
dtkWidgetsMenuFacade::~dtkWidgetsMenuFacade(void)
......
......@@ -177,6 +177,7 @@ class dtkWidgetsMenuItemParameterFacade : public dtkWidgetsMenuItemFacade
public:
dtkWidgetsMenuItemParameterFacade(dtkWidgetsMenuItemParameter *source, QWidget *parent = nullptr);
~dtkWidgetsMenuItemParameterFacade(void);
};
// ///////////////////////////////////////////////////////////////////
......@@ -189,6 +190,7 @@ class dtkWidgetsMenuItemCustomFacade : public dtkWidgetsMenuItemFacade
public:
dtkWidgetsMenuItemCustomFacade(dtkWidgetsMenuItemCustom *source, QWidget *parent = nullptr);
~dtkWidgetsMenuItemCustomFacade(void);
};
// ///////////////////////////////////////////////////////////////////
......
......@@ -18,57 +18,6 @@
#include <dtkFonts>
// ///////////////////////////////////////////////////////////////////
// dtkWidgetsMenuHelper
// ///////////////////////////////////////////////////////////////////
namespace dtkWidgetsMenuHelper {
static int margin = 16/2;
QWidget *build(QObject *source)
{
// qDebug() << Q_FUNC_INFO << 0;
if(dtkWidgetsMenu *menu = dynamic_cast<dtkWidgetsMenu *>(source)) {
return new dtkWidgetsMenuInnerFacade(menu);
} else if(dtkWidgetsMenuItem *item = dynamic_cast<dtkWidgetsMenuItem *>(source)) {
// qDebug() << Q_FUNC_INFO << 1 << item->title();
if (item->isParameter()) {
// qDebug() << Q_FUNC_INFO << 2;
return new dtkWidgetsMenuItemParameterFacade(static_cast<dtkWidgetsMenuItemParameter *>(item));
} else if (item->isCustom()) {
// qDebug() << Q_FUNC_INFO << 3;
return new dtkWidgetsMenuItemCustomFacade(static_cast<dtkWidgetsMenuItemCustom *>(item));
} else if (item->isSeparator()) {
// qDebug() << Q_FUNC_INFO << 4;
return new dtkWidgetsMenuItemSpacerFacade(margin, margin);
} else {
// qDebug() << Q_FUNC_INFO << 5;
return new dtkWidgetsMenuItemFacade(item);
}
}
return nullptr;
}
}
// ///////////////////////////////////////////////////////////////////
// dtkWidgetsMenuPrivate
// ///////////////////////////////////////////////////////////////////
......@@ -85,10 +34,6 @@ public:
public:
int icon_id;
public:
dtkWidgetsMenuFacade *widget = nullptr;
dtkWidgetsMenuHeaderFacade *header = nullptr;
};
// ///////////////////////////////////////////////////////////////////
......@@ -99,6 +44,7 @@ dtkWidgetsMenu::dtkWidgetsMenu(int icon_id, const QString& title, QObject *paren
{
d->title = title;
d->icon_id = icon_id;
}
dtkWidgetsMenu::~dtkWidgetsMenu(void)
......@@ -133,27 +79,6 @@ dtkWidgetsMenu *dtkWidgetsMenu::addMenu(int icon_id, const QString& title)
return m;
}
dtkWidgetsMenuFacade *dtkWidgetsMenu::widget(void)
{
if(!d->widget) {
d->widget = new dtkWidgetsMenuFacade(this);
for (QObject *object : d->object_list) {
d->widget->addWidget(dtkWidgetsMenuHelper::build(object));
}
}
return d->widget;
}
dtkWidgetsMenuHeaderFacade *dtkWidgetsMenu::header(void)
{
if(!d->header) {
d->header = new dtkWidgetsMenuHeaderFacade(this);
}
return d->header;
}
void dtkWidgetsMenu::clear(void)
{
d->object_hash.clear();
......@@ -228,6 +153,14 @@ QVector<dtkWidgetsMenu *> dtkWidgetsMenu::menus(void) const
return d->menu_list;
}
dtkWidgetsMenu * dtkWidgetsMenu::menu(const QString& id) const
{
if(!d->object_hash.contains(id))
return nullptr;
return dynamic_cast<dtkWidgetsMenu *>(d->object_hash[id]);
}
QObject *dtkWidgetsMenu::object(const QString& id)
{
if(!d->object_hash.contains(id))
......@@ -236,6 +169,11 @@ QObject *dtkWidgetsMenu::object(const QString& id)
return d->object_hash[id];
}
QVector<QObject *> dtkWidgetsMenu::objects(void) const
{
return d->object_list;
}
int dtkWidgetsMenu::icon(void) const
{
return d->icon_id;
......
......@@ -60,12 +60,6 @@ public:
dtkWidgetsMenuItem *addParameter(dtkWidgetsMenuItem *item);
dtkWidgetsMenuItem *addParameter(const QString&, dtkCoreParameter *, const QString& representation);
#pragma mark - UI inference
public slots:
dtkWidgetsMenuFacade *widget(void);
dtkWidgetsMenuHeaderFacade *header(void);
#pragma mark -
public slots:
......@@ -76,8 +70,12 @@ public:
QVector<dtkWidgetsMenu *> menus(void) const;
dtkWidgetsMenu *menu(const QString&) const;
QObject *object(const QString&);
QVector<QObject *> objects(void) const;
public:
int icon(void) const;
......
This diff is collapsed.
......@@ -39,7 +39,8 @@ class dtkWidgetsMenuBarButton : public QLabel
Q_OBJECT
public:
dtkWidgetsMenuBarButton(int id, const QString &title, QWidget *parent = nullptr);
dtkWidgetsMenuBarButton(int id, const QString &title, QWidget *parent = nullptr);
~dtkWidgetsMenuBarButton(void);
signals:
void clicked(void);
......@@ -59,6 +60,7 @@ public:
private:
int icon_id = 0;
QMetaObject::Connection m_connection;
};
// /////////////////////////////////////////////////////////////////////////////
......@@ -99,9 +101,6 @@ public slots:
void setCurrentIndex(int);
void setCurrentIndex(int, std::function<void (void)>&);
public slots:
void clear(void);
public:
int size(void) const;
......@@ -112,7 +111,7 @@ public slots:
void setFixedHeight(int);
public slots:
void build(void);
void touch(void);
protected:
void resizeEvent(QResizeEvent *) override;
......
......@@ -56,7 +56,7 @@ public slots:
public:
void build(const QVector<dtkWidgetsMenu *> &);
void build(dtkWidgetsMenuBar *);
void touch(dtkWidgetsMenuBar *);
void buildChildSlide(dtkWidgetsMenu *);
public:
......@@ -92,8 +92,8 @@ public:
bool isMaster(void) const { return (menu_bar != nullptr); }
public:
void update(dtkWidgetsMenu *);
void update(dtkWidgetsMenuBar *);
void touch(dtkWidgetsMenuBar *, dtkWidgetsMenuBarContainer *);
void touch(dtkWidgetsMenu *, dtkWidgetsMenuBarContainer *);
private:
dtkWidgetsMenu *menu = nullptr;
......@@ -125,7 +125,7 @@ public:
dtkWidgetsMenuBarButtonCollapse *toggle;
public:
void update(void);
void touch(void);
public:
QPoint o_pos;
......
......@@ -18,6 +18,57 @@
#include <dtkThemes>
#include <dtkThemesWidgets>
// ///////////////////////////////////////////////////////////////////
// dtkWidgetsMenuItemDIYPrivate
// ///////////////////////////////////////////////////////////////////
class dtkWidgetsMenuItemDIYPrivate
{
public:
QWidget *source = nullptr;
QWidget *widget = nullptr;
QSizePolicy::Policy policy = QSizePolicy::Fixed;
};
// ///////////////////////////////////////////////////////////////////
// dtkWidgetsMenuItemDIY implementation
// ///////////////////////////////////////////////////////////////////
dtkWidgetsMenuItemDIY::dtkWidgetsMenuItemDIY(const QString& title, QWidget *widget) : dtkWidgetsMenuItemCustom(title), d(new dtkWidgetsMenuItemDIYPrivate)
{
d->source = widget;
if (title.isEmpty()) {
d->widget = widget;
} else {
d->widget = new QWidget;
QFormLayout *layout = new QFormLayout;
layout->addRow(this->title(), widget);
d->widget->setLayout(layout);
}
}
dtkWidgetsMenuItemDIY::~dtkWidgetsMenuItemDIY(void)
{
delete d;
}
QWidget *dtkWidgetsMenuItemDIY::widget(void)
{
return d->widget;
}
void dtkWidgetsMenuItemDIY::setSizePolicy(QSizePolicy::Policy policy)
{
d->policy = policy;
}
QSizePolicy::Policy dtkWidgetsMenuItemDIY::policy(void)
{
return d->policy;
}
// ///////////////////////////////////////////////////////////////////
// dtkWidgetsMenuItemWorkspacePrivate
// ///////////////////////////////////////////////////////////////////
......@@ -29,13 +80,11 @@ public:
};
// ///////////////////////////////////////////////////////////////////
// dtkWidgetsMenuItemWorkspace
// dtkWidgetsMenuItemWorkspace implementation
// ///////////////////////////////////////////////////////////////////
dtkWidgetsMenuItemWorkspace::dtkWidgetsMenuItemWorkspace(const QString& title, dtkWidgetsWorkspaceStackBar *bar) : dtkWidgetsMenuItemCustom(title)
dtkWidgetsMenuItemWorkspace::dtkWidgetsMenuItemWorkspace(const QString& title, dtkWidgetsWorkspaceStackBar *bar) : dtkWidgetsMenuItemCustom(title), d(new dtkWidgetsMenuItemWorkspacePrivate)
{
d = new dtkWidgetsMenuItemWorkspacePrivate;
d->widget = bar;
}
......@@ -63,12 +112,11 @@ public:
};
// ///////////////////////////////////////////////////////////////////
// dtkWidgetsMenuItemTheme
// dtkWidgetsMenuItemTheme implementation
// ///////////////////////////////////////////////////////////////////
dtkWidgetsMenuItemTheme::dtkWidgetsMenuItemTheme(const QString& theme) : dtkWidgetsMenuItemCustom(theme)
dtkWidgetsMenuItemTheme::dtkWidgetsMenuItemTheme(const QString& theme) : dtkWidgetsMenuItemCustom(theme), d(new dtkWidgetsMenuItemThemePrivate)
{
d = new dtkWidgetsMenuItemThemePrivate;
d->theme = theme;
}
......
......@@ -17,7 +17,7 @@
#include "dtkWidgetsMenuItem.h"
// /////////////////////////////////////////////////////////////////////////////
//
// dtkWidgetsMenuItemDIY interface
// /////////////////////////////////////////////////////////////////////////////
class DTKWIDGETS_EXPORT dtkWidgetsMenuItemDIY : public dtkWidgetsMenuItemCustom
......@@ -25,39 +25,22 @@ class DTKWIDGETS_EXPORT dtkWidgetsMenuItemDIY : public dtkWidgetsMenuItemCustom
Q_OBJECT
public:
dtkWidgetsMenuItemDIY(const QString& title, QWidget *widget) : dtkWidgetsMenuItemCustom(title), s_widget(widget)
{
}
~dtkWidgetsMenuItemDIY(void) {
}
dtkWidgetsMenuItemDIY(const QString& title, QWidget *widget);
~dtkWidgetsMenuItemDIY(void);
public:
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);
}
QWidget *widget(void) override;
return d_widget;
};
public:
void setSizePolicy(QSizePolicy::Policy);
QSizePolicy::Policy policy(void);
private:
QWidget *s_widget = nullptr;
QWidget *d_widget = nullptr;
class dtkWidgetsMenuItemDIYPrivate *d;
};
// /////////////////////////////////////////////////////////////////////////////
//
// dtkWidgetsMenuItemWorkspace interface
// /////////////////////////////////////////////////////////////////////////////
class DTKWIDGETS_EXPORT dtkWidgetsMenuItemWorkspace : public dtkWidgetsMenuItemCustom
......@@ -76,7 +59,7 @@ private:
};
// /////////////////////////////////////////////////////////////////////////////
//
// dtkWidgetsMenuItemTheme interface
// /////////////////////////////////////////////////////////////////////////////
class DTKWIDGETS_EXPORT dtkWidgetsMenuItemTheme : public dtkWidgetsMenuItemCustom
......
<
......@@ -33,7 +33,7 @@ public:
};
// ///////////////////////////////////////////////////////////////////
// dtkWidgetsMenuItem
// dtkWidgetsMenuItem implementation
// ///////////////////////////////////////////////////////////////////
dtkWidgetsMenuItem::dtkWidgetsMenuItem(QObject *parent) : QAction(parent), d(new dtkWidgetsMenuItemPrivate)
......@@ -74,21 +74,28 @@ int dtkWidgetsMenuItem::icon(void) const
class dtkWidgetsMenuItemParameterPrivate
{
public:
dtkCoreParameter *parameter;
dtkCoreParameter *parameter = nullptr;
dtkWidgetsParameter *widget = nullptr;
};