hallo,
versuche einige einfache verbindungen herzustellen. leider funktioniert das nicht. ich möchte mit einer checkbox zwei buttons, ein label und ein lineedit aktivieren bzw inaktiv schalten.
hier mein code für den header:
#ifndef VLOV_DIALOG_H_
#define VLOV_DIALOG_H_
#include <QDialog>
#include "ui_vlov_dialog.h"
class vlov_dialog : public QDialog, private Ui::vlov_dialog {
Q_OBJECT
public:
vlov_dialog(QWidget *parent = 0);
public slots:
void on_cbFilePath_StateChanged(void);
void on_pbMakeFile_clicked(void);
void on_pbPath_clicked(void);
};
#endif /*VLOV_DIALOG_H_*/
und für die cpp datei:
#include "vlov_dialog.h"
#include <QtGui>
vlov_dialog::vlov_dialog(QWidget *parent)
: QDialog(parent) {
setupUi(this);
/******************** start of the constructor
// set the horizontal headers up
QStringList hLabels;
hLabels << "VLO" << "GEN" << "PCD" << "Bild 1" << "Bild 2" << "Bild 3" << "Bild 4" << "Bild 5" << "Bild 6" << "Bild 7";
twVersion->setHorizontalHeaderLabels (hLabels);
// connect the signals to the slots
connect(cbFilePath, SIGNAL(stateChanged()), this, SLOT(on_cbFilePath_StateChanged()));
connect(pbMakeFile, SIGNAL(clicked()), this, SLOT(on_pbMakeFile_clicked()));
connect(pbFilePath, SIGNAL(clicked()), this, SLOT(on_pbFilePath_clicked()));
// fill the version-numbers of the used vlos into the tabel view
// designe the tabel view
// get data
// ask for path if no data found
// fill the data into the table view
/********************* end of the constructor
}
/******************** start of the implementation
// If the checkbox is checked
void vlov_dialog::on_cbFilePath_StateChanged(void) {
QApplication::beep();
if (cbFilePath->isChecked()) {
lFilePath->setEnabled(true);
leFilePath->setEnabled(true);
pbFilePath->setEnabled(true);
pbMakeFile->setEnabled(true);
}
else {
lFilePath->setEnabled(false);
leFilePath->setEnabled(false);
pbFilePath->setEnabled(false);
pbMakeFile->setEnabled(false);
}
}
// If the path button is clicked
void vlov_dialog::on_pbMakeFile_clicked(void) {
QApplication::beep();
}
// If the make file button is clicked
void vlov_dialog::on_pbPath_clicked(void) {
QApplication::beep();
}
ich kann fehlerfrei kompilieren und das programm ausführen. Aktiviere ich die checkbox, passiert nichts. Die anderen Elemente werden nicht aktiviert. Wo mache ich den Fehler?
Danke für die Hilfe
Tommy
connect scheint nicht zu funktionieren
Fehlender Datentyp in der connect-Funktion
Hallo,
Habe den Fehler gefunden, die connect Funktion muss so aussehen:
connect(cbFilePath, SIGNAL(stateChanged(int)), this, SLOT(on_cbFilePath_StateChanged()));
hatte bei stateChanged() den Datentyp vergessen (int)
wünsche allen ein schönes wochenende.
tommy
Habe den Fehler gefunden, die connect Funktion muss so aussehen:
connect(cbFilePath, SIGNAL(stateChanged(int)), this, SLOT(on_cbFilePath_StateChanged()));
hatte bei stateChanged() den Datentyp vergessen (int)
wünsche allen ein schönes wochenende.
tommy