Ich habe aktuell mein "Lernprogramm" um ein zweites Fenster für optionen erweitert, dieses leite ich von QDialog ab, das alles funktioniert so weit.
Nun habe ich aber zwei Radiobuttons in meinen Optionsfenster und möchte dort bei einer Änderung (also checked/unchecked) ein Signal senden was ein Slot dann empfängt.
Hier raff ich das ganze aber nicht, also vom Hauptfenster connecte ich ja auch zu meinen Funktionen und das funktioniert prima, aber bei dem zweiten Fanster
bevor Franzf wieder meckert hier mal der Quellcode der options.h
Code: Alles auswählen
#ifndef OPTIONS_H
#define OPTIONS_H
#include "ui_options.h"
#include <QDialog>
class options : public QDialog
{
Q_OBJECT
public:
explicit options(QWidget *parent = 0);
private:
Ui::Dialog UiDialog;
signals:
public slots:
void optionselect();
void optionsstat(bool toggled);
private slots:
};
#endif // OPTIONS_HCode: Alles auswählen
#include "options.h"
#include <QDialog>
#include <QFile>
#include <QDebug>
options::options(QWidget *parent) :
QDialog(parent)
{
UiDialog.setupUi(this);
connect(UiDialog.radioButton, SIGNAL(toggled(bool))), this, SLOT(optionsstat(toggled));
}
void options::optionselect()
{
options o;
o.exec();
QString optionsfile,option;
QStringList optionslist;
QString dir = QCoreApplication::applicationDirPath();
optionsfile = dir + "/options.rsc";
QFile optio(optionsfile);
optio.open(QIODevice::ReadWrite);
if (optio.error() == 0)
{
option = optio.readLine();
}
optionslist = option.split(",");
int og = optionslist.size();
qDebug() << og;
}
void options::optionsstat(bool toggled)
{
qDebug() << toggled;als Fehlermeldung bekomme ich
Code: Alles auswählen
C:\Qt\Testpro\options.cpp:12: Fehler:no matching function for call to 'options::connect(QRadioButton*&, const char*)'Code: Alles auswählen
C:\Qt\Testpro\..\..\QtSDK\Desktop\Qt\4.7.4\mingw\include\QtCore\qobject.h:198: candidates are: static bool QObject::connect(const QObject*, const char*, const QObject*, const char*, Qt::ConnectionType)kann mich da mal einer erhellen wo ich da auf dem Schlauch stehe
weihnachtliche Grüße
John