Using HTML with QLabel
#include <QApplication> #include <QMainWindow> #include <QLabel> int main(int argc, char *argv[]) { QApplication a(argc, argv); QMainWindow mainWindow; QLabel *label =new QLabel("<center>Central Widget</center>"); mainWindow.setCentralWidget(label); mainWindow.show(); return a.exec(); }