简体   繁体   English

Qt QGroupBox边框

[英]Qt QGroupBox border

Im working on a little program that require a QGroupBox that have inside a QLineEdit . 我正在编写一个需要QGroupBox位于QLineEdit内部的小程序。 I want to make "invisible" the border of the QGroupBox using: 我想使用以下方法使QGroupBox的边框“不可见”:

groupBoxName->setStyleSheet("border:0;");

The problem is that even the QLineEdit inside of it inherit this style. 问题在于,即使其中的QLineEdit也继承了此样式。 How can I make invisible the QGroupBox border but not the QLineEdit border? 如何使QGroupBox边框而不是QLineEdit边框不可见? Thanks 谢谢

Give an object name for the groupbox using setObjectName() function, 使用setObjectName()函数为组框指定对象名称,

group_box->setObjectName("MyBox");

Then you could style it as a css object. 然后,您可以将其样式设置为CSS对象。

group_box->setStyleSheet("#MyBox{border:0

This will only affect the #MyBox 这只会影响#MyBox

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

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