Dear d_stranz,
I posted the minimal example for better overview, however, the problem is still there, if i incorporate it into a "proper GUI application" (see below).
main.cpp:
#include <QApplication>
#include <TestWindow.h>
int main(int argc, char *argv[])
{
int i=777; //some random value
TestWindow w;
w.show();
i= app.exec();
return i;
}
#include <QApplication>
#include <TestWindow.h>
int main(int argc, char *argv[])
{
int i=777; //some random value
QApplication app(argc, argv);
TestWindow w;
w.show();
i= app.exec();
return i;
}
To copy to clipboard, switch view to plain text mode
TestWindow.h:
#ifndef TESTWINDOW_H
#define TESTWINDOW_H
#include <QMainWindow>
namespace Ui {
class TestWindow;
}
{
Q_OBJECT
public:
explicit TestWindow
(QWidget *parent
= 0);
~TestWindow();
private:
Ui::TestWindow *ui;
};
#endif // TESTWINDOW_H
#ifndef TESTWINDOW_H
#define TESTWINDOW_H
#include <QMainWindow>
namespace Ui {
class TestWindow;
}
class TestWindow : public QMainWindow
{
Q_OBJECT
public:
explicit TestWindow(QWidget *parent = 0);
~TestWindow();
private:
Ui::TestWindow *ui;
};
#endif // TESTWINDOW_H
To copy to clipboard, switch view to plain text mode
TestWindow.cpp:
#include "TestWindow.h"
#include "ui_TestWindow.h"
TestWindow
::TestWindow(QWidget *parent
) : ui(new Ui::TestWindow)
{
ui->setupUi(this);
}
TestWindow::~TestWindow()
{
delete ui;
}
#include "TestWindow.h"
#include "ui_TestWindow.h"
TestWindow::TestWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::TestWindow)
{
ui->setupUi(this);
}
TestWindow::~TestWindow()
{
delete ui;
}
To copy to clipboard, switch view to plain text mode
TestWindow.ui:
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>TestWindow</class>
<widget class="QWidget" name="TestWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<widget class="QSpinBox" name="spinBox">
<property name="geometry">
<rect>
<x>100</x>
<y>70</y>
<width>42</width>
<height>22</height>
</rect>
</property>
</widget>
</widget>
<resources/>
<connections/>
</ui>
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>TestWindow</class>
<widget class="QWidget" name="TestWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<widget class="QSpinBox" name="spinBox">
<property name="geometry">
<rect>
<x>100</x>
<y>70</y>
<width>42</width>
<height>22</height>
</rect>
</property>
</widget>
</widget>
<resources/>
<connections/>
</ui>
To copy to clipboard, switch view to plain text mode
If I run this in DEBUG, then I get the runtime error "..has triggered a breakpoint" as soon as I close the window.
If I replace the QSpinBox with a QLineEdit, then the runtime error at closing of the window disappears.
However, if I add some text to the QLineEdit while the window is open, I get the same error. It seems that the application can not handle it, if any QWidgets (like QLineEdit or QSpinBox) hold data during runtime.
I also noticed that when compiling in DEBUG, I get the warning
"Warning 1 warning LNK4075: ignoring '/INCREMENTAL' due to '/LTCG' specification C:\svn\SpielwieseQt\_build_x64_vc11\LINK". Not sure, if this is related to the problem I described.
Any ideas on how to approach this?
Bookmarks