implementation classes don't inherit from UI classes

This commit is contained in:
wmayer
2020-01-12 01:09:25 +01:00
committed by wwmayer
parent f97eb7026d
commit 5673d299f9
6 changed files with 233 additions and 16 deletions

View File

@@ -26,6 +26,7 @@
#endif
#include "DlgPartBoxImp.h"
#include "ui_DlgPartBox.h"
using namespace PartGui;
@@ -37,7 +38,7 @@ using namespace PartGui;
* true to construct a modal dialog.
*/
DlgPartBoxImp::DlgPartBoxImp(QWidget* parent, Qt::WindowFlags fl)
: Gui::LocationDialogUi<Ui_DlgPartBox>(parent, fl)
: Gui::LocationDialogUiImp(new Ui_DlgPartBox, parent, fl)
{
}

View File

@@ -23,12 +23,13 @@
#ifndef PARTGUI_DLGPARTBOXIMP_H
#define PARTGUI_DLGPARTBOXIMP_H
#include "ui_DlgPartBox.h"
#include <Gui/InputVector.h>
namespace PartGui {
class Ui_DlgPartBox;
typedef std::shared_ptr<Ui_DlgPartBox> Ui_DlgPartBoxPtr;
class DlgPartBoxImp : public Gui::LocationDialogUi<Ui_DlgPartBox>
class DlgPartBoxImp : public Gui::LocationDialogUiImp
{
Q_OBJECT

View File

@@ -26,22 +26,16 @@
#endif
#include "DlgPartCylinderImp.h"
#include "ui_DlgPartCylinder.h"
using namespace PartGui;
/*
* Constructs a DlgPartCylinder which is a child of 'parent', with the
* name 'name' and widget flags set to 'f'
*
* The dialog will by default be modeless, unless you set 'modal' to
* true to construct a modal dialog.
*/
DlgPartCylinderImp::DlgPartCylinderImp(QWidget* parent, Qt::WindowFlags fl)
: Gui::LocationDialogUi<Ui_DlgPartCylinder>(parent, fl)
: Gui::LocationDialogUiImp(new Ui_DlgPartCylinder, parent, fl)
{
}
/*
/*
* Destroys the object and frees any allocated resources
*/
DlgPartCylinderImp::~DlgPartCylinderImp()
@@ -49,14 +43,19 @@ DlgPartCylinderImp::~DlgPartCylinderImp()
// no need to delete child widgets, Qt does it all for us
}
Ui_DlgPartCylinderPtr DlgPartCylinderImp::getUi() const
{
return boost::any_cast< Ui_DlgPartCylinderPtr >(ui->get());
}
double DlgPartCylinderImp::getRadius() const
{
return this->radius->value().getValue();
return getUi()->radius->value().getValue();
}
double DlgPartCylinderImp::getLength() const
{
return this->length->value().getValue();
return getUi()->length->value().getValue();
}
#include "moc_DlgPartCylinderImp.cpp"

View File

@@ -23,12 +23,13 @@
#ifndef PARTGUI_DLGPARTCYLINDERIMP_H
#define PARTGUI_DLGPARTCYLINDERIMP_H
#include "ui_DlgPartCylinder.h"
#include <Gui/InputVector.h>
namespace PartGui {
class Ui_DlgPartCylinder;
typedef std::shared_ptr<Ui_DlgPartCylinder> Ui_DlgPartCylinderPtr;
class DlgPartCylinderImp : public Gui::LocationDialogUi<Ui_DlgPartCylinder>
class DlgPartCylinderImp : public Gui::LocationDialogUiImp
{
Q_OBJECT
@@ -38,6 +39,9 @@ public:
double getRadius() const;
double getLength() const;
private:
Ui_DlgPartCylinderPtr getUi() const;
};
} // namespace PartGui