一、静态函数-API:
// 弹出颜色选择对话框, 并返回选中的颜色信息/*参数:- initial: 对话框中默认选中的颜色, 用于窗口初始化- parent: 给对话框窗口指定父对象- title: 对话框窗口的标题- options: 颜色对话框窗口选项, 使用默认属性即可, 一般不需要设置*/[static] QColor QColorDialog::getColor(const QColor &initial = Qt::white,QWidget *parent = nullptr, const QString &title = QString(),QColorDialog::ColorDialogOptions options = ColorDialogOptions());
// 构造函数QColor::QColor(Qt::GlobalColor color);QColor::QColor(int r, int g, int b, int a = ...);QColor::QColor();// 参数设置 red, green, blue, alpha, 取值范围都是 0-255void QColor::setRed(int red); // 红色void QColor::setGreen(int green); // 绿色void QColor::setBlue(int blue); // 蓝色void QColor::setAlpha(int alpha); // 透明度, 默认不透明(255)void QColor::setRgb(int r, int g, int b, int a = 255);int QColor::red() const;int QColor::green() const;int QColor::blue() const;int QColor::alpha() const;void QColor::getRgb(int *r, int *g, int *b, int *a = nullptr) const;
