📄 colordialog.cpp
字号:
#include "colordialog.h"ColorDialog::ColorDialog(QWidget *parent,const char *name, bool isModal) :QDialog(parent,name,isModal){ redButton = new QPushButton("red",this); redButton->setGeometry(1,1,90,30); greenButton = new QPushButton("green",this); greenButton->setGeometry(1,31,90,30); blueButton = new QPushButton("blue",this); blueButton->setGeometry(1,61,90,30); whiteButton = new QPushButton("white",this); whiteButton->setGeometry(1,91,90,30); whiteButton->setFocus(); connect(redButton,SIGNAL(pressed()),SLOT(chooseColor())); connect(greenButton,SIGNAL(pressed()),SLOT(chooseColor())); connect(blueButton,SIGNAL(pressed()),SLOT(chooseColor())); connect(whiteButton,SIGNAL(pressed()),SLOT(chooseColor()));}void ColorDialog:: chooseColor(){ if(redButton->isDown()) { col = red; } else if(greenButton->isDown()) { col = green; } else if(blueButton->isDown()) { col = blue; } else if(whiteButton->isDown()) { col = white; } this->close();}QColor ColorDialog:: color(){ return col;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -