QColorDialog on clicking cancel is by default taking black color.
Solved
General and Desktop
-
@Sriu1 "The dialog is a child of parent. It returns an invalid (see QColor::isValid()) color if the user cancels the dialog." - http://doc.qt.io/qt-5/qcolordialog.html#getColor
Also getColor() is a static method there is no need to create an instance (and it can't have "previos color" for that reason).