Hi all!
I have just started developing in QT language but i've got some experience with basic, c++ and some other object oriented languages. I tried some developing with Qdevelop on Ubuntu and all seems works fine but i would like to learn QT for windows developing because, for job reasion, sometimes i need to create windows program.
I decided to install QT on Windows 7 32bit and use visual studio as develop suite. Now all it's working and the program just run fine.
I have written some line of code to try it and, after searching on the net, i've created a small UI with a button and connected the signal Clicked() to a Qmessagebox.
The problems starts here...
I can compile my program without any error or warning and when i start the debug or release process it seems all ok till i get an error:
"Unhandled exception at 0x671d3226 (QtCored4.dll) in TestQT.exe: 0xC0000005: Access violation reading location 0xcdcdcd00."
I realized that this happen only when i try to connect the clicked() signal with my function to display the messagebox. I post the source code and hope someone of you can help me!
Thank you very much,
Michele
TESTQT.H
MAIN.CPPCode:#ifndef TESTQT_H #define TESTQT_H #include <QtGui/QMainWindow> #include "ui_testqt.h" #include <QMessageBox> class TestQT : public QMainWindow, private Ui::TestQTClass { Q_OBJECT public: TestQT(QWidget *parent = 0, Qt::WFlags flags = 0); ~TestQT(); private slots: void Qclick(); private: Ui::TestQTClass ui; }; #endif // TESTQT_H
TESTQT.CPPCode:#include "testqt.h" #include <QtGui/QApplication> int main(int argc, char *argv[]) { QApplication a(argc, argv); TestQT w; w.show(); return a.exec(); }
Code:#include "testqt.h" TestQT::TestQT(QWidget *parent, Qt::WFlags flags) : QMainWindow(parent, flags) { ui.setupUi(this); /*QPushButton *button = Bottone new QPushButton(*/ /*QApplication::translate("childwidget", "Press me"), this); button->move(100, 100); button->show();*/ QObject::connect(Bottone,SIGNAL(clicked()),this,SLOT(Qclick())); } TestQT::~TestQT() { } void TestQT::Qclick() { QMessageBox::information(this,"Titolo","Linkato!!!"); }




