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. help !! addRow doesn't show
Qt 6.11 is out! See what's new in the release blog

help !! addRow doesn't show

Scheduled Pinned Locked Moved Unsolved General and Desktop
7 Posts 4 Posters 971 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.
  • KamalepK Offline
    KamalepK Offline
    Kamalep
    wrote on last edited by
    #1

    I have problem with PyQt5, I implement software from Udemy course. The instructor write the addRow property but it doesn't show in Pycharm IDE as shown in photos. also when I write addRow manually to the app. The app is crash.! addRow photo

    JonBJ 1 Reply Last reply
    0
    • KamalepK Kamalep

      I have problem with PyQt5, I implement software from Udemy course. The instructor write the addRow property but it doesn't show in Pycharm IDE as shown in photos. also when I write addRow manually to the app. The app is crash.! addRow photo

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by JonB
      #2

      @Kamalep
      What type is self.bottom_layout? It looks like it is not of a type which has any addRow() method.... I don't think any of the classes derived from QLayout have such a method.

      And please paste the text of relevant excerpts of code rather than screenshots.

      1 Reply Last reply
      0
      • KamalepK Offline
        KamalepK Offline
        Kamalep
        wrote on last edited by
        #3

        @JonB

        the self.bottom_layout = QVBoxLayout()

        here is the code

            def layouts(self):
                # Creating main layout
                self.main_layout = QVBoxLayout()
                self.top_layout = QVBoxLayout()
                self.bottom_layout = QVBoxLayout()
        
                # Creating child layout to main layout
                self.main_layout.addLayout(self.top_layout)
                self.main_layout.addLayout(self.bottom_layout)
                # Adding Widget top layout
                # Top layout
                self.top_layout.addStretch()
                self.top_layout.addWidget(self.title)
                self.top_layout.addWidget(self.img_add)
                self.top_layout.addStretch()
                self.top_layout.setContentsMargins(120, 20, 10, 30)  # left, top , right, bottom
                # Bottom layout
                self.bottom_layout.add
                self.bottom_layout.addRow(self.lblname, self.name_entry)
                self.bottom_layout.addRow(self.lblsurname, self.surname_entry)
                self.bottom_layout.addRow(self.lblphone, self.phone_entry)
                self.bottom_layout.addRow(self.lblemail, self.email_entry)
                self.bottom_layout.addRow(self.lblimg, self.btnimg)
                self.bottom_layout.addRow(self.lbladdress, self.address_editor)
                self.bottom_layout.addRow(self.lblemail, self.email_entry)
                self.bottom_layout.addRow("", self.btnadd)
                #sitting main layout for window
                self.setLayout(self.main_layout)
        

        if you want see all my project, i uploaded to github , the code is in Section-4 file name is main.py.
        https://github.com/Kamalep/Udmey_PyQt5

        jsulmJ 1 Reply Last reply
        0
        • KamalepK Kamalep

          @JonB

          the self.bottom_layout = QVBoxLayout()

          here is the code

              def layouts(self):
                  # Creating main layout
                  self.main_layout = QVBoxLayout()
                  self.top_layout = QVBoxLayout()
                  self.bottom_layout = QVBoxLayout()
          
                  # Creating child layout to main layout
                  self.main_layout.addLayout(self.top_layout)
                  self.main_layout.addLayout(self.bottom_layout)
                  # Adding Widget top layout
                  # Top layout
                  self.top_layout.addStretch()
                  self.top_layout.addWidget(self.title)
                  self.top_layout.addWidget(self.img_add)
                  self.top_layout.addStretch()
                  self.top_layout.setContentsMargins(120, 20, 10, 30)  # left, top , right, bottom
                  # Bottom layout
                  self.bottom_layout.add
                  self.bottom_layout.addRow(self.lblname, self.name_entry)
                  self.bottom_layout.addRow(self.lblsurname, self.surname_entry)
                  self.bottom_layout.addRow(self.lblphone, self.phone_entry)
                  self.bottom_layout.addRow(self.lblemail, self.email_entry)
                  self.bottom_layout.addRow(self.lblimg, self.btnimg)
                  self.bottom_layout.addRow(self.lbladdress, self.address_editor)
                  self.bottom_layout.addRow(self.lblemail, self.email_entry)
                  self.bottom_layout.addRow("", self.btnadd)
                  #sitting main layout for window
                  self.setLayout(self.main_layout)
          

          if you want see all my project, i uploaded to github , the code is in Section-4 file name is main.py.
          https://github.com/Kamalep/Udmey_PyQt5

          jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote on last edited by jsulm
          #4

          @Kamalep said in help !! addRow doesn't show:

          QVBoxLayout

          has no addRow() method!
          You need to put all these "self.lblname, self.name_entry" into horizontal layouts and add these horizontal layouts to bottom_layout (https://doc.qt.io/qt-5/qboxlayout.html#addLayout).

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          KamalepK 1 Reply Last reply
          1
          • jsulmJ jsulm

            @Kamalep said in help !! addRow doesn't show:

            QVBoxLayout

            has no addRow() method!
            You need to put all these "self.lblname, self.name_entry" into horizontal layouts and add these horizontal layouts to bottom_layout (https://doc.qt.io/qt-5/qboxlayout.html#addLayout).

            KamalepK Offline
            KamalepK Offline
            Kamalep
            wrote on last edited by
            #5

            perfect , I will try, what you suggest !! but this exercise for course in Udemy ( Python GUI Programming Using PyQt5 by Volkan Atış) , The tutor who write this code :)

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              Hi,

              I would say that the layout used is a QFormLayout.

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              KamalepK 1 Reply Last reply
              1
              • SGaistS SGaist

                Hi,

                I would say that the layout used is a QFormLayout.

                KamalepK Offline
                KamalepK Offline
                Kamalep
                wrote on last edited by
                #7

                @SGaist Yes sir, that was the mistake, I used QVBoxLayout(), but the correct is a QFormLayout. Thank you so much.

                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