Question

I am developing a system and for the GUI I preferred to use QT plug in for VisStudio 2012. I used a file browser once the browse button is pressed everything works fine and I select my file. Right after the process with my file is completed, another file browser pops up... Can you help me? Here is the code:

#include "istorm__v3.h"
#include <QFileDialog>
#include <QMessageBox>
#include "ui_istorm__v3.h"
#include "iStormParser.h"

using namespace std;
iStormParser * isp;
iSTORM__v3::iSTORM__v3(QWidget *parent)
    : QMainWindow(parent)
{
    isp=new iStormParser();
    ui.setupUi(this);
    //ui.pushButton->setAutoDefault(false);
    connect(ui.pushButton, SIGNAL(ui.pushButton.clicked()), this, SLOT(ui.on_pushButton_clicked()));
}

iSTORM__v3::~iSTORM__v3()
{
}

void iSTORM__v3::on_pushButton_clicked()
{
    QString filename = QFileDialog::getOpenFileName(this,
                                                    tr("Choose File"),
                                                    "D:\\Desktop\\iSTORM__v3\\iSTORM__v3\\",
                                                    "C Files (*.c);;H Files (*.h)");

    string tmp=filename.toUtf8().constData();
    unsigned found = tmp.find_last_of("/\\");
    tmp=tmp.substr(found+1);

    string data=isp->run("\\testFiles\\"+tmp);
    ui.textEdit->setText( QString::fromStdString(data));
    return;
}
Was it helpful?

Solution

This issue would probably happen if you either connect the slot to the corresponding signal twice, or you emit the same signal again in your slot invokation, or at least "quickly" somewhere after having the slot quit that would bring this user experience.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top