asp科技公司网站源码,做网站怎么设置背景,php做的网站如何运行,小规模网站开发税率想要实现QLabel文字的垂直显示#xff0c;可以通过使用“文字分割填充换行符”的方式来实现QLabel文字垂直显示的效果#xff0c;下面是效果图#xff1a;
具体实现代码#xff1a;
#include mainwindow.h
#include ui_mainwindow.hMainWindow:…想要实现QLabel文字的垂直显示可以通过使用“文字分割填充换行符”的方式来实现QLabel文字垂直显示的效果下面是效果图
具体实现代码
#include mainwindow.h
#include ui_mainwindow.hMainWindow::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;
}