Results 1 to 2 of 2

Thread: [solved]QVariant QAbstractItemModel::data()

  1. #1
    Join Date
    Apr 2011
    Posts
    195
    Thanks
    49
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default [solved]QVariant QAbstractItemModel::data()

    Hello,

    I have a very short question about the data-method of QAbstractItemModel:

    Qt Code:
    1. QVariant QAbstractItemModel::data(const QModelIndex & index, int role = Qt::DisplayRole) const
    To copy to clipboard, switch view to plain text mode 

    Why is the role declaration not marked as const?

    Qt Code:
    1. QVariant QAbstractItemModel::data(const QModelIndex & index, const int role = Qt::DisplayRole) const
    To copy to clipboard, switch view to plain text mode 


    thank you!
    Last edited by Qiieha; 17th July 2015 at 12:51.

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QVariant QAbstractItemModel::data()

    It is just not very common to pass simple types as const, e.g. the C++ standard library doesn't do that either.

    Cheers,
    _

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

    Qiieha (17th July 2015)

Similar Threads

  1. Replies: 4
    Last Post: 5th March 2015, 18:38
  2. QVariant with QString / who free's its data?
    By elias.bachaalany in forum Newbie
    Replies: 1
    Last Post: 26th October 2010, 10:42
  3. Replies: 2
    Last Post: 25th August 2010, 08:56
  4. Using QVariant with custom data type
    By QAlex in forum Qt Programming
    Replies: 3
    Last Post: 4th December 2009, 12:04
  5. Use QVariant with custon data types
    By mcosta in forum Qt Programming
    Replies: 4
    Last Post: 11th January 2006, 14:55

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.