PyQt5样式表不同结果

2024-10-01 19:27:24 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在使用PyQt5及其编辑器制作pythongui。试着给我用样式表玩的东西加些颜色。但我在QMainQindow(图像的左侧和QDialog(右侧[期望的外观])中使用它时遇到了不同的结果。就像它对其他小部件都产生了同样的效果。在

[![在此处输入图像说明][1]][1]

QMainWindow中的代码

<property name="windowTitle">
   <string>MainWindow</string>
  </property>
  <widget class="QWidget" name="centralwidget">
   <property name="styleSheet">
    <string notr="true">QWidget{
        background-color:qlineargradient(spread:repeat, x1:0, y1:1, x2:1, y2:0, stop:0 rgba(39, 21, 103, 255), stop:1 rgba(94, 94, 140, 255))
        }

        QPushButton{
        background-color: qlineargradient(spread:pad, x1:0.915, y1:0.227273, x2:1, y2:0, stop:0 rgba(255, 255, 255, 255), stop:1 rgba(56, 56, 140, 255));
        font: 75 8.5pt &quot;Sitka Small&quot;;
        }

        QToolButton{background-color: qlineargradient(spread:pad, x1:0.915, y1:0.227273, x2:1, y2:0, stop:0 rgba(255, 255, 255, 255), stop:1 rgba(56, 56, 140, 255));
        font: 75 8.5pt &quot;Sitka Small&quot;;
        }

        QLabel{
        color: rgb(255, 255, 255);
        }

        font: 75 8.5pt &quot;Sitka Small&quot;
      </string>
   </property>

来自QDialog的代码

^{pr2}$

我怎样才能看到QMainWindow右边的QDialog?在


Tags: namestringpropertycolorbackgroundstopx1x2

热门问题