mikea
4th October 2014, 21:41
In the following code segment from dialog.cpp, the push button saveFolderPB gives the error "not declared in this scope". WHY? I have no idea. I have a simple dialog with a few buttons using on_object_triger private slots, which all work correctly. In the slot shown in the code snipped all I am doing is trying to enable another push button. Why is the button widget not declared in scope? It is public in ui_dialog.h, which is included as shown in the snipped - and it was put there by QCreator. I thought all class member variables are accessible by all class non-static member methods.
#include "dialog.h"
#include "ui_dialog.h"
#include <QFileDialog>
#include <iostream>
....
void Dialog::on_QFXSourcePB_pressed()
{
// Display file selection dialog.
QString selfilter = "QFX (*.qfx)";
QString inFileName = QFileDialog::getOpenFileName(
this,
"Select .qfx file.",
"C:\\users\\Mike\\Desktop",
"All files (*.*);; QFX (*.qfx)", &selfilter);
if (!inFileName.isEmpty()){
saveFolderPB.setEnabled(); // NOT DECLARED IN THIS SCOPE !!
QFXreader reader;
reader.readQFX(inFileName, qfxInfo, qifTL);
}
}
#include "dialog.h"
#include "ui_dialog.h"
#include <QFileDialog>
#include <iostream>
....
void Dialog::on_QFXSourcePB_pressed()
{
// Display file selection dialog.
QString selfilter = "QFX (*.qfx)";
QString inFileName = QFileDialog::getOpenFileName(
this,
"Select .qfx file.",
"C:\\users\\Mike\\Desktop",
"All files (*.*);; QFX (*.qfx)", &selfilter);
if (!inFileName.isEmpty()){
saveFolderPB.setEnabled(); // NOT DECLARED IN THIS SCOPE !!
QFXreader reader;
reader.readQFX(inFileName, qfxInfo, qifTL);
}
}