Seite 1 von 1

connect funktioniert nicht

Verfasst: 24. Februar 2008 22:53
von pospiech
Ich habe folgende Anweisung

Code: Alles auswählen

connect(action_menu_Parameters, SIGNAL(triggered()), MainWindowImpl, SLOT(showDialogSetLaserParameters()));
die einen Menueintrag mit einer Funktion verbinden soll.

Ich bekomme jedoch nur die Fehlermeldung:
src\mainwindowimpl.cpp: In constructor `MainWindowImpl::MainWindowImpl(QWidget*, Qt::WFlags)':
src\mainwindowimpl.cpp:8: error: expected primary-expression before ',' token
nehme ich die Zeile heraus, ist der Fehler weg.

Der komplette Code ist

Code: Alles auswählen

#include <QMainWindow>
#include "ui_mainwindow.h"
#include "DialogSetLaserParametersImpl.h"
//
class MainWindowImpl : public QMainWindow, public Ui::MainWindow
{
Q_OBJECT
public:
	MainWindowImpl( QWidget * parent = 0, Qt::WFlags f = 0 );
private slots:
	void showDialogSetLaserParameters();
public:
	DialogSetLaserParametersImpl * DialogSetLaserParameters;
	
};

Code: Alles auswählen

#include "mainwindowimpl.h"
//
MainWindowImpl::MainWindowImpl( QWidget * parent, Qt::WFlags f) 
	: QMainWindow(parent, f)
{
	setupUi(this);
	
	connect(action_menu_Parameters, SIGNAL(triggered()), MainWindowImpl, SLOT(showDialogSetLaserParameters()));	
}
//

void MainWindowImpl::showDialogSetLaserParameters()
{
	DialogSetLaserParameters = new DialogSetLaserParametersImpl(this);
	DialogSetLaserParameters->show();
	DialogSetLaserParameters->activateWindow();
}
Was ist falsch ?

Matthias

Verfasst: 24. Februar 2008 23:00
von Christian81
C++ basic...

MainWindowImpl ist der Klassenname, kein Pointer auf eine Klasse.

Verfasst: 24. Februar 2008 23:03
von pospiech
Christian81 hat geschrieben:C++ basic...

MainWindowImpl ist der Klassenname, kein Pointer auf eine Klasse.
Schon klar, war etwas blind. Habe es jetzt durch "this" ersetzt und kompiliert.

Matthias