简体   繁体   English

qt中标题的Groupbox对齐不起作用。 为什么?

[英]Groupbox alignment of title in qt doesn`t work. Why?

I created a simple MainWindow form in Qt 4.8.4 designer, in preview title is placed in top left corner as it should be, but when i use this form in a simple program which writen in Eclipse with QT plugin, the title placed straight at top top center which is not right. 我在Qt 4.8.4设计器中创建了一个简单的MainWindow表单,预览标题应按原样放置在左上角,但是当我在用QT插件在Eclipse中编写的简单程序中使用此表单时,标题直接放在顶部顶部中心不正确。 When i use ui.groupBox->setAlignment(Qt::AlignRight); 当我使用ui.groupBox-> setAlignment(Qt :: AlignRight); or left before show(), nothing happen the title stays at the center. 或在show()之前离开,则标题保持居中状态。 What may cause this? 是什么原因造成的? Program is minimalistic and there only group box and nothing else. 程序是简约的,只有组框,没有别的。

您是否尝试过像这样设置样式表:

ui->groupBox->setStyleSheet("QGroupBox::title {subcontrol-position: right;}");

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM