[SOLVED] QPushButton. I click on the button, but nothing not happend.
-
You can "use Qt designer":http://doc.trolltech.com/main-snapshot/designer-connection-mode.html to set up the signal\slot connection.
Alternatively, why not try this (if you want to do it manually in your constructor):
@connect(ui->pushButton, SIGNAL(clicked()), this, SLOT(apply()));@
(I assumed your UI button is still called pushButton?)
-
[quote author="goblincoding" date="1342523306"]You can "use Qt designer":http://doc.trolltech.com/main-snapshot/designer-connection-mode.html to set up the signal\slot connection.
Alternatively, why not try this (if you want to do it manually in your constructor):
@connect(ui->pushButton, SIGNAL(clicked()), this, SLOT(apply()));@
(I assumed your UI button is still called pushButton?)[/quote]
I set a other slot, called "slot1", with Qt designer.
I debuged, and i gave 3 errors."Debugging starts
Object::connect: No such slot QDialog::slot1() in ./ui_setrefreshspeed.h:57
Object::connect: (sender name: 'pushButton')
Object::connect: (receiver name: 'setRefreshSpeed')
Debugging has finished
"This is the line number 57:
@QObject::connect(pushButton, SIGNAL(clicked()), setRefreshSpeed, SLOT(slot1()));
@ -
Did you actually create a slot with that name?
-
[quote author="Andre" date="1342525437"]Did you actually create a slot with that name?[/quote]
Yes.
-
Show us the complete code then, please.
-
Can I upload here the files? Or I can only copying?
-
No, you cannot upload files here. You could use pastebin for code sections, or perhaps a public dropbox folder.
-
[quote author="I-sty" date="1342525774"]Can I upload here the files? Or I can only copying?[/quote]
Your wish . You can zip the project folder upload it somewhere and paste the link here or write all the files.
-
You can do this kind of codes automatically with only using Qt Creator.
It binds events and... with using some dialog windows and wizards!
-
"on the Google Drive":https://docs.google.com/folder/d/0B2_XIe25TBZFYUdDU0FIRVZxMTA/edit
-
Your problem is this:
@
void MainWindow::on_actionOther_triggered()
{
Ui::setRefreshSpeed something;
QDialog *d = new QDialog;
something.setupUi(d);
d->show();
}
@You're creating QDialog object, not a refreshSpeed object and QDialog does not have a slot1() (as your compiler rightfully pointed out). You also do not need to explicitly create or setup the UI (that's kind of the whole point with Qt Designer Form classes :) ). This is what you want:
@
void MainWindow::on_actionOther_triggered()
{
//Ui::setRefreshSpeed something;
setRefreshSpeed *d = new setRefreshSpeed;
d->setAttribute( Qt::WA_DeleteOnClose );
//something.setupUi(d);
d->show();
}
@ -
[quote author="goblincoding" date="1342530066"]Your problem is this:
@
void MainWindow::on_actionOther_triggered()
{
Ui::setRefreshSpeed something;
QDialog *d = new QDialog;
something.setupUi(d);
d->show();
}
@You're creating QDialog object, not a refreshSpeed object and QDialog does not have a slot1() (as your compiler rightfully pointed out). You also do not need to explicitly create or setup the UI (that's kind of the whole point with Qt Designer Form classes :) ). This is what you want:
@
void MainWindow::on_actionOther_triggered()
{
//Ui::setRefreshSpeed something;
setRefreshSpeed *d = new setRefreshSpeed;
d->setAttribute( Qt::WA_DeleteOnClose );
//something.setupUi(d);
d->show();
}
@[/quote]Thanks, goblincoding! :D
I rewrote, and works perfectly.
@void MainWindow::on_actionOther_triggered()
{
short x = freq;
setRefreshSpeed *d = new setRefreshSpeed;
d->setAttribute(Qt::WA_DeleteOnClose);
d->exec();if (freq != x){ timer->start(freq); ui->action1s->setChecked(false); ui->action2s->setChecked(false); ui->action3s->setChecked(false); ui->actionOther->setChecked(true); }
}@
-
So, the topic is solved. Not? :)
This problem is resolved. I'll write the next. :D -
Glad that you got the code working. Kindly Edit your title and add Solved to it.
Happy Coding!!!!
-
Happy to finally be of some service here :D