Ah, I found the solution on page 417 in the QT book. It will work using something like this:
{
HWND hWnd = winId();
HDC hdc = painter.paintEngine()->getDC();
RECT r;
r.left = this->rect().left()+50;
r.top = this->rect().top()+50;
r.right = this->rect().right();
r.bottom = this->rect().bottom();
int xx = ::DrawText(hdc, L"FOOOOOOOOOO", 5, &r, DT_VCENTER | DT_CENTER | DT_SINGLELINE);
painter.paintEngine()->releaseDC(hdc);
}
void MyWidget::paintEvent(QPaintEvent *p)
{
QPainter painter(this);
HWND hWnd = winId();
HDC hdc = painter.paintEngine()->getDC();
RECT r;
r.left = this->rect().left()+50;
r.top = this->rect().top()+50;
r.right = this->rect().right();
r.bottom = this->rect().bottom();
int xx = ::DrawText(hdc, L"FOOOOOOOOOO", 5, &r, DT_VCENTER | DT_CENTER | DT_SINGLELINE);
painter.paintEngine()->releaseDC(hdc);
}
To copy to clipboard, switch view to plain text mode
Bookmarks