Commit 4d5e0a73 authored by Martin Schultz's avatar Martin Schultz

revised documentation for addEmpty object

parent 7f161b0a
......@@ -63,13 +63,14 @@ void ExamplePlugin::exampleFunction() {
}
\endcode
Note, that the LoadSaveInterface::addEmptyObject signal is connected using a Qt::DirectConnection and immediately returns the ID of your new object.
Of course you have to add the includes for the ObjectTypes you want to use to your list of includes. A list of available
ObjectTypes can be found here: \ref datatypes
\section qt_signals Qt Signals
As mentioned above, new objects are created by emitting the LoadSaveInterface::addEmptyObject signal (more information on Qt signals http://doc.qt.io/qt-5/signalsandslots.html). This signal is connected with a Qt::QueuedConnection which means, that it will be pushed to the Event-Queue of Qt. This allows other plugins to process the new object, e.g. create and add textures for it.
However, after the line "emit addEmptyObject(DATA_PLANE, newObjectId);" from the above example, the event is not necessary processed by all plugins, which may cause problems if they change properties you want to set. To avoid such problems you can inject a new signal to the Event-Queue, because the Event-Queue is processed in order.
As mentioned above, new objects are created by emitting the LoadSaveInterface::addEmptyObject signal (more information on Qt signals http://doc.qt.io/qt-5/signalsandslots.html). In addition to that another signal is emitted, to inform other plugins about the new object. This signal is connected with a Qt::QueuedConnection which means, that it will be pushed to the Event-Queue of Qt. This allows other plugins to process the new object, e.g. create and add textures for it.
However, after the line "emit addEmptyObject(DATA_PLANE, newObjectId);" from the above example, there may be plugins that have not yet processed this information, which may cause problems if they change properties you want to set. To avoid such problems you can inject a new signal to the Event-Queue, because the Event-Queue is processed in order.
Example: YourPlugin.hh:
\code
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment