paint::paint(QWidget *parent) : QMainWindow(parent), ui(new Ui::paint) { ui->setupUi(this); //设置画布 pix=new QPixmap(this->size()*5); pix->fill(Qt::white); //设置初使属性 brush.setColor(Qt::NoBrush); status=1; //连接信号和槽 connect(ui->line,SIGNAL(triggered(bool)),this,SLOT(status_line())); connect(ui->rect,SIGNAL(triggered(bool)),this,SLOT(status_rect())); connect(ui->ellipse,SIGNAL(triggered(bool)),this,SLOT(status_ellipse())); connect(ui->actionfree,SIGNAL(triggered(bool)),this,SLOT(status_free())); connect(ui->actionred,SIGNAL(triggered(bool)),this,SLOT(change_color_red())); connect(ui->actionblue,SIGNAL(triggered(bool)),this,SLOT(change_color_blue())); connect(ui->actiongreen,SIGNAL(triggered(bool)),this,SLOT(change_color_green())); connect(ui->actionblack,SIGNAL(triggered(bool)),this,SLOT(change_color_black())); connect(ui->action2,SIGNAL(triggered(bool)),this,SLOT(penwidth2())); connect(ui->action5,SIGNAL(triggered(bool)),this,SLOT(penwidth5())); connect(ui->action8,SIGNAL(triggered(bool)),this,SLOT(penwidth8())); connect(ui->action10,SIGNAL(triggered(bool)),this,SLOT(penwidth10())); connect(ui->solid_line,SIGNAL(triggered(bool)),this,SLOT(set_solid())); connect(ui->dash_line,SIGNAL(triggered(bool)),this,SLOT(set_dash())); connect(ui->dash_dot,SIGNAL(triggered(bool)),this,SLOT(set_dashdot())); connect(ui->dash_dot_dot,SIGNAL(triggered(bool)),this,SLOT(set_dashdotdot())); connect(ui->dot_line,SIGNAL(triggered(bool)),this,SLOT(set_dot())); connect(ui->fred,SIGNAL(triggered(bool)),this,SLOT(set_fill_red())); connect(ui->fblue,SIGNAL(triggered(bool)),this,SLOT(set_fill_blue())); connect(ui->fblack,SIGNAL(triggered(bool)),this,SLOT(set_fill_black())); connect(ui->fgreen,SIGNAL(triggered(bool)),this,SLOT(set_fill_green())); connect(ui->solid_pattern,SIGNAL(triggered(bool)),this,SLOT(set_solid_pattern())); connect(ui->dense_pattern,SIGNAL(triggered(bool)),this,SLOT(set_dense_pattern())); connect(ui->none,SIGNAL(triggered(bool)),this,SLOT(set_none_pattern())); }
|