Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. What is the difference between these two layout assignee methods
Forum Updated to NodeBB v4.3 + New Features

What is the difference between these two layout assignee methods

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 155 Views
  • 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.
  • P Offline
    P Offline
    Pythonic person
    wrote on last edited by Pythonic person
    #1

    I've seen that we can assignee a layout to the widget with these two methods, and I don't know what is the difference

    METHOD 1:

    box = QtWidget.QWidget()
    layout = QtWidget.QGridLayout()
    
    box.setLayout(layout)
    

    METHOD 2:

    box = QtWidget.QWidget()
    layout = QtWidget.QGridLayout(box )
    

    are they the same?

    Christian EhrlicherC 1 Reply Last reply
    0
    • P Pythonic person

      I've seen that we can assignee a layout to the widget with these two methods, and I don't know what is the difference

      METHOD 1:

      box = QtWidget.QWidget()
      layout = QtWidget.QGridLayout()
      
      box.setLayout(layout)
      

      METHOD 2:

      box = QtWidget.QWidget()
      layout = QtWidget.QGridLayout(box )
      

      are they the same?

      Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @Pythonic-person said in What is the difference between these two layout assignee methods:

      are they the same?

      Yes, according to the documentation.

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      1 Reply Last reply
      2

      • Login

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