标题:bool QColor::operator== ( const QColor & c ) const 的使用
作者:hongri
日期:2006-08-25 16:28
内容:
比较两个颜色是用
bool QColor::operator== ( const QColor & c ) const
请问这个函数怎么用?
#1 [ediwon 08-25 17:00]
//C++基础问题, ==运算符重载函数
QColor colorA( QColor("red") );
QColor colorB( QColor("green") );
if (colorB == colorA)
{
//........
}
#2 [hongri 08-26 23:46]
谢谢楼上的!
也可以直接用
if ( QColor("red") == QColor("green") )
{
//........
}