complete beginner here. I'm trying to execute a function whenever pushButton is pressed, but it only gets executed after I close the main window. How can I make this happen instantly whenever the button is pressed?
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <iostream>
using namespace std;
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::on_pushButton_clicked()
{
cout << "test";
}
"test" is printed only after the window is closed. Same thing happens when I call my own function.