Do you get any warnings in the console about the connect() statements? How do you know the code doesn't work?
Do you get any warnings in the console about the connect() statements? How do you know the code doesn't work?
QObject::connect(ui->pushButton,SIGNAL(clicked()),this,SLOT(huj()));
this is compiling but nothing happens when I press the button, the button even not going down (is freeze).
QObject::connect(ui->pushButton,SIGNAL(clicked()),ui,SLOT(huj()));
is saying "no maching function for call..."
in creator I cant set connection by clicking becouse he didnt see my slots
I have good news
QObject::connect(ui->lineEdit,SIGNAL(returnPressed()),this,SLOT(huj()) );
this is working, but why manualy connected button with signal clicked not working? and why on_pushButton_clicked() is not connecting automatycaly even if I use //QMetaObject::connectSlotsByName(this);
that metod is the last method in setupUi so i dont must to type it. what is wrong here?
Last edited by czlowiekcien; 25th May 2009 at 09:07.
when i using
QObject::connect(ui->pushButton,SIGNAL(clicked()),ui,SLOT(huj()));
widget.cpp:12: error: no matching function for call to `Widget::connect(QPushButton*&, const char*, Ui::Widget*&, const char*)'
M:/Qt/projekty/textfajnd/TextFind/../../../2009.02/qt/include/QtCore/../../src/corelib/kernel/qobject.h:202: note: candidates are: static bool QObject::connect(const QObject*, const char*, const QObject*, const char*, Qt::ConnectionType)
M:/Qt/projekty/textfajnd/TextFind/../../../2009.02/qt/include/QtCore/../../src/corelib/kernel/qobject.h:308: note: bool QObject::connect(const QObject*, const char*, const char*, Qt::ConnectionType) const
that is working well
QObject::connect(ui->lineEdit,SIGNAL(returnPressed()),this,SLOT(huj()) );
now I`m confused 7 hour of searching what is wrong for nothing. I create another button and it was working fine so I check properties and was everething the same so I delete first button and create it again and it is working. so admin can close that subject. thanks for helping
Hmm... you said it was working well - I thought you found the problem. If not then I can tell you what was wrong - "ui" is not a widget thus passing "ui" as the third parameter to connect() is illegal.
I type ui there becouse I trying to find any way to solve my problem I know that was wrong but I still dont know why I had that problem. maybe Qt Creator is not the best tool
Qt Creator is just a text editor, it doesn't make syntax errors - you do![]()
Bookmarks