我想使用QLabel
来显示此格式的一些数据
用户名:..... Erich Lancaster(无点)
位置:.......只要
有办法做到这一点吗?
答案 0 :(得分:3)
似乎使用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);