void MainWindow::paintEvent(QPaintEvent * /*event*/ ) { QPainter painter(this); painter.setRenderHint(QPainter::Antialiasing, true); QRect BackgroundRect(0, 0, 800,600); painter.setBrush(QBrush(Qt::black, Qt::SolidPattern)); painter.drawRect( BackgroundRect ); }
painter.setRenderHint(QPainter::Antialiasing, true);
void MainWindow::paintEvent(QPaintEvent * event ) { QPainter painter(this); painter.setRenderHint(QPainter::Antialiasing, true); QRect BackgroundRect = event->rect(); painter.setBrush(QBrush(Qt::black, Qt::SolidPattern)); painter.drawRect( BackgroundRect ); }
void MainWindow::paintEvent(QPaintEvent * event ) { QPainter painter(this); QRect BackgroundRect = event->rect(); painter.setBrush(QBrush(Qt::black, Qt::SolidPattern)); painter.drawRect( BackgroundRect ); painter.setRenderHint(QPainter::Antialiasing, true); ... // а тут желательно рисовать в пределах BackgroundRect}
painter.setClipRegion(event->region());
painter.setBrush(QBrush(Qt::red, Qt::SolidPattern)); painter.drawRoundRect( MainRect, 3, 3);
void QGLFormat::setDoubleBuffer ( bool enable )