myMain::myMain(QWidget *parent) : QMainWindow(parent), ui(new Ui::myMain){ ui->setupUi(this); QString str; QFile myFile("readme.txt"); if(!myFile.open(QIODevice::ReadOnly)) return; QTextStream stream(&myFile); while (!stream.atEnd()) { str = stream.readLine().toLocal8Bit(); }}myMain::~myMain(){ delete ui;}void myMain::paintEvent(QPaintEvent *event){ QPainter painter(this); QRect r = QRect(0, 0, 200, 200); painter.setFont(QFont("Times", 14, QFont::Normal)); painter.drawRect(r); painter.drawText(r, Qt::AlignCenter | Qt::TextWordWrap, str);}