QDockWidget::title (Need to change the font & size)

五迷三道 提交于 2019-12-10 14:05:52

问题


I have following style sheet set for QDockWidgets in my QT app. All the things mentioned in the style are working except for the font. Why is "font" is not detected & how could I change the font & size of QDockWidget title ?

QDockWidget::title
{
    font: 18pt "Roboto Lt";
    background: lightgray;
    padding-left: 10px; 
    padding-top: 4px;
}

回答1:


Font should be applied to the QDockWidget itself, not to the sub-control ::title

QDockWidget { font-family: "Roboto Lt"; font-size: 18pt; }



回答2:


Watch the font part in the Qt Reference: http://doc.qt.digia.com/qt/stylesheet-reference.html

Maybe you should try:

QDockWidget::title
{
   font-family: "Roboto Lt";
   font-size: 18pt;
   background: lightgray;
   padding-left: 10px; 
   padding-top: 4px;
}


来源:https://stackoverflow.com/questions/13012410/qdockwidgettitle-need-to-change-the-font-size

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!