Merge pull request #23101 from 3x380V/td_fixes

TechDraw: random fixes
This commit is contained in:
Benjamin Nauck
2025-09-01 15:58:01 +02:00
committed by GitHub
9 changed files with 37 additions and 18 deletions

View File

@@ -110,6 +110,20 @@ DrawView::DrawView():
}
App::DocumentObjectExecReturn* DrawView::recompute()
{
try {
return App::DocumentObject::recompute();
}
catch (Standard_Failure& e) {
auto ret = new App::DocumentObjectExecReturn(e.GetMessageString());
if (ret->Why.empty()) {
ret->Why = "Unknown OCC exception";
}
return ret;
}
}
App::DocumentObjectExecReturn *DrawView::execute()
{
// Base::Console().message("DV::execute() - %s touched: %d\n", getNameInDocument(), isTouched());

View File

@@ -65,6 +65,7 @@ public:
/** @name methods override Feature */
//@{
App::DocumentObjectExecReturn* recompute() override;
/// recalculate the Feature
App::DocumentObjectExecReturn *execute() override;
void onDocumentRestored() override;

View File

@@ -1537,6 +1537,8 @@ void DrawViewPart::handleChangedPropertyType(Base::XMLReader &reader, const char
}
return;
}
DrawView::handleChangedPropertyType(reader, TypeName, prop);
}
// true if owner->element is a cosmetic vertex

View File

@@ -1254,6 +1254,8 @@ void DrawViewSection::handleChangedPropertyType(Base::XMLReader &reader, const c
}
return;
}
DrawViewPart::handleChangedPropertyType(reader, TypeName, prop);
}
// checks that SectionNormal and XDirection are perpendicular and that Direction is the same as

View File

@@ -120,6 +120,7 @@ void positionDimText(DrawViewDimension* dim, int indexOffset = 0);
void activateHandler(TechDrawHandler* newHandler)
{
std::unique_ptr<TechDrawHandler> ptr(newHandler);
auto* mdi = qobject_cast<MDIViewPage*>(Gui::getMainWindow()->activeWindow());
if (!mdi) {
return;
@@ -134,7 +135,7 @@ void activateHandler(TechDrawHandler* newHandler)
if (!viewPage) {
return;
}
viewPage->activateHandler(newHandler);
viewPage->activateHandler(ptr.release());
}
//===========================================================================
@@ -517,8 +518,12 @@ public:
return;
}
App::Document* pageDoc = nullptr;
if (auto page = getPage()) {
pageDoc = page->getDocument();
}
if (msg.Object.getObjectName().empty()
|| msg.Object.getDocument() != getPage()->getDocument()) {
|| (msg.Object.getDocument() != pageDoc)) {
if (msg.Type == Gui::SelectionChanges::AddSelection) {
Gui::Selection().rmvSelection(msg.pDocName, msg.pObjectName, msg.pSubName);
}

View File

@@ -228,12 +228,6 @@ void QGIFace::setOutline(const QPainterPath & path)
setPath(path);
}
/// remove the PAT hatch lines
void QGIFace::clearLineSets()
{
return;
}
/// add PAT hatch line set
void QGIFace::addLineSet(LineSet& ls)
{

View File

@@ -108,7 +108,6 @@ public:
//PAT fill parms & methods
void setLineWeight(double weight);
[[deprecated]] void clearLineSets();
void addLineSet(TechDraw::LineSet& ls);
void lineSetToFillItems(TechDraw::LineSet& ls);

View File

@@ -109,7 +109,9 @@ void TechDrawHandler::mouseReleaseEvent(QMouseEvent* event)
void TechDrawHandler::quit()
{
viewPage->deactivateHandler();
if (viewPage) {
viewPage->deactivateHandler();
}
}
QWidget* TechDrawHandler::getCursorWidget()
@@ -127,5 +129,5 @@ void TechDrawHandler::setWidgetCursor(QCursor cursor)
TechDraw::DrawPage* TechDrawHandler::getPage()
{
return viewPage->getDrawPage();
}
return viewPage ? viewPage->getDrawPage() : nullptr;
}

View File

@@ -67,19 +67,19 @@ public:
App::PropertyPercent FaceTransparency;
void attach(App::DocumentObject *) override;
bool useNewSelectionModel(void) const override {return false;}
bool useNewSelectionModel() const override {return false;}
bool onDelete(const std::vector<std::string> &) override;
bool canDelete(App::DocumentObject* obj) const override;
bool setEdit(int ModNum) override;
bool setDetailEdit(int ModNum, TechDraw::DrawViewDetail* dvd);
bool doubleClicked(void) override;
bool doubleClicked() override;
void onChanged(const App::Property *prop) override;
void handleChangedPropertyType(Base::XMLReader &reader, const char *TypeName, App::Property * prop) override;
Base::Color prefSectionColor(void);
Base::Color prefHighlightColor(void);
int prefHighlightStyle(void);
Base::Color prefSectionColor();
Base::Color prefHighlightColor();
int prefHighlightStyle();
std::vector<App::DocumentObject*> claimChildren(void) const override;
std::vector<App::DocumentObject*> claimChildren() const override;
void fixSceneDependencies() override;
TechDraw::DrawViewPart* getViewObject() const override;