V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
jxylon
V2EX  ›  Qt

关于 PyQt 与 Qt Designer

  •  
  •   jxylon · 2018-03-29 22:44:53 +08:00 · 5055 次点击
    这是一个创建于 2464 天前的主题,其中的信息可能已经有所发展或是发生改变。

    为什么我在 Qt Designer 中可以实现自适应窗口

    生成代码运行后还是不能自适应

        def setupUi(self, MainWindow):
            MainWindow.setObjectName(_fromUtf8("MainWindow"))
            MainWindow.resize(1042, 800)
            self.centralwidget = QtGui.QWidget(MainWindow)
            self.centralwidget.setObjectName(_fromUtf8("centralwidget"))
            self.verticalLayout_2 = QtGui.QVBoxLayout(self.centralwidget)
            self.verticalLayout_2.setObjectName(_fromUtf8("verticalLayout_2"))
            self.horizontalLayout = QtGui.QHBoxLayout()
            self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout"))
            self.verticalLayout = QtGui.QVBoxLayout()
            self.verticalLayout.setObjectName(_fromUtf8("verticalLayout"))
            self.pushButton = QtGui.QPushButton(self.centralwidget)
            self.pushButton.setObjectName(_fromUtf8("pushButton"))
            self.verticalLayout.addWidget(self.pushButton)
            self.pushButton_2 = QtGui.QPushButton(self.centralwidget)
            self.pushButton_2.setObjectName(_fromUtf8("pushButton_2"))
            self.verticalLayout.addWidget(self.pushButton_2)
            self.pushButton_3 = QtGui.QPushButton(self.centralwidget)
            self.pushButton_3.setObjectName(_fromUtf8("pushButton_3"))
            self.verticalLayout.addWidget(self.pushButton_3)
            self.horizontalLayout.addLayout(self.verticalLayout)
            self.listView = QtGui.QListView(self.centralwidget)
            self.listView.setObjectName(_fromUtf8("listView"))
            self.horizontalLayout.addWidget(self.listView)
            self.verticalLayout_2.addLayout(self.horizontalLayout)
            # MainWindow.setCentralWidget(self.centralwidget)
            self.menubar = QtGui.QMenuBar(MainWindow)
            self.menubar.setGeometry(QtCore.QRect(0, 0, 1042, 26))
            self.menubar.setObjectName(_fromUtf8("menubar"))
            # MainWindow.setMenuBar(self.menubar)
            self.statusbar = QtGui.QStatusBar(MainWindow)
            self.statusbar.setObjectName(_fromUtf8("statusbar"))
            # MainWindow.setStatusBar(self.statusbar)
    
            self.retranslateUi(MainWindow)
            QtCore.QMetaObject.connectSlotsByName(MainWindow)
    
        def retranslateUi(self, MainWindow):
            MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow", None))
            self.pushButton.setText(_translate("MainWindow", "PushButton", None))
            self.pushButton_2.setText(_translate("MainWindow", "PushButton", None))
            self.pushButton_3.setText(_translate("MainWindow", "PushButton", None))
    
    目前尚无回复
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   1057 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 22ms · UTC 19:52 · PVG 03:52 · LAX 11:52 · JFK 14:52
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.