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, "电压值");