Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. QML Error: When matching arguments for CustomTabButton_QMLTYPE_10::buttonClicked(): Too many arguments, ignoring 1. But there are no arguments?
Qt 6.11 is out! See what's new in the release blog

QML Error: When matching arguments for CustomTabButton_QMLTYPE_10::buttonClicked(): Too many arguments, ignoring 1. But there are no arguments?

Scheduled Pinned Locked Moved Solved QML and Qt Quick
2 Posts 2 Posters 732 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.
  • D Offline
    D Offline
    Dizarc
    wrote on last edited by Dizarc
    #1

    I am trying to create a QML custom button for a tab. I have made a new signal called buttonSignal that is connected to the clicked signal in a MouseArea. I have done this because for some reason the slots that are written as on<Signal> don't work in dynamically created qml. I call the onButtonClicked when a button is clicked but i get an error:
    When matching arguments for CustomTabButton_QMLTYPE_10::buttonClicked():
    Too many arguments, ignoring 1

    Which is weird because i don't have any arguments.
    where i create a CustomTabButton

    CustomTabButton{
            id: firstButton
    
            onButtonClicked: {
                console.log("button clicked");
            }
    
        }
    

    CustomTabButton.qml

    import QtQuick 6.2
    
    Rectangle{
        id: buttonRect
    
        width: 100
        height: 20
        radius: 2
    
        color: "#B2BEB5"
    
        signal buttonClicked;
    
        Component.onCompleted:{
            mouseArea.clicked.connect(buttonClicked);
        }
    
        Text{
            id: buttonText
    
            anchors.centerIn: parent
            text: qsTr("TESTING")
        }
    
        MouseArea{
            id: mouseArea
    
            anchors.fill: parent
            cursorShape: Qt.PointingHandCursor
            hoverEnabled: true
    
        }
    
    }
    
    1 Reply Last reply
    0
    • KH-219DesignK Offline
      KH-219DesignK Offline
      KH-219Design
      wrote on last edited by KH-219Design
      #2

      You say: "I don't have any arguments." I believe I know what you mean when you say that. You are saying that your custom signal signal buttonClicked takes no arguments.

      But I think that misses the point.

      The reason there are "too many arguments" is that the original signal does have one argument:

      clicked(MouseEvent mouse)

      (refer to docs: https://doc.qt.io/qt-6/qml-qtquick-mousearea.html#clicked-signal)

      What the error is trying to tell you (I believe) is that when you try to connect (i.e. pass along) the MouseArea's signal to your own, the MouseArea's signal carries too many arguments (too many to match the signature of what you want to connect it to).

      www.219design.com
      Software | Electrical | Mechanical | Product Design

      1 Reply Last reply
      0
      • D Dizarc has marked this topic as solved on

      • Login

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