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!
Forum Updated to NodeBB v4.3 + New Features

Error in event Clicked on PushButton!

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 487 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 6 Nov 2015, 14:53 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
    • M Offline
      M Offline
      mrjj
      Lifetime Qt Champion
      wrote on 6 Nov 2015, 14:55 last edited by mrjj 11 Jun 2015, 14:59
      #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 6 Nov 2015, 15:03 last edited by
        #3

        Perfect thank you !

        1 Reply Last reply
        0

        1/3

        6 Nov 2015, 14:53

        • Login

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