Return to site

Qt Plugin Signal Slot

broken image


why Qt doesn't allow declaring methodes as signals or slots in the plugin interface?

The connection mechanism uses a vector indexed by signals. But all the slots waste space in the vector and there are usually more slots than signals in an object. So from Qt 4.6, a new internal signal index which only includes the signal index is used. While developing with Qt, you only need to know about the absolute method index. Code for this videothis video we will learn How Qt Signals and Slots Wor. Signal/Slots with VIsual studio and Qt plugin. QT C - Signals and Slots: 'No such slot QLabel' even the SLOT function is existing in my class. Qt's signals and slots mechanism ensures that if you connect a signal to a slot, the slot will be called with the signal's parameters at the right time. Signals and slots can take any number of arguments of any type. They are completely type safe. Qt Design Studio. It is an easy-to-use design tool that lets designers import designs to Qt, animate them, test them live on the target hardware, and turn them into QML code developers can use.

so i did the following
i declared pure virtual functions ,but in the implementation ,i reimplamented them as signals and slots,
then used the QPluginLoader to load the plugin,then used connect, and they worked fine when i tested them, so is this method recommanded and won't cause bugs or maybe there are other appropriate methods?

Performance

@interface.h
..
virtual void send(int)=0;
..@

@interfaceplugin.h
..
signals:
void send(int);
..@

Qt Public Slots

then connect the plugin when i load it





broken image