Qt绘制垂直文本drawText

        painter.drawText(800-ui->lineEdit_right->text().toInt(),
                         ui->lineEdit_top->text().toInt()+70, 12, 50,
                         Qt::AlignTop | Qt::TextSingleLine | Qt::TextWordWrap,
                         "白存根");

        painter.drawText(800-ui->lineEdit_right->text().toInt(),
                         ui->lineEdit_top->text().toInt()+125, 12, 50,
                         Qt::AlignTop | Qt::TextSingleLine | Qt::TextWordWrap,
                         "蓝仓库");

        painter.drawText(800-ui->lineEdit_right->text().toInt(),
                         ui->lineEdit_top->text().toInt()+180, 12, 50,
                         Qt::AlignTop | Qt::TextSingleLine | Qt::TextWordWrap,
                         "红财务");
        painter.drawText(800-ui->lineEdit_right->text().toInt(),
                         ui->lineEdit_top->text().toInt()+235, 12, 50,
                         Qt::AlignTop | Qt::TextSingleLine | Qt::TextWordWrap,
                         "黄客户");

还有一种是整行文字旋转90度。

    painter.rotate(90);
    painter.drawText(y-30, -x, "电流值");
 
    painter.rotate(180);
    painter.drawText(-y-6, 20, "电压值");
上一篇:实战 | UI 自动化测试框架设计与 PageObject 改造


下一篇:Selenium实战技巧-多页面和Windows控件处理