Unsolved A stange problem in QGroupBox
-
// mainwindow.cpp QWidget* widget = new QWidget; QComboBox* box = new QComboBox; box->addItem("a"); box->addItem("b"); box->addItem("c"); QVBoxLayout* layout = new QVBoxLayout; layout->addWidget(box); widget->setLayout(layout); setCentralWidget(widget);
// main.cpp qApp->setStyleSheet("QWidget{font-family: 'Microsoft YaHei UI'; font-size: 15px;}" "QComboBox{font-size: 13px;}");
You just create a new widget project, and add the upper codes, you will get the following result,
The items in groupbox overlaped with each other.
Why is that? Could someone tell me the WHY and HOW? Thanks in advance.
(PS: windows10 + qt 5.10.1 + qt-creator 4.5.1 + msvc2015 x86)
-
@Limer Is it same without setStyleSheet?
-
@jsulm No, if I removed the qss codes, it will get normal.
-
@Limer I'm not an stylesheet expert, but to me it looks like you're overwriting the stylesheet for QComboBox instead of only changing the font.
-
@jsulm If I removed the qroupbox's qss codes but reserved the qwidget's qss , the result is still like that.
-
@Limer What I mean is: if you set the stylesheet you overwrite what was set before and probably there are some other stylesheet properties which define the look of the widgets which are then lost.