ok i ran qmake in the folder of main.cpp then I pressed rebuild in Code::Blocks and it gave me the same error.
ok i ran qmake in the folder of main.cpp then I pressed rebuild in Code::Blocks and it gave me the same error.
ok so I have installed QT Creator.
and what is a class destructor.
Ouch... we didn't learn C++, did we?
http://en.wikipedia.org/wiki/Destruc...puter_science)
http://www.parashift.com/c++-faq-lite/dtors.html
I did learn c++ from
cprogramming.com
I just never had a good understanding of classes.
So you were learning C++ but didn't learn it. It's all about classes. It's like you were learning a language but never had a good understanding of words... I suggest you correct that mistake now.
well actually, I got a better understanding of classes when reading this thread...
OK, I got it to compile but when i press execute the LCDNumber thing doesn't change.
here is the cofr
Qt Code:
#include <QApplication> #include <QPushButton> #include <QLabel> #include <QSpinBox> #include <QLCDNumber> #include <QHBoxLayout> #include <QVBoxLayout> public: { layout->addWidget(num1); layout->addWidget(num2); layout->addWidget(answer); mainLayout->addLayout(layout); mainLayout->addWidget(equal); } public slots: void minus(){ answer->display(num1->value()-num2->value()); } private: QPushButton *equal; QSpinBox *num1; QSpinBox *num2; QLCDNumber *answer; }; int main(int argc, char *argv[]) { calculator w; w.show(); return app.exec(); }To copy to clipboard, switch view to plain text mode
I only made a few changes. I got rid of the Q_Object macro because with it the program wouldn't link to the .exe file. I tried to make a .moc file by using qmake in the directory of the program, the only files that are there are:
Calculator Gui.depend
Calculator Gui.layout
Calculator Gui.pro
Calculator Gui.pro.user
file
file.Debug
file.Release
Makefile
Makefile.Debug
Makefile.Release
thank you.
Watch the output window in Qt Creator, it'll tell you what your doing wrong. I can see an instant problem with your connect() call.
QtCreator maybe can help you.
You're right, but it's easier to connect signals and slots in QtCreator on the right way.
Yes, if you know where the signals and slots need to be connected, but if you don't know that it could just become even more confusing when it doesn't let you do what you think is correct (like connecting a signal to a integer variable).
Reading the documentation or tutorial is a must before attempting anything, even a simple calculator program. If your a seasoned developer, the tutorial will probably take you about 10 minutes to go through.
But you have to choose the right object as the source and destination of the signal. Without that Creator will not be helpful in any way other than not listing the signals and slot you'd like to connect which suggests you did something wrong. But then the compiler/Qt pair do exactly the same thing.
Bookmarks