I have a strange problem. I made a simple app with a button, and connected the buttons clicked() to hide() of the mainwindow. When clicking this button the app crashed in windows 2000. I'm using Qt 4.
The program works fine in Linux. Strange. Is this a known bug or something else important that I have missed?
This is main.cpp
This is mainwindow.hCode:
#include <QApplication> #include "mainwindow.h" int main(int argc, char *argv[]) MainWindow *MainForm = new MainWindow; MainForm->show(); return app.exec(); }
Code:
#ifndef MAINWINDOW_H #define MAINWINDOW_H #include <QMainWindow> #include "ui_mainwindow.h" { Q_OBJECT public: private: Ui::MainWindow ui; }; #endif
this is mainwindow.cpp
Code:
#include <QtGui> #include "mainwindow.h" { ui.setupUi(this); }
this is the ui file
Code:
<ui version="4.0" > <author></author> <comment></comment> <exportmacro></exportmacro> <class>MainWindow</class> <widget class="QMainWindow" name="MainWindow" > <property name="geometry" > <rect> <x>0</x> <y>0</y> <width>425</width> <height>248</height> </rect> </property> <property name="windowTitle" > <string>Test QT DevCPP</string> </property> <widget class="QWidget" name="centralWidget" > <widget class="QPushButton" name="pushButton" > <property name="geometry" > <rect> <x>40</x> <y>80</y> <width>75</width> <height>24</height> </rect> </property> <property name="text" > <string>PushButton</string> </property> </widget> </widget> </widget> <pixmapfunction></pixmapfunction> <resources/> <connections> <connection> <sender>pushButton</sender> <signal>clicked()</signal> <receiver>MainWindow</receiver> <slot>hide()</slot> <hints> <hint type="sourcelabel" > <x>81</x> <y>114</y> </hint> <hint type="destinationlabel" > <x>216</x> <y>146</y> </hint> </hints> </connection> </connections> </ui>
I can't see anything strange with this, can you?