colordialog.cpp
来自「一大堆的qt程序,在qte2.3.7下全部可以很好地运行」· C++ 代码 · 共 39 行
CPP
39 行
#include "colordialog.h"ColorDialog::ColorDialog(QWidget *parent,const char *name, bool isModal) :QDialog(parent,name,isModal){ redbutton = new QPushButton("red",this); greenbutton = new QPushButton("green",this); bluebutton = new QPushButton("blue",this); whitebutton = new QPushButton("white",this); connect(redbutton,SIGNAL(click()),SLOT(ChooseBackgroundColor())); connect(greenbutton,SIGNAL(click()),SLOT(ChooseBackgroundColor())); connect(bluebutton,SIGNAL(click()),SLOT(ChooseBackgroundColor())); connect(whitebutton,SIGNAL(click()),SLOT(ChooseBackgroundColor()));}void ChooseBackgroundColor(){ if(redbutton->isDown()) col = red; else if(greenbutton->isDown()) { col = green; } else if(bluebutton->isDown()) { col = blue; } else if(whitebutton->isDown()) { col = white; }}void color(){ return col;}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?