QT 如何使QLabel的文字垂直显示
#include "mainwindow.h"
#include "ui_mainwindow.h"
MainWindow::MainWindow(QWidget *parent)
: QWidget(parent)
, ui(new Ui::MainWindow)
{
ui->setupUi(this);
//
auto setLabelText = [](QLabel *label, const QString &text){
label->setWordWrap(true);
label->setAlignment(Qt::AlignTop);
label->setText(text.split("", QString::SkipEmptyParts).join("\n"));
};
setLabelText(ui->label_1, tr("Welcome to China"));
setLabelText(ui->label_2, tr("Hello world"));
setLabelText(ui->label_3, tr("Good good study"));
}
MainWindow::~MainWindow()
{
delete ui;
}