gpt4 book ai didi

c++ - 如何在不使用两个标签的情况下对齐左侧的一些文本和右侧的一些文本

转载 作者:行者123 更新时间:2023-11-30 03:04:11 26 4
gpt4 key购买 nike

我想用QLabel以这种格式显示一些数据

username:.....Erich Lancaster (without dots)

Location:.......Wherever

有办法吗?

最佳答案

似乎使用了 QFormLayout会是最简单的。像这样的东西:

QFormLayout *formLayout = new QFormLayout;
QLabel *usernameLabel = new QLabel("Erich Lancaster");
usernameLabel->setAlignment(Qt::AlignRight);
formLayout->addRow("username:", usernameLabel);

QLabel *locationLabel = new QLabel("Wherever");
locationLabel->setAlignment(Qt::AlignRight);
formLayout->addRow("Location:", locationLabel);
setLayout(formLayout);

关于c++ - 如何在不使用两个标签的情况下对齐左侧的一些文本和右侧的一些文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8883442/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com