UI file previewed in Qt designer The tag size and tag position in the page are different from those displayed in the UI file loaded in Python, and the page tags in Qt Designer can be fully previewed, but not completely displayed in Python, what is the reason, how to solve these situations, sincerely solve
The preview page in Qt Designer looks like this enter image description here enter image description here
But the page loaded in pycharm looks like this enter image description here enter image description here
Why this discrepancy?
The code in pycharm is as follows:
import sys
from PyQt5.uic import loadUi
from PyQt5 import QtWidgets
from PyQt5.QtWidgets import QDialog, QApplication, QWidget, QStackedWidget, QVBoxLayout
class WelcomeScreen(QDialog):
def __init__(self):
super(WelcomeScreen, self).__init__()
loadUi("welcome.ui", self)
self.login1.clicked.connect(self.gotologin)
def gotologin(self):
login = LoginScreen()
widget.addWidget(login)
widget.setCurrentIndex(widget.currentIndex() + 1)
class LoginScreen(QDialog):
def __init__(self):
super(LoginScreen, self).__init__()
loadUi("login.ui", self)
self.password.setEchoMode(QtWidgets.QLineEdit.Password)
app = QApplication(sys.argv)
welcome = WelcomeScreen()
widget = QStackedWidget()
widget.addWidget(welcome)
widget.setFixedHeight(504)
widget.setFixedWidth(718)
widget.show()
try:
sys.exit(app.exec_())
except:
print("exiting")