Discussion Board

Results 1 to 5 of 5
  1. #1
    Registered User Raylman89's Avatar
    Join Date
    Jul 2007
    Posts
    13
    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
    Code:
    #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
    MAIN.CPP
    Code:
    #include "testqt.h"
    #include <QtGui/QApplication>
    
    int main(int argc, char *argv[])
    {
    	QApplication a(argc, argv);
    	TestQT w;
    	w.show();
    	
    
    	
    
    
    	return a.exec();
    }
    TESTQT.CPP

    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!!!");
    }

  2. #2
    Nokia Developer Moderator divanov's Avatar
    Join Date
    Oct 2009
    Posts
    4,326
    It's not possible to identify the problem as you didn't attach ui_testqt.h and ui_testqt.cpp.
    You do very strange things in testqt.h and testqt.cpp, so I expect you did something really wrong in TestQTClass::setupUi(...).

    This is sample application, which just connects one button to the slot:
    http://www.mediafire.com/file/jthy3y...michele.tar.gz

  3. #3
    Nokia Developer Champion axeljaeger's Avatar
    Join Date
    Mar 2009
    Posts
    430
    Adding these files will not help so much because they are auto-generated. But the commented part of your posting is not valid C++ code and thus will never pass the compiler.

  4. #4
    Nokia Developer Moderator divanov's Avatar
    Join Date
    Oct 2009
    Posts
    4,326
    Quote Originally Posted by axeljaeger View Post
    Adding these files will not help so much because they are auto-generated. But the commented part of your posting is not valid C++ code and thus will never pass the compiler.
    If they autogenerated, then it would be nice to have the files, from which they are autogenerated. I guess is this .ui file? In other words the whole project one can try to build and execute oneself to reproduce the problem. Partial source posting causes a lot of guessing.

  5. #5
    Nokia Developer Champion axeljaeger's Avatar
    Join Date
    Mar 2009
    Posts
    430
    RIght, the complete compilable project would be nice.

Similar Threads

  1. Unhandled Exception
    By nair.shanker in forum Mobile Java General
    Replies: 10
    Last Post: 2008-12-18, 04:56
  2. Unhandled Exception.
    By sunil_bhambani123 in forum Mobile Java General
    Replies: 6
    Last Post: 2008-10-20, 05:37
  3. Help Please : CmsvEntry->ChangeL Unhandled Exception
    By mubx2000 in forum Symbian C++
    Replies: 0
    Last Post: 2006-07-12, 12:16
  4. Help Please : CmsvEntry->ChangeL Unhandled Exception
    By mubx2000 in forum Symbian Networking & Messaging (Closed)
    Replies: 0
    Last Post: 2006-07-12, 12:14
  5. can not successfully link any sample using .NET
    By lobotomat in forum Symbian Tools & SDKs
    Replies: 2
    Last Post: 2002-08-20, 00:29

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved