Ok, I tried it the manual way also: I removed the two custom slots and the connection in designer and did it in code. My class now looks like this:
generat0rx.h
#ifndef GENERAT0RX_H
#define GENERAT0RX_H
#include <QtGui/QMainWindow>
#include "ui_generat0rx.h"
class generat0rX
: public QMainWindow,
private Ui
::generat0rXClass{
Q_OBJECT
public:
generat0rX
(QWidget *parent
= 0, Qt
::WFlags flags
= 0);
~generat0rX();
public slots:
void exit_slot(void);
void addScene2D_slot(void);
private:
Ui::generat0rXClass ui;
};
#endif // GENERAT0RX_H
#ifndef GENERAT0RX_H
#define GENERAT0RX_H
#include <QtGui/QMainWindow>
#include "ui_generat0rx.h"
class generat0rX : public QMainWindow, private Ui::generat0rXClass
{
Q_OBJECT
public:
generat0rX(QWidget *parent = 0, Qt::WFlags flags = 0);
~generat0rX();
public slots:
void exit_slot(void);
void addScene2D_slot(void);
private:
Ui::generat0rXClass ui;
};
#endif // GENERAT0RX_H
To copy to clipboard, switch view to plain text mode
and generat0rx.cpp
#include "generat0rx.h"
#include "qmessagebox.h"
{
ui.setupUi(this);
QObject::connect(actionExit,
SIGNAL(activated
()),
this,
SLOT(exit_slot
()));
QObject::connect(actionNew_2D_Scene,
SIGNAL(activated
()),
this,
SLOT(addScene2D_slot
()));
}
generat0rX::~generat0rX()
{
}
void generat0rX::exit_slot()
{
msgBox.setText("SLOT: exit_slot triggered");
msgBox.exec();
//qApp->quit();
//qApp->exit();
}
void generat0rX::addScene2D_slot()
{
msgBox.setText("SLOT: addScene2D triggered");
msgBox.exec();
}
#include "generat0rx.h"
#include "qmessagebox.h"
generat0rX::generat0rX(QWidget *parent, Qt::WFlags flags) : QMainWindow(parent, flags)
{
ui.setupUi(this);
QObject::connect(actionExit, SIGNAL(activated()), this, SLOT(exit_slot()));
QObject::connect(actionNew_2D_Scene, SIGNAL(activated()), this, SLOT(addScene2D_slot()));
}
generat0rX::~generat0rX()
{
}
void generat0rX::exit_slot()
{
QMessageBox msgBox;
msgBox.setText("SLOT: exit_slot triggered");
msgBox.exec();
//qApp->quit();
//qApp->exit();
}
void generat0rX::addScene2D_slot()
{
QMessageBox msgBox;
msgBox.setText("SLOT: addScene2D triggered");
msgBox.exec();
}
To copy to clipboard, switch view to plain text mode
Now the above error is gone but I get a runtime exception:
> QtCored4.
dll!QObject::connect(const QObject * sender
=0x00690000,
const char * signal=0x00c5d294,
const QObject * receiver
=0x0026f5c0,
const char * method
=0x00c5d270, Qt
::ConnectionType type
=AutoConnection
) Line
2483 + 0x8 bytes C
++ generat0rX.
exe!generat0rX
::generat0rX(QWidget * parent
=0x00000000, QFlags<enum Qt
::WindowType> flags
={...
}) Line
8 + 0x31 bytes C
++ generat0rX.exe!main(int argc=1, char * * argv=0x0069f9f0) Line 24 + 0x1d bytes C++
generat0rX.exe!WinMain(HINSTANCE__ * instance=0x00980000, HINSTANCE__ * prevInstance=0x00000000, char * __formal=0x00072b9a, int cmdShow=1) Line 131 + 0x12 bytes C++
generat0rX.exe!__tmainCRTStartup() Line 547 + 0x2c bytes C
generat0rX.exe!WinMainCRTStartup() Line 371 C
> QtCored4.dll!QObject::connect(const QObject * sender=0x00690000, const char * signal=0x00c5d294, const QObject * receiver=0x0026f5c0, const char * method=0x00c5d270, Qt::ConnectionType type=AutoConnection) Line 2483 + 0x8 bytes C++
generat0rX.exe!generat0rX::generat0rX(QWidget * parent=0x00000000, QFlags<enum Qt::WindowType> flags={...}) Line 8 + 0x31 bytes C++
generat0rX.exe!main(int argc=1, char * * argv=0x0069f9f0) Line 24 + 0x1d bytes C++
generat0rX.exe!WinMain(HINSTANCE__ * instance=0x00980000, HINSTANCE__ * prevInstance=0x00000000, char * __formal=0x00072b9a, int cmdShow=1) Line 131 + 0x12 bytes C++
generat0rX.exe!__tmainCRTStartup() Line 547 + 0x2c bytes C
generat0rX.exe!WinMainCRTStartup() Line 371 C
To copy to clipboard, switch view to plain text mode
and the debugger points to this line in "qobject.cpp":
const QMetaObject *smeta = sender->metaObject();
To copy to clipboard, switch view to plain text mode
Any ideas?
Bookmarks