Blog Post · Qt and its Awesomeness!
Qt and its Awesomeness! ^
Posted On Thursday 29 July 2010 by Tom Leese (TomMan)
I would just like to say a few things about Qt and its awesomeness :p
Ok, so everything in Qt is based around the concept of events. This means that everything from the Window Manager wanting the window to be redrawn, to a mouse button being clicked, to the window being resized is done in events.
Here is some example code of drawing a circle in the middle of the window (200x200) when the window manager wants it.
void MainWindow::paintEvent(QPaintEvent *event)
{
QPainter painter(this);
painter.setRenderHint(QPainter::Antialiasing, true);
QPen pen(Qt::blue, 2);
painter.setPen(pen);
QBrush brush(Qt::green);
painter.setBrush(brush);
painter.drawEllipse(20, 20, 160, 160);
}