Results 1 to 2 of 2

Thread: no matching function for call to 'QTableWidgetItem::setFlags(bool)'

  1. #1
    Join Date
    Jan 2012
    Posts
    10
    Thanks
    5
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default no matching function for call to 'QTableWidgetItem::setFlags(bool)'

    Hello,

    I have the following piece of code which works fine in Qt 4.8.6 and 5.6.2, but fails in Qt-5.8. I was trying to make the Item not selectable, but boolean fails in Qt-5.8

    Qt Code:
    1. QTableWidgetItem *newItem1 = new QTableWidgetItem("");
    2. newItem1->setFlags(not Qt::ItemIsSelectable);
    To copy to clipboard, switch view to plain text mode 

    Error is
    Qt Code:
    1. no matching function for call to 'QTableWidgetItem::setFlags(bool)'
    To copy to clipboard, switch view to plain text mode 

    Thanks

  2. #2
    Join Date
    Dec 2009
    Location
    New Orleans, Louisiana
    Posts
    791
    Thanks
    13
    Thanked 153 Times in 150 Posts
    Qt products
    Qt5
    Platforms
    MacOS X

    Default Re: no matching function for call to 'QTableWidgetItem::setFlags(bool)'

    That's because QTableWidgetItem::setFlags() doesn't take a boolean as an argument, it takes a Qt::ItemFlags enum. To set the flags, you need to OR together the flags you want to set. If you want to turn off a specific flag, leaving the others unchanged, you can do the following:
    Qt Code:
    1. item->setFlags(item->flags() & ~Qt::ItemIsSelectable);
    To copy to clipboard, switch view to plain text mode 
    Last edited by jefftee; 12th February 2017 at 21:13.
    I write the best type of code possible, code that I want to write, not code that someone tells me to write!

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

    rajil.s (13th February 2017)

Similar Threads

  1. Replies: 5
    Last Post: 11th March 2015, 09:30
  2. error: no matching function for call to ‘QTimer:
    By saman_artorious in forum Qt Programming
    Replies: 2
    Last Post: 21st May 2012, 15:27
  3. about no matching function for call to
    By Alain Delon in forum General Programming
    Replies: 1
    Last Post: 5th March 2011, 21:30
  4. no matching function for call to setupUi
    By ctote in forum Qt Programming
    Replies: 2
    Last Post: 30th January 2010, 15:20
  5. No Matching function to call...
    By weepdoo in forum Qt Programming
    Replies: 2
    Last Post: 7th November 2008, 17:30

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.