Results 1 to 2 of 2

Thread: No such signal QListWidget::itemClicked

  1. #1
    Join Date
    Feb 2010
    Posts
    61
    Thanks
    18
    Qt products
    Qt4
    Platforms
    MacOS X

    Default No such signal QListWidget::itemClicked

    Hi,

    I have a QListWidget that would like to connect it to a slot. This slot should be triggered every time an item of the list is clicked. Here is my (simple) code:

    pages.h
    -------------------------------------------------
    class IndustryPage : public QWidget {
    Q_OBJECT
    public:
    IndustryPage(QWidget *parent = 0);
    private slots:
    void test(QListWidgetItem *item);
    };
    -------------------------------------------------


    pages.cpp
    -------------------------------------------------
    QGroupBox *sectorGroup = new QGroupBox(tr("Sector"));

    QListWidget *sectorList = new QListWidget;
    sectorList->setMaximumSize(QLISTWIDGET_SIZE);
    connect(sectorList, SIGNAL(itemClicked(QListWidgetItem *item)), this, SLOT(test(QListWidgetItem *item)));


    qmake and make run without any issue, but when I run the application there is an error message which says:

    Object::connect: No such signal QListWidget::itemClicked(QListWidgetItem *item) in ../src/pages.cpp:67

    which is weird since itemClicked is part of QListWidget... Does anybody have an idea ?

    I'm using Qt 4.6 on a mac with OS X 10.6 and usually I have no problems with slots and signals...

  2. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: No such signal QListWidget::itemClicked

    don't use parameters names in the connect() function, only types:
    Qt Code:
    1. connect(sectorList, SIGNAL(itemClicked(QListWidgetItem *)), this, SLOT(test(QListWidgetItem *)));
    To copy to clipboard, switch view to plain text mode 
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  3. The following user says thank you to high_flyer for this useful post:

    ouekah (23rd February 2010)

Similar Threads

  1. QListWidget SIGNAL Problem
    By skuda in forum Qt Programming
    Replies: 19
    Last Post: 28th October 2009, 15:42
  2. signal of QListWidget doesn't work
    By vito49 in forum Qt Programming
    Replies: 10
    Last Post: 1st October 2008, 06:07
  3. QTreeWidget fails to emit itemClicked signal.
    By avh in forum Qt Programming
    Replies: 2
    Last Post: 6th June 2008, 19:49
  4. QListWidget signal problem
    By rishid in forum Qt Programming
    Replies: 6
    Last Post: 18th January 2008, 21:43
  5. QListWidget clicked signal
    By asieriko in forum Qt Programming
    Replies: 12
    Last Post: 10th August 2007, 16:37

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.