We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hello, Is it possible, or could it be possible in the future to allow plugins to draw asynchronously ?
Consider this code as a minimal example:
void LC_myPlugin::execComm(Document_Interface *doc, QWidget *parent, QString cmd) { QTimer* timer = new QTimer(this); timer->setSingleShot(true); connect(timer, &QTimer::timeout, this, [=]() { qDebug() << "timer expired!"; QPointF start(0,0); QPointF end(100, 200); doc->addLine(&start, &end); }); timer->start(1000); }
It crashes with a segfault because the doc pointer is a local variable in the calling method: https://github.com/LibreCAD/LibreCAD/blob/master/librecad/src/main/qc_applicationwindow.cpp#L724-L737
doc
I would like to be able to access to all drawing methods from within the Qt event loop.
This minimal example demonstrate it with a timer, but the drawing could be triggered by any Qt signal.
The text was updated successfully, but these errors were encountered:
The easiest could be adding an interface to accept a smart pointer of doc,
void LC_myPlugin::execComm(std::unique_ptr<Document_Interface> doc, QWidget *parent, QString cmd) { // move the ownership to the current LC_myPlugin instance this->m_doc = std::move(doc); .... connect(timer, &QTimer::timeout, this, [this]() { qDebug() << "timer expired!"; QPointF start(0,0); QPointF end(100, 200); m_doc->addLine(&start, &end); }); .... }
Sorry, something went wrong.
No branches or pull requests
Hello,
Is it possible, or could it be possible in the future to allow plugins to draw asynchronously ?
Consider this code as a minimal example:
It crashes with a segfault because the
doc
pointer is a local variable in the calling method: https://github.com/LibreCAD/LibreCAD/blob/master/librecad/src/main/qc_applicationwindow.cpp#L724-L737I would like to be able to access to all drawing methods from within the Qt event loop.
This minimal example demonstrate it with a timer, but the drawing could be triggered by any Qt signal.
The text was updated successfully, but these errors were encountered: