Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Button Onclicked - Event not fired.
Qt 6.11 is out! See what's new in the release blog

Button Onclicked - Event not fired.

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
qt mobile
2 Posts 1 Posters 1.9k Views
  • 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.
  • M Offline
    M Offline
    Mathan M
    wrote on last edited by
    #1

    Hi,

    I had created a simple button in .qml file and created the function signature in .h file and defined the function in .CPP file.
    The Debugger is working until the app is loaded. But, when I click the button, nothing happens, Event is not fired as well debugger is also not working. Am I missing some thing?

    Code Snippets:
    search.qml file
    Button
    {
    id: btnSubmit
    x: 347
    y: 526
    width: 100
    height: 50
    text: qsTr("Submit")
    anchors{
    left: parent
    top: parent
    margins: 15 * scaleFactor
    }
    onClicked:{
    QtCPPSearchVOne.funsearchMap();
    }
    }//Button

    search.h
    public:
    Q_INVOKABLE void funsearchMap();

    search.cpp*

    void QtCPPSearchVOne::funsearchMap()
    {
    QString obj;
    obj = QString::QString("Break Event Fired");
    }

    Error message:
    Property of object is not a function

    Thanks in advance.

    1 Reply Last reply
    0
    • M Offline
      M Offline
      Mathan M
      wrote on last edited by Mathan M
      #2

      Now its working.
      wrongly used the namespace name in the .qml fle instead of id.

      QtCPPSearchVOne {
      id: objQtCPPSearchVOne
      Button
      {
      id: btnSubmit
      onClicked:{
      objQtCPPSearchVOne.funsearchMap()
      }
      }
      }

      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