Question about QColor and QColorDialog
Unsolved
General and Desktop
-
Question about
QColor
andQColorDialog
void MainWindow::on_pushButton_clicked() { QColor color = QColorDialog::getColor(Qt::black, this, "Choose Pixel Color"); if(color.isValid()) { qDebug() << color.convertTo(QColor::Spec QRgb); } }
it outputs
QColor(ARGB 1, 0, 1, 0)
can i set the output to be
RGB888
? if yes how? :S i was in the docs for QColor but all i found was.toRgb
but that did nothing -
In QColor types, RGB = ARGB.
If you want a QString like "#RRGGBB", you can usecolor.name()
.If you want an integer, the value of RGB24(888) equals the value of ARGB32 when alpha=0.
So you can get it from:quint32 value = color.rgba() & 0xFFFFFF
or
color.setAlpha(0); quint32 value = color.rgba()