Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Do we have no color and null value for QColor



  • In the following code, I want to send null for QColor

    QColor myModel::getColorFromInstance(const QModelIndex& index ,myInst inst) const 
    {
      GQColor *gcObj =  myColor::getInstance();
      if (gcObj) {
         return QColor(Qt::white);
       // I want to send null value from here to notify there is no color value . is it possibel 
      }
    }
    

    Edit: Please wrap code snippets with 3 backticks. -- @Wieland



  • A QColor can be valid or invalid.

    QColor myFunc() {
        return QColor(); // returns an invalid QColor
    }
    

Log in to reply