Navigation

    Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Search
    1. Home
    2. Tags
    3. clicked
    Log in to post

    • UNSOLVED QPushButton.click должен изменять мой QLabel
      Russian • qpushbutton qlabel click clicked • • Regex_brave  

      15
      0
      Votes
      15
      Posts
      138
      Views

      @Regex_brave Use lambdas (new style syntax) e.g. if you want to pass different parameters from signal to slot. Example: // member variables QPushButton *pb1, *pb2 pb1 = new QPushButton(this); pb1->setObjectName("PushButton #1"); pb2 = new QPushButton(this); pb2->setObjectName("PushButton #2"); connect(pb1, &QPushButton::clicked, this, &MainWindow::pushButtonClicked); connect(pb2, &QPushButton::clicked, this, &MainWindow::pushButtonClicked); connect(pb1, &QPushButton::clicked, this, []() { qDebug() << "A button was clicked, but *still* do not know which button"; }); // lambda connect(pb2, &QPushButton::clicked, this, []() { qDebug() << "A button was clicked, but *still* do not know which button"; }); // lambda connect(pb1, &QPushButton::clicked, this, [this]() { pushButtonClicked(pb1); }); // lambda connect(pb2, &QPushButton::clicked, this, [this]() { pushButtonClicked(pb2); }); // lambda void MainWindow::pushButtonClicked(bool checked = false) { qDebug() << "A button was clicked, but do not know which button"; } void MainWindow::pushButtonClicked(QPushButton *pb) { qDebug() << "Button was clicked, objectName:" << pb->objectName(); }
    • UNSOLVED MouseArea inside MapQuickItem not clickable?
      General and Desktop • mousearea qtlocation clicked mapquickitem • • Nandakishore  

      2
      0
      Votes
      2
      Posts
      1258
      Views

      I just stumbled accros the same odd behavior with Qt 5.7.1. However, the strange thing is, that it seems to be only a problem on android (on windows it's fine). Does anybody know if that's a (already reported) bug?
    • SOLVED How to get a slot when a row of a QTableWidget is clicked ?
      General and Desktop • qtablewidget signal slot clicked • • cxam  

      5
      0
      Votes
      5
      Posts
      3291
      Views

      @mrjj Thanks :)
    • UNSOLVED (Python) Cannot call findChild(QObject, 'child') on QObject. Returns None.
      QML and Qt Quick • python qt quick signal connect failure clicked • • 0BobTheJanitor  

      1
      0
      Votes
      1
      Posts
      2840
      Views

      No one has replied

    • UNSOLVED PyQt immediately calling function handler upon setup. Why?
      General and Desktop • pyqt5 signal button connect clicked • • errolflynn  

      4
      0
      Votes
      4
      Posts
      2647
      Views

      @errolflynn You should write self.button1.clicked.connect(ft_handler) - this will register the function ft_handler as a slot for the clicked signal. On http://doc.qt.io/qt-5/qabstractbutton.html you see that the signature of that signal is void clicked(bool checked). In other words, when the signal is activated, your handler is called as ft_handler(checked) where checked is either True or False. Per the signature of the clicked signal, this is the only information you will get out of the signal. If you want to pass additional parameters, you indeed will need to create a separate function that encodes those extra parameters and passes them to the handler. In Python it makes a lot of sense to use a lambda for it, for instance: self.button1.clicked.connect(lambda checked: fct_handler(par1, par2, par3, checked)) Hope this helps
    • Push button clicked event executed simultaneously with returnedPressed() event of a LineEdit - *SOLVED*
      General and Desktop • line edit push button clicked returnpressed • • Raim  

      1
      0
      Votes
      1
      Posts
      567
      Views

      No one has replied