Error in event Clicked on PushButton!
-
Hello , I am starting on Qt , I created a new design for test, inserted a botoão and am wondering associate the click event to an action (function) , but I'm not getting , compiling happens this error:
-
Error: 'Clicked' was not declared in this scope
-
following code: MainWindow.cpp
#include "mainwindow.h"
#include "ui_mainwindow.h"MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
connect(ui->pushButton,signal(Clicked()),
this,
SLOT(close()));
}MainWindow::~MainWindow()
{
delete ui;
} -
-
@Vicius_Souza said:
Hi and welcome
clicked()
with small cthe new syntax will catch such things
connect(ui->pushButton, &QPushButton::clicked, this, &QMainwindow::close);
(from memory, might be errors :) -
Perfect thank you !