- 142
- 0
- 约2.89万字
- 约 89页
- 2017-02-28 发布于湖北
- 举报
4.9.1 QPalette类 (3)打开“palette.cpp”文件,添加以下代码: #include QHBoxLayout #include QGridLayout Palette::Palette(QWidget *parent) : QDialog(parent) { createCtrlFrame(); createContentFrame(); QHBoxLayout *mainLayout =new QHBoxLayout(this); mainLayout-addWidget(ctrlFrame); mainLayout-addWidget(contentFrame); } createCtrlFrame()函数用于创建颜色选择区。 4.9.1 QPalette类 createContentFrame()函数用于显示选择的颜色对窗体外观的改变,具体代码。 ShowWindow()函数用于响应对背景颜色的选择: void Palette::ShowWindow() { //获得当前选择的颜色值 QStringList colorList = QColor::colorNames(); QColor color = QColor(colorList[windowComboBox-curren
原创力文档

文档评论(0)