Results 1 to 2 of 2

Thread: Windows Form in PyQt5 differs from the Preview in Qt Designer

  1. #1
    Join Date
    Sep 2020
    Posts
    3
    Qt products
    Qt5
    Platforms
    Windows

    Default Windows Form in PyQt5 differs from the Preview in Qt Designer

    Hello All:

    I'm using Qt Designer to create a Windows Form which I save as window.ui and then use it from PyQt5. Problem is the Preview in Qt Designer and the "real" window differs substantially... I would expect the final GUI be pretty close as the one Qt Designer shows in the Preview...
    In the following screenshot, the window at the left is the "real" one while the right shows the Preview from Qt Designer;

    Windows.jpg

    This is the code I'm using to import the "window.ui" file;

    class Window(QtWidgets.QMainWindow):
    def __init__(self):
    super(Window, self).__init__()
    uic.loadUi("window.ui", self)



    if __name__ == "__main__":
    app = QtWidgets.QApplication([])
    win = Window()
    win.show()
    sys.exit(app.exec())


    Any idea why this happens? Should I configure something else?

    Thanks in advance;
    Gus

  2. #2
    Join Date
    Sep 2020
    Posts
    3
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Windows Form in PyQt5 differs from the Preview in Qt Designer

    Actually, I think Qt Designer is not showing the right size...Its window form is scaled out. My laptop screen is 1920 x 1080 pixels. In Qt Designer, the Form width is 466 and it is taking more than half the screen width, so it seems the Qt Designer is not properly scaling the Form correctly....
    It looks like Qt Designer is running on a 800 x 600 screen, not at 1920 x 1080. Is there anything to setup here?

    Check this screenshot;

    error.jpg

    Thanks
    Gus


    Added after 27 minutes:


    I just solve it! Just in case someone runs over the same problem, disabling the high DPI scaling option in Tools -> Options -> Environment solved the problem.

    solution.PNG
    Last edited by gussabina; 1st September 2020 at 18:01.

Similar Threads

  1. Replies: 0
    Last Post: 10th September 2013, 12:05
  2. Designer&Preview and MaximumSize problem
    By dresha48 in forum Qt Tools
    Replies: 0
    Last Post: 21st January 2010, 12:23
  3. Replies: 9
    Last Post: 25th June 2009, 15:10
  4. designer 4.5 widget preview (plastique)
    By janus in forum Qt Tools
    Replies: 3
    Last Post: 21st April 2009, 12:30
  5. Qt Designer 4.0.1 Preview Colors
    By jtyler in forum Qt Tools
    Replies: 2
    Last Post: 14th February 2006, 16:47

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.