17 m_plbl =
new QLabel(
"this is an example text");
18 m_pmnuPlugins =
new QMenu(
"&PluginOperations");
21 setCentralWidget(m_plbl);
22 menuBar()->addMenu(m_pmnuPlugins);
28 QDir dir(QCoreApplication::applicationDirPath());
32 if (!dir.cd(
"plugins")) {
33 QMessageBox::critical(0,
"",
"plugins directory does not exist");
37 foreach (QString strFileName, dir.entryList(QDir::Files)) {
38 QPluginLoader loader(dir.absoluteFilePath(strFileName));
39 addToMenu(qobject_cast<QObject*>(loader.instance()));
53 foreach (QString str, lstOperations) {
54 QAction* pact =
new QAction(str, pobj);
55 connect(pact, SIGNAL(triggered()),
58 m_pmnuPlugins->addAction(pact);
66 QAction* pact = qobject_cast<QAction*>(sender());
70 m_plbl->setText(pI->operation(m_plbl->text(), pact->text()));
virtual QStringList operations() const =0
PluginsWindow(QWidget *pwgt=0)
void addToMenu(QObject *pobj)
void slotStringOperation()