Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for Python
  4. Help to set size of widget
Forum Updated to NodeBB v4.3 + New Features

Help to set size of widget

Scheduled Pinned Locked Moved Unsolved Qt for Python
2 Posts 2 Posters 231 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Black CatB Offline
    Black CatB Offline
    Black Cat
    wrote on last edited by
    #1

    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): 
            super().__init__(parent) 
            self.setMinimumSize(500, 500)
            password = PasswordEdit()
            password.setGeometry(QRect(100,100,1,100))
            self.setCentralWidget(password)
    
    
    if __name__ == '__main__':
        qt = QApplication(sys.argv)
        app = Test() 
        app.show() 
        qt.exec_() 
    
    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi
      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 :)

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved