Results 1 to 10 of 10

Thread: Connect lambda, sender argument must be string from array

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Aug 2016
    Posts
    36
    Qt products
    Qt4
    Platforms
    Windows

    Default Connect lambda, sender argument must be string from array

    How can I send a string from an array with connect using the lambda-notation? I want to send btnTest[pagecounter-1] as the first argument of the connect, but the compiler says 'no matching function for call to ...'

    Qt Code:
    1. btnTest = new QPushButton[pagecounter];//("G", this);
    2. btnTest[pagecounter-1].setMaximumSize(QSize(20,20));
    3.  
    4. btnTest[pagecounter-1].setObjectName(QString::number(pagecounter-1));
    5.  
    6. top->addWidget(groupBox);
    7. top->addWidget(btnTest, pagecounter-1);
    8. top->maximumSize();
    9.  
    10. mainLayout->addLayout(top);
    11.  
    12. QVBoxLayout *vbox = new QVBoxLayout;
    13. groupBox->setLayout(vbox);
    14.  
    15. connect(btnTest[pagecounter-1], &QPushButton::clicked, [=] {
    16. emit systembutton_clicked(btnTest[pagecounter-1].objectName().toInt(), 1, vbox);
    17. });
    To copy to clipboard, switch view to plain text mode 
    Last edited by bchinfosieeuw; 24th December 2016 at 21:52.

Similar Threads

  1. Replies: 1
    Last Post: 25th August 2016, 16:24
  2. Replies: 6
    Last Post: 12th February 2012, 04:52
  3. Cast QString array to std::string array
    By Ishtar in forum Newbie
    Replies: 4
    Last Post: 15th July 2011, 08:28
  4. Replies: 1
    Last Post: 12th January 2009, 18:05
  5. QtScript : passing array as argument into function
    By derek_r in forum Qt Programming
    Replies: 4
    Last Post: 27th October 2007, 10:46

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.