Results 1 to 3 of 3

Thread: [SOLVED] regarding QSignalMapper and QComBox in QTableWidget

  1. #1
    Join Date
    Nov 2010
    Location
    planet earth
    Posts
    19
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Exclamation [SOLVED] regarding QSignalMapper and QComBox in QTableWidget

    hi,

    this is my code to display a QComboBox in a QTableWidget and using QSignalMapper to re-emit the signal but the output is Object::connect: No such signal QComboBox::currentIndexChanged()

    Qt Code:
    1. QSignalMapper* signalMapper = new QSignalMapper(this);
    2. QString val = tableUsers->item(y, x)->text();
    3. QComboBox* dropdownPosition = new QComboBox();
    4. QSqlQuery query;
    5. query.exec("SELECT * FROM position");
    6. int i = 0;
    7. while (query.next()) {
    8. dropdownPosition->addItem(query.value(1).toString());
    9. if (val == query.value(1).toString()) dropdownPosition->setCurrentIndex(i);
    10. i++;
    11. }
    12. query.clear();
    13. tableUsers->setCellWidget(y, x, dropdownPosition);
    14. connect(dropdownPosition, SIGNAL(currentIndexChanged()), signalMapper, SLOT(map()));
    15. signalMapper->setMapping(dropdownPosition, QString("%1-%2").arg(y).arg(x));
    16. connect(signalMapper, SIGNAL(mapped(const QString &)), this, SLOT(editUserPosition()));
    To copy to clipboard, switch view to plain text mode 

    am i doing it right? or there is something missing in my code? thanx for the help..
    Last edited by xeroblast; 7th December 2010 at 09:19.

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: regarding QSignalMapper and QComBox in QTableWidget

    It is not clear why you use a signal mapper but anyway the warning is because there is no signal called currentIndexChanged()! You mean currentIndexChanged(int) or currentIndexChanged(const QString&), don't you?

  3. #3
    Join Date
    Nov 2010
    Location
    planet earth
    Posts
    19
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: regarding QSignalMapper and QComBox in QTableWidget

    thanx. and you were right. i just have to add the parameter...

    i use the signal mapper coz every time the user double clicks in QTableWidget position column, a QComboBox appears but the QComboBox signal cant emit its signal to the given function for editing the value.

    thanx a lot...

Similar Threads

  1. QSignalMapper
    By axisdj in forum Newbie
    Replies: 6
    Last Post: 16th September 2010, 01:52
  2. Problem styling QComBox using stylesheet
    By sjagtap in forum Newbie
    Replies: 4
    Last Post: 22nd March 2010, 13:18
  3. QTableView item's Highlight in QCombox
    By litterflybug in forum Qt Programming
    Replies: 1
    Last Post: 26th August 2009, 14:06
  4. help with QSignalMapper and actions
    By andreime in forum Newbie
    Replies: 1
    Last Post: 9th August 2009, 18:24
  5. ? about QSignalMapper
    By JimDaniel in forum Qt Programming
    Replies: 1
    Last Post: 13th January 2008, 21:21

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
  •  
Qt is a trademark of The Qt Company.