Qt World Summit: Submit your Presentation

Help to set size of widget

  • I'm trying to set a size to the widget (PasswordEdit) with setGeometry, but not works. I'm want to the PasswordEdit stay on the center... Someone can help about this?

    from PySide2.QtCore import (QCoreApplication, QDate, QDateTime, QMetaObject,
        QObject, QPoint, QRect, QSize, QTime, QUrl, Qt)
    from PySide2.QtGui import (QBrush, QColor, QConicalGradient, QCursor, QFont,
        QFontDatabase, QIcon, QKeySequence, QLinearGradient, QPalette, QPainter,
        QPixmap, QRadialGradient)
    from PySide2.QtWidgets import *
    import sys
    from qtwidgets import PasswordEdit
    class Test(QMainWindow):
        def __init__(self, parent=None): 
            self.setMinimumSize(500, 500)
            password = PasswordEdit()
    if __name__ == '__main__':
        qt = QApplication(sys.argv)
        app = Test() 

  • Lifetime Qt Champion

    You can use move(x,y) (and resize) instead of setGeometry
    I assume that the password is not affect by any layouts as then moving it is futile :)

Log in to reply