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. How to change the direction of images in QListWidgetItem.

How to change the direction of images in QListWidgetItem.

Scheduled Pinned Locked Moved Solved General and Desktop
8 Posts 3 Posters 739 Views 2 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.
  • O Offline
    O Offline
    Osama_Billah
    wrote on last edited by
    #1

    Hi everyone, I'm stuck in my code. I want to change the direction of images form "Top to Bottom" to "Left to Right" and the text below the images

    self.blistWidget.setLayoutDirection(QtCore.Qt.LeftToRight)
    
    self.tabWidget.currentChanged.connect(self.add_images_to_TabLayout)
    
    
        def add_images_to_TabLayout(self):
    
            #QtWidgets.QListWidgetItem.setLayoutDirection(QtCore.Qt.LeftToRight)
            
            item1 = QtWidgets.QListWidgetItem(QIcon("C:/Users/OB/Desktop/DevoMech Project/4.JPG"), "item1")
            self.dlistWidget.addItem(item1)
            item2 = QtWidgets.QListWidgetItem(QIcon("C:/Users/OB/Desktop/DevoMech Project/5.JPG"), "item2")
            self.dlistWidget.addItem(item2)
    

    output of my code

    Capture.PNG

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by mrjj
      #2

      Hi
      Did you try icon mode ?
      alt text

      it will make ListWidget display like
      alt text

      1 Reply Last reply
      2
      • O Offline
        O Offline
        Osama_Billah
        wrote on last edited by
        #3

        thanks bro

        mrjjM 1 Reply Last reply
        0
        • O Osama_Billah

          thanks bro

          mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @Osama_Billah
          np.
          Do note the
          listWidget->setGridSize(QSize(64, 64));

          that sets the grid/sizes.

          1 Reply Last reply
          2
          • O Offline
            O Offline
            Osama_Billah
            wrote on last edited by
            #5

            okay. Thank you

            mrjjM 1 Reply Last reply
            0
            • O Osama_Billah

              okay. Thank you

              mrjjM Offline
              mrjjM Offline
              mrjj
              Lifetime Qt Champion
              wrote on last edited by
              #6

              @Osama_Billah
              oh last note.
              the property movement is default sat to "free" so user can drag the images around. I often set to fixed as its not really useful.

              O 1 Reply Last reply
              2
              • mrjjM mrjj

                @Osama_Billah
                oh last note.
                the property movement is default sat to "free" so user can drag the images around. I often set to fixed as its not really useful.

                O Offline
                O Offline
                Osama_Billah
                wrote on last edited by
                #7

                @mrjj One more Question how to increase the gap between the images

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

                  Hi,

                  You can do that with the gridSize property.

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

                  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