29 #include "portdialog.h"
31 #include <QVBoxLayout>
32 #include <QHBoxLayout>
35 #include <QListWidget>
37 #include <QPushButton>
39 #include <QMessageBox>
47 setLayout(vlayout =
new QVBoxLayout(
this));
49 QString portTypeName ;
54 portTypeName =
"slot";
59 portTypeName =
"signal";
62 layout()->addWidget(
new QLabel(
"Please pick a "+portTypeName +
" name."));
63 portNameEdit =
new QLineEdit(
this);
64 portNameEdit->setCompleter(
new QCompleter(portList));
65 layout()->addWidget(portNameEdit);
67 QListWidget* portListView =
new QListWidget(
this);
68 portListView->insertItems(0,portList);
70 layout()->addWidget(portListView);
71 connect(portListView,SIGNAL(currentTextChanged(QString)),portNameEdit,SLOT(setText(QString)));
73 QHBoxLayout* hlayout =
new QHBoxLayout(
this);
76 vlayout->addLayout(hlayout);
77 QPushButton* ok =
new QPushButton(
"Ok",
this);
78 QPushButton* cancel =
new QPushButton(
"Cancel",
this);
80 connect(ok,SIGNAL(clicked()),SLOT(accept()));
81 connect(cancel,SIGNAL(clicked()),SLOT(reject()));
84 hlayout->addWidget(ok);
85 hlayout->addWidget(cancel);
89 void PortDialog::accept()
91 if (portList.contains(portNameEdit->text()))
97 QMessageBox::critical(
this,
"Invalid method name",
"Please provide a valid method name");
virtual QStringList getSlots()=0
Returns the names of the available slots.
Class handling the generic description of a component.
virtual QStringList getSignals()=0
Returns the names of the availables signals.