Hi
The following line of code gives error
Qt Code:
  1. QLinearGradient grad(rect().topLeft() + (rect().topLeft()-rect().bottomLeft()) / 2,
  2. (rect().topRight()-rect().bottomRight()) / 2);
  3. grad.setColorAt(0.0,0x000000); //Gives error
To copy to clipboard, switch view to plain text mode 

The error is
Qt Code:
  1. mainwindow.cpp: In member function ‘virtual void MainWindow::paintEvent(QPaintEvent*)’:
  2. mainwindow.cpp:103: error: conversion from ‘int’ to ‘const QColor’ is ambiguous
  3. ../../qtsdk-2009.01/qt/include/QtGui/qcolor.h:79: note: candidates are: QColor::QColor(QColor::Spec) <near match>
  4. ../../qtsdk-2009.01/qt/include/QtGui/qcolor.h:252: note: QColor::QColor(const char*)
  5. ../../qtsdk-2009.01/qt/include/QtGui/qcolor.h:75: note: QColor::QColor(QRgb)
  6. ../../qtsdk-2009.01/qt/include/QtGui/qcolor.h:73: note: QColor::QColor(Qt::GlobalColor) <near match>
To copy to clipboard, switch view to plain text mode 

But when i modify the statement to
Qt Code:
  1. grad.setColorAt(0.0,0x000001); //No error - changed 0x000000 to 0x000001
To copy to clipboard, switch view to plain text mode 
I get no error.

why does this happen?.Is it so because the compiler sees enum as ints(please correct me if i am wrong). If that is the case then there can not be two constructors with enum arguments to a class as in QColor (QColor(Qt::GlobalColor color) and QColor(Spec spec)).