У меня есть интерфейс MyInterface
:
class MyInterface
{
public:
virtual ~MyInterface() {}
virtual QMap<QString, QString> *inputsMap() const = 0;
};
У меня есть класс MyImplementingClass который реализует MyInterface
, Однако я не могу получить текст от QLineEdit *fullNames
:
QLineEdit *fullNames = new QLineEdit();
QMap<QString, QString> *MyImplementingClass::inputsMap() const
{
QMap<QString, QString> *map = new QMap<QString, QString>();
map -> insert("fullNames", this -> fullNames -> text());
map -> insert("coolText", "This works OK");
return map;
}
В ImplementorsCollector
где я собираю все плагины, которые реализуют MyInterface
:
void ImplementorsCollector :: initImplementors(QObject *plugin)
{
MyInterface *iMyInterface = qobject_cast<MyInterface *>(plugin);
if (iMyInterface)
myObject = iMyInterface -> inputsMap();
}
Тем не менее, все еще в ImplementorsCollector
:
/* This prints nothing. Nothing gets passed from **QLineEdit *fullNames** */
if (myObject -> contains("fullNames"))
qDebug() << "fullNames : " << myObject -> value("fullNames");
/* This prints OK */
if (myObject -> contains("coolText"))
qDebug() << "coolText : " << myObject -> value("coolText");
Как я могу получить текстовый ввод от **QLineEdit *fullNames**
из другого плагина?
Спасибо всем заранее.
Задача ещё не решена.
Других решений пока нет …