Results 1 to 3 of 3

Thread: QStandardItem::type() question

  1. #1
    Join Date
    Jul 2006
    Posts
    126
    Thanks
    17
    Thanked 4 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default QStandardItem::type() question

    Hi,

    I have 2 custom items in my model and I want to know any time the exact type of the item.

    type() function always returns the 0 type.

    Can someone help me?

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: QStandardItem::type() question

    Reimplement QStandardItem::type() for the custom types:
    Returns the type of this item. The type is used to distinguish custom items from the base class. When subclassing QStandardItem, you should reimplement this function and return a new value greater than or equal to UserType.
    The default implementation returns QStandardItem::Type which is equal to 0.
    J-P Nurmi

  3. #3
    Join Date
    Jul 2006
    Posts
    126
    Thanks
    17
    Thanked 4 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QStandardItem::type() question

    Yes was a problem with the makefile. Solved... but now...

    I have a TreeView with the StandardItemModel populated with "CategoryItem" and a ListView with another StandardItemModel populated with "ObjectItem". When I drag a item from ListView to TreeView it inserts the item right, but when I try to see the type of the "ObjectItem" in the TreeView it returns type 0.

Similar Threads

  1. QTextEdit simple question
    By Marcopolo in forum Qt Tools
    Replies: 4
    Last Post: 11th October 2007, 00:01
  2. Replies: 2
    Last Post: 22nd February 2007, 08:08
  3. Question regarding how to paint after zoom.
    By JonathanForQT4 in forum Qt Programming
    Replies: 2
    Last Post: 26th January 2007, 15:34
  4. QThread exit()/quit() question
    By TheKedge in forum Qt Programming
    Replies: 1
    Last Post: 28th August 2006, 14:38
  5. QTextEdit Qt4: simple question
    By TheKedge in forum Qt Programming
    Replies: 4
    Last Post: 18th January 2006, 12:03

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.