PDA

View Full Version : Paint() calls



alitoh
9th May 2011, 20:37
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:




for ( int i = o; i < QColor().colorNames().length(); i++ )
{
paint(indexofColorname)
}

and then I'd expect something like this in the Class::paint(indexofColorname) method implementation:



class::paint(/***/)
{
painter->drawText(QColor().colorNames(index);
}

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?

ChrisW67
10th May 2011, 02:05
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.