#include "ui_Basic_dock_widget.h"
#include <CGAL/Three/Polyhedron_demo_plugin_helper.h>
#include <QApplication>
#include <QObject>
#include <QAction>
#include <QMainWindow>
#include "Messages_interface.h"
class DockWidget :
public QDockWidget,
public Ui::BasicDockWidget
{
public:
DockWidget(QString name, QWidget *parent)
:QDockWidget(name,parent)
{
setupUi(this);
}
};
class BasicPlugin :
public QObject,
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0")
public:
bool applicable(QAction*) const Q_DECL_OVERRIDE
{
return true;
}
QList<QAction*> actions() const Q_DECL_OVERRIDE
{
return _actions;
}
{
this->messageInterface = mi;
this->scene = sc;
this->mw = mw;
QAction *actionHelloWorld= new QAction(QString("Open Dock Widget"), mw);
actionHelloWorld->setProperty("submenuName", "Basic");
if(actionHelloWorld) {
connect(actionHelloWorld, SIGNAL(triggered()),
this, SLOT(helloWorld()));
_actions << actionHelloWorld;
}
dock_widget = new DockWidget("Print a number", mw);
dock_widget->setVisible(false);
addDockWidget(dock_widget);
connect(dock_widget->pushButton, SIGNAL(clicked(bool)),
this, SLOT(on_dock_button_clicked()));
}
private Q_SLOTS:
void helloWorld()
{
if(dock_widget->isVisible()) { dock_widget->hide(); }
else { dock_widget->show(); }
}
void on_dock_button_clicked()
{
messageInterface->information(QString("Here is your number :%1").arg(dock_widget->spinBox->value()));
}
void closure()Q_DECL_OVERRIDE
{
dock_widget->hide();
}
private:
QList<QAction*> _actions;
Messages_interface* messageInterface;
DockWidget* dock_widget;
};
#include "Dock_widget_plugin.moc"