Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Error in event Clicked on PushButton!

Error in event Clicked on PushButton!

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 624 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    Vicius_Souza
    wrote on last edited by
    #1

    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;
    }

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by mrjj
      #2

      @Vicius_Souza said:
      Hi and welcome
      clicked()
      with small c

      the new syntax will catch such things
      connect(ui->pushButton, &QPushButton::clicked, this, &QMainwindow::close);
      (from memory, might be errors :)

      https://wiki.qt.io/New_Signal_Slot_Syntax

      1 Reply Last reply
      1
      • V Offline
        V Offline
        Vicius_Souza
        wrote on last edited by
        #3

        Perfect thank you !

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved