What is difference between QColor("transparent") and QColor(Qt::transparent)
-
What is difference between QColor("transparent") and QColor(Qt::transparent)
Also
Why QColor(Qt::black) == QColor("transparent")
-
qDebug() << "Qt::black" << QString::number(QColor(Qt::black).rgba(),16); qDebug() << "transparent" << QString::number(QColor("transparent").rgba(),16); qDebug() << "Qt::transparent" << QString::number(QColor(Qt::transparent).rgba(),16); qDebug() << "Qt::black==transparent" << (QColor(Qt::black) == QColor("transparent"));
result:
Qt::black "ff000000" transparent "0" Qt::transparent "0" Qt::black==transparent false
So:
What is difference between QColor("transparent") and QColor(Qt::transparent)
none
Why QColor(Qt::black) == QColor("transparent")
They are not
-
This post is deleted!
-
In 4.3.3 , I am getting following output
qDebug() << "Qt::black==transparent" << (QColor(Qt::black) == QColor("transparent"));it is true
qDebug() << "Qt::transparent==transparent" << (QColor(Qt::transparent) == QColor("transparent")
as false
can u check
-
That's probably because named colours did not support transparency until Qt 5.2, see https://bugreports.qt.io/browse/QTBUG-6725
QColor("transparent")
in Qt 4 is actually fully opaque with RGB components all set to 0, in other words black -
Can I consider to be bug of Qt.4.3.3
-
@Qt-Enthusiast
Its not a bug. Its just how it worked back then. :)
You are using a very old Qt that is no longer maintained or change so in this case
its just how it was implemented back then. They later change it to support transparent in # syntax but
its not in your version. -
What is signification of alpha value ?
QColor sc("transparent")
sc.alpha() is 255 for for qt.4.3.3
and
sc.alpha() is 0 after Qt 5.2What is sc.alpha means
-
@Qt-Enthusiast
alpha is the transparency level -
@Qt-Enthusiast said in What is difference between QColor("transparent") and QColor(Qt::transparent):
What is signification of alpha value ?
https://en.wikipedia.org/wiki/Alpha_compositing#Alpha_blending