Merge pull request #1792 from KLayout/bugfix/issue-1789

Fixing bug #1789 (Crash by add Text to hidden layer)
This commit is contained in:
Matthias Köfferlein 2024-07-21 08:08:43 +02:00 committed by GitHub
commit 951905d7aa
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 22 additions and 9 deletions

View File

@ -40,6 +40,7 @@
#include "layLayoutViewBase.h" #include "layLayoutViewBase.h"
#if defined(HAVE_QT) #if defined(HAVE_QT)
# include "layLayoutView.h"
# include "layTipDialog.h" # include "layTipDialog.h"
# include "layDragDropData.h" # include "layDragDropData.h"
#endif #endif
@ -72,6 +73,24 @@ ShapeEditService::configure (const std::string &name, const std::string &value)
} }
} }
void
ShapeEditService::activated ()
{
edt::Service::activated ();
#if defined(HAVE_QT)
if (view () == lay::LayoutView::current ()) {
lay::LayerPropertiesConstIterator cl = view ()->current_layer ();
if (! cl.is_null () && ! cl->visible (true)) {
lay::TipDialog td (QApplication::activeWindow (),
tl::to_string (tr ("You are about to draw on a hidden layer. The result won't be visible.")),
"drawing-on-invisible-layer");
td.exec_dialog ();
}
}
#endif
}
void void
ShapeEditService::get_edit_layer () ShapeEditService::get_edit_layer ()
{ {
@ -89,15 +108,6 @@ ShapeEditService::get_edit_layer ()
throw tl::Exception (tl::to_string (tr ("Please select a cell first"))); throw tl::Exception (tl::to_string (tr ("Please select a cell first")));
} }
#if defined(HAVE_QT)
if (! cl->visible (true)) {
lay::TipDialog td (QApplication::activeWindow (),
tl::to_string (tr ("You are about to draw on a hidden layer. The result won't be visible.")),
"drawing-on-invisible-layer");
td.exec_dialog ();
}
#endif
if (layer < 0 || ! cv->layout ().is_valid_layer ((unsigned int) layer)) { if (layer < 0 || ! cv->layout ().is_valid_layer ((unsigned int) layer)) {
if (cl->has_children ()) { if (cl->has_children ()) {

View File

@ -62,6 +62,7 @@ protected:
virtual void tap (const db::DPoint &initial); virtual void tap (const db::DPoint &initial);
virtual bool configure (const std::string &name, const std::string &value); virtual bool configure (const std::string &name, const std::string &value);
virtual void activated ();
protected: protected:
std::pair <bool, db::DPoint> interpolate (const db::DPoint &m, const db::DPoint &o, const db::DPoint &p) const; std::pair <bool, db::DPoint> interpolate (const db::DPoint &m, const db::DPoint &o, const db::DPoint &p) const;

View File

@ -188,6 +188,8 @@ MainWindow::MainWindow (QApplication *app, const char *name, bool undo_enabled)
mp_app (app), mp_app (app),
m_manager (undo_enabled) m_manager (undo_enabled)
{ {
setAnimated (false);
m_dispatcher.set_menu_parent_widget (this); m_dispatcher.set_menu_parent_widget (this);
m_dispatcher.make_menu (); m_dispatcher.make_menu ();