1

我在 Microsoft Windows Vista 的 Qt Designer(4.8.2) 中设计了一个 mainwindow.ui,在预览并满意结果后,我使用 pyside-uic 并得到了生成的 mainwindow.py。但是当我运行我的应用程序时,显示与我在Qt Designer 预览中看到的不同,并且与pyside-uic --preview的预览不同:

我用来预览的内容:

pyside-uic mainwindow.py -p

我的应用程序的初始化

from PySide.QtGui import QApplication, QMainWindow
from mainwindow import Ui_MainWindow
import sys

class bookcalendar(Ui_MainWindow, QMainWindow):

    def __init__(self):

        super(bookcalendar, self).__init__()
        self.setupUi(self)

app = QApplication(sys.argv)
form = bookcalendar()
form.show()
app.exec_()

我看到运行 pyside-uic -p 脚本,

我看到正在运行的 .py 文件,

stackedWidget(parent)

--bookStack      <-     my style sheet css

--calendarStack      <-     my style sheet css

缺少灰色边框的 css:

#bookStack{
    "border: 3px solid gray;
    "background-color: white;}

嗯,有什么建议吗?

4

1 回答 1

0

我找到了答案,解决方法是在父级中添加样式表css,例如:

stackedWidget(parent)      <-     style sheet css

--bookStack

--calendarStack

做css样式表的正确方法:

#stackedWidget{
    "border: 3px solid gray;
    "background-color: white;}
于 2013-02-05T07:38:06.867 回答