PD: avoid include generated .ui file in header file

This commit is contained in:
wmayer
2021-12-03 15:59:15 +01:00
parent e9c4f4acc1
commit 945028847a
2 changed files with 21 additions and 15 deletions

View File

@@ -31,29 +31,28 @@
#include <App/Application.h>
#include <Gui/Application.h>
#include "ui_DlgActiveBody.h"
#include "DlgActiveBody.h"
#include "ReferenceSelection.h"
#include "Utils.h"
Q_DECLARE_METATYPE(App::DocumentObject*);
Q_DECLARE_METATYPE(App::DocumentObject*)
using namespace PartDesignGui;
DlgActiveBody::DlgActiveBody(QWidget *parent, App::Document*& doc,
const QString& infoText)
: QDialog(parent),
ui(new Ui_DlgActiveBody),
_doc(doc),
activeBody(nullptr)
DlgActiveBody::DlgActiveBody(QWidget *parent, App::Document*& doc, const QString& infoText)
: QDialog(parent)
, ui(new Ui_DlgActiveBody)
, _doc(doc)
, activeBody(nullptr)
{
ui->setupUi(this);
QObject::connect(ui->bodySelect, SIGNAL(itemDoubleClicked(QListWidgetItem *)),
this, SLOT(accept()));
connect(ui->bodySelect, SIGNAL(itemDoubleClicked(QListWidgetItem *)),
this, SLOT(accept()));
if(!infoText.isEmpty()) {
ui->label->setText(infoText + QString::fromUtf8("\n\n") +
QObject::tr("Please select"));
if (!infoText.isEmpty()) {
ui->label->setText(infoText + QString::fromUtf8("\n\n") + tr("Please select"));
}
auto bodies = _doc->getObjectsOfType(PartDesign::Body::getClassTypeId());
@@ -85,6 +84,10 @@ DlgActiveBody::DlgActiveBody(QWidget *parent, App::Document*& doc,
}
}
DlgActiveBody::~DlgActiveBody()
{
}
void DlgActiveBody::accept()
{
auto selectedItems = ui->bodySelect->selectedItems();

View File

@@ -26,13 +26,15 @@
#ifndef PARTDESIGNGUI_DLGACTIVEBODY_H
#define PARTDESIGNGUI_DLGACTIVEBODY_H
#include <QDialog>
#include <memory>
#include <App/Document.h>
#include <Mod/PartDesign/App/Body.h>
#include <Mod/PartDesign/PartDesignGlobal.h>
// TODO: Apparently this header can be avoided. See ./Command.cpp:74.
#include "ui_DlgActiveBody.h"
namespace PartDesignGui {
class Ui_DlgActiveBody;
/** Dialog box to ask user to pick a Part Design body to make active
* or make a new one
@@ -44,9 +46,10 @@ class PartDesignGuiExport DlgActiveBody : public QDialog
public:
DlgActiveBody(QWidget* parent, App::Document*& doc,
const QString& infoText=QString());
~DlgActiveBody();
void accept() override;
PartDesign::Body* getActiveBody() { return activeBody; };
PartDesign::Body* getActiveBody() const { return activeBody; }
private:
std::unique_ptr<Ui_DlgActiveBody> ui;