jaca
1st December 2011, 16:15
The code below allows me to change the color of QTextEdit when the function is called.
void DetonSis::colorEdit(QTextEdit *color)
{
QPalette pal, pal2;
pal.setColor(QPalette::Base, QColor(qrand() % 256, qrand() % 256, qrand() % 256));
pal2.setColor(QPalette::Base, Qt::white);
for(int i = 0; i < listEdit.size(); ++i)
listEditor[i]->setPalette(pal2);
color->setPalette(pal);
}
What I want is to limit the function
QColor(qrand() % 256, qrand() % 256, qrand() % 256) for only three known colors. Any idea?
Thanks
void DetonSis::colorEdit(QTextEdit *color)
{
QPalette pal, pal2;
pal.setColor(QPalette::Base, QColor(qrand() % 256, qrand() % 256, qrand() % 256));
pal2.setColor(QPalette::Base, Qt::white);
for(int i = 0; i < listEdit.size(); ++i)
listEditor[i]->setPalette(pal2);
color->setPalette(pal);
}
What I want is to limit the function
QColor(qrand() % 256, qrand() % 256, qrand() % 256) for only three known colors. Any idea?
Thanks