更换QComboBox下拉图标

        QString str;
        QString str1 = "QComboBox{background-color:rgb(150,150,150);border-radius: 3px; color:white;}";
        QString str2 = "QComboBox::down-arrow{ image:url(:/image/image/TopRightCorner.png); width:20px;}";
        QString str3 = "QComboBox::drop-down{ border:none; background:transparent; padding: 0px 0px 0px 0px;}";

        str = "%1%2%3";
        str = str.arg(str1, str2, str3);
        combox->setstylesheet(str);

  

 

让我迷惑的是。该样式表放到qss中,就会变成如下所示:

 图标变成一个按钮,最后没有办法只能将该样式放到代码中。

posted @ 2022-06-01 15:56  补码  阅读(635)  评论(0编辑  收藏  举报