PDA

View Full Version : connect problem QDialog



Zergi
1st January 2008, 13:25
Hi

i have a problem... My class create QDialog with a button, i try to connect button from dialog with another function but it dosent work.


void klient::Mrejestracja()
{
QGridLayout *gridLayout;
QPushButton *R_pb_w;
QDialog *dialog = new QDialog();


dialog->resize(249, 131);
gridLayout = new QGridLayout(dialog);
gridLayout->setSpacing(6);
gridLayout->setMargin(11);

R_pb_w = new QPushButton(dialog);
R_pb_w->setObjectName(QString::fromUtf8("R_pb_w"));

gridLayout->addWidget(R_pb_w, 2, 0, 1, 2);



dialog->setWindowTitle(QApplication::translate("dialog", "dialog", 0, QApplication::UnicodeUTF8));
R_pb_w->setText(QApplication::translate("dialog", "Wy\305\233lij", 0, QApplication::UnicodeUTF8));

connect(R_pb_w,SIGNAL( clicked() ), this, SLOT(Trejestracja("a","b")));
dialog->exec();



void klient::Trejestracja(QString l,QString h)
{
tcpSocket->write("R \n");
tcpSocket->write("!"+l.toLatin1()+"!" + h.toLatin1() + "\n");
}

When i connect it to another function it works... but with Trejestracja it dosent work...

Best Regards

Thx for help

jpn
1st January 2008, 13:36
You can't add parameter values like that in signals and slots (http://doc.trolltech.com/latest/signalsandslots.html). Use QSignalMapper or a custom slot.