Форум вопросов и ответов

Форум вопросов и ответов (https://www.otvetnemail.ru/)
-   Новый архив 3 (https://www.otvetnemail.ru/novyj-arhiv-3-813/)
-   -   Почему не меняется толщина круга? (https://www.otvetnemail.ru/novyj-arhiv-3-813/pochemu-ne-menyaetsya-tolshina-kruga-332815/)

Guest 30.09.2011 10:01

Почему не меняется толщина круга?
 
Почему не меняется толщина круга при нажатии на кнопку?paint.hКод:#ifndef PAINT_H#define PAINT_H#include class QPushButton;class PaintBoard : public QDialog{Q_OBJECTpublic:PaintBoard(QWidge t *parent = 0);void paintEvent(QPaintEvent *event);signals:private slots: void cpaint();private:QPushButton *rbutton;};#endifpaint.cppКод:#include #include "paint.h"PaintBoard::PaintBoard(QWid get *parent) : QDialog(parent){ rbutton = new QPushButton(tr("gav")); QHBoxLayout *bottom = new QHBoxLayout; bottom->addWidget(rbutton); setLayout(bottom);connect(rbutton, SIGNAL(clicked()), this, SLOT(cpaint())); }void PaintBoard::paintEvent(QPaintEvent *event){ QPainter painter(this); painter.drawEllipse(10, 10, 20, 20);}void PaintBoard::cpaint(){QPainter painter(this);painter.setPen(QPen(Qt::bl ack, 9, Qt::SolidLine, Qt::RoundCap));// painter.drawEllipse(10, 10, 90, 90);update();}main.cppКод:#include #include #include "paint.h"int main(int argc, char **argv) {QApplication app(argc, argv); PaintBoard *form = new PaintBoard; form->show(); return app.exec();}


Часовой пояс GMT, время: 21:58.


© www.otvetnemail.ru - Форум вопросов и ответов.