Results 1 to 6 of 6

Thread: Color Editor Factory Documentation

  1. #1
    Join Date
    Mar 2011
    Posts
    82
    Thanks
    13
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Color Editor Factory Documentation

    I'm following this documentation page because I'm trying to implement a ColorComboBox Delegate of sorts to work over a custom data type (which recieves a QAbstractItemDelegate).

    Thing is, this documentation page is either wrong or I'm just not getting it.

    In http://doc.trolltech.com/4.5/itemvie...indow-cpp.html
    that document, you can see something like this (at the very end)

    Qt Code:
    1. setLayout(layout); setWindowTitle(tr("Color Editor Factory"));
    To copy to clipboard, switch view to plain text mode 

    That does not compile over a (reasonable from my PoV) "Identifier not found" error on "setLayout".

    How can I fix that? this pointer doesn't provide a setLayout method.

    How reliable are those documentation pages in general? It just so happens that that very documentation is EXACTLY what I need: A delegate for handling a color list selection.

  2. #2
    Join Date
    May 2010
    Location
    Romania
    Posts
    1,021
    Thanks
    62
    Thanked 260 Times in 246 Posts
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Color Editor Factory Documentation

    Didn't you forgot the public in the window.h file at this line:
    Qt Code:
    1. class Window : public QWidget //make sure you have 'public' inheritance
    To copy to clipboard, switch view to plain text mode 

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

    alitoh (9th May 2011)

  4. #3
    Join Date
    Mar 2011
    Posts
    82
    Thanks
    13
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Color Editor Factory Documentation

    YES! Thank you!! This has been bugging me for like 2 hours now.

    Too bad that, now, this points out something that's more likely than not a design flaw, because I now have a class signature like this,

    Qt Code:
    1. class ColorlistDelegate : public QItemDelegate, public QWidget
    2.  
    3. {
    4.  
    5. }
    To copy to clipboard, switch view to plain text mode 

  5. #4
    Join Date
    May 2010
    Location
    Romania
    Posts
    1,021
    Thanks
    62
    Thanked 260 Times in 246 Posts
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Color Editor Factory Documentation

    I'm not a model-view expert, but i'm pretty sure you don't need that class to inherit from both QWidget and QItemDelegate.

    LE: not all the classes have to inherit QWidget, the problem there was that only QWidgets have setLayout and if you just write class Window : QWidget means private inheritance and setLayout member function won't be accessible (since is private).
    Last edited by Zlatomir; 9th May 2011 at 21:09.

  6. #5
    Join Date
    Mar 2011
    Posts
    82
    Thanks
    13
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Color Editor Factory Documentation

    Thanks for the reply, thing is the GridTable I'm working with recieves QItemDelegate as parameter, thus this needs to inherit it to be "pass-able".

    I'm working on a re-design and re-learning of the Delegate concept, right now, because I'm at a loss on how to properly make a ComboBox that displays a list of Colored Rect and Color name.

  7. #6
    Join Date
    May 2010
    Location
    Romania
    Posts
    1,021
    Thanks
    62
    Thanked 260 Times in 246 Posts
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Color Editor Factory Documentation

    Yes you need to inherit from public QItemDelegate but i said that you don't need to inherit from QWidget.

Similar Threads

  1. Text editor color scheme
    By kosasker in forum Qt Tools
    Replies: 4
    Last Post: 14th February 2011, 22:36
  2. Use of a factory in a QTPlugin
    By PeterPaulAndMary in forum Qt Programming
    Replies: 7
    Last Post: 21st July 2010, 19:35
  3. qtcreator text editor color scheme problem
    By elflord in forum Qt Tools
    Replies: 1
    Last Post: 5th March 2009, 18:42
  4. Adding Qt's documentation to Xcode documentation browser
    By fabietto in forum Qt Programming
    Replies: 0
    Last Post: 10th June 2007, 16:38
  5. How to use QMIME Sourse Factory
    By shamik in forum Qt Programming
    Replies: 1
    Last Post: 20th December 2006, 15:49

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.