![]() |
强健的鸡蛋面 · 横滨车站SF - 抖音百科· 8 月前 · |
![]() |
健壮的围巾 · 【面经】2022年软件测试面试题大全(持续更 ...· 1 年前 · |
![]() |
聪明伶俐的小刀 · 妈妈在切蛋糕的拼音怎么写· 1 年前 · |
关于Qt状态栏居中对齐,可以使用以下方法:
QHBoxLayout* layout = new QHBoxLayout();
layout->addWidget(label);
layout->addStretch();
statusBar()->setLayout(layout);
QWidget* widget = new QWidget();
QHBoxLayout* layout = new QHBoxLayout(widget);
layout->addWidget(label);
layout->addStretch();
statusBar()->addWidget(widget);
QSpacerItem* spacer = new QSpacerItem(100, 0, QSizePolicy::Expanding, QSizePolicy::Minimum);
QHBoxLayout* layout = new QHBoxLayout();
layout->addWidget(label);
layout->addItem(spacer);
statusBar()->setLayout(layout);
这些方法都可以实现Qt状态栏中的标签居中对齐。