Results 1 to 2 of 2

Thread: Paint() calls

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

    Default Paint() calls

    I want to be able to do something like an iterative cycle in which I call my parametrized paint method, each time with a different parameter value.

    The idea is to fill a comboBox with different text values for each row.

    Something along these lines:

    Qt Code:
    1. for ( int i = o; i < QColor().colorNames().length(); i++ )
    2. {
    3. paint(indexofColorname)
    4. }
    To copy to clipboard, switch view to plain text mode 
    and then I'd expect something like this in the Class:aint(indexofColorname) method implementation:

    Qt Code:
    1. class::paint(/***/)
    2. {
    3. painter->drawText(QColor().colorNames(index);
    4. }
    To copy to clipboard, switch view to plain text mode 
    and, thus, I'd expect to fill a QComboBox with the names of the colorNames QStringList.

    However, I can't use the paint method like that, can I?

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Paint() calls

    Why would you want to try to subvert paint() when you can just insert the colour names en masse with QComboBox::addItems() or by writing a separate model that returns the colour names.

Similar Threads

  1. strange calls to windows dll's
    By tomrider in forum Qt Programming
    Replies: 5
    Last Post: 9th May 2011, 07:47
  2. How to use IOCTL calls with QT?
    By augusbas in forum Qt Programming
    Replies: 3
    Last Post: 15th November 2010, 07:55
  3. how to group paint calls together ??
    By tampstaffs in forum Qt Programming
    Replies: 3
    Last Post: 26th February 2009, 16:35
  4. QTabBar::tabInserted(int..) never calls
    By khcbabu in forum Qt Programming
    Replies: 1
    Last Post: 16th January 2009, 17:04
  5. Polymorphism with static calls
    By niko in forum General Programming
    Replies: 12
    Last Post: 9th November 2007, 09:52

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.