Important: Please read the Qt Code of Conduct -

QColor name to rgb name

  • Hellow, how can i get rgb name from QColor
    For example
    I have QColor = Qt::black
    how can i get "rgb(0,0,0)"
    I try it:
    But it is get me #000000 instead of rgb(0,0,0);
    Advance many thanks for your help

  • if you need rgb(0,0,0), you can do:

    QColor c = Qt::black;
    QString text = QString("rgb(%1,%2,%3)").arg(;

    Code is not tested, just written here

  • Try this:
    QColor c;
    QString name = QString("rgb(%1,%2,%3)").arg(;
    *EDIT:*As Gerolf said... >:(

Log in to reply