QColorDialog cdg;
int windowWidth = cdg.geometry().width();
int windowHeight = cdg.geometry().height();
cdg.move((screenWidth-windowWidth)/2+150 ,(screenHeight-windowHeight)/2+55);
// cdg.resize(480,272);//不起作用
cdg.setWindowTitle(tr("选择颜色"));
cdg.exec();
QColor color = cdg.selectedColor();
cdg.close();
//获取颜色值
if(color.isValid())
{
drawWidget->setColor(color);
QPixmap pixmap(20,20);
pixmap.fill(color);
colorBtn->setIcon(QIcon(pixmap));
}