Use QColor from getColor on QLabel and QTextbox

//To use color on text and label 
//Simple sample :)
QColor color = QColorDialog::getColor(QColor(ui->backgroundColorPickerText->text()), this);
   if(color.isValid())
    {
 
        QPixmap pix(21, 21);
        pix.fill(color);
 
        ui->backgroundColorPickerLabel->setPixmap(pix);
        ui->backgroundColorPickerText->setText(color.name());
    }
Category(s): Qt, Qt-Tips
Tags: , , ,

Leave a Reply

Your email address will not be published. Required fields are marked *

*

 

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">