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. QListWidget Item Disappear setViewMode(IconMode) while resizing
Forum Updated to NodeBB v4.3 + New Features

QListWidget Item Disappear setViewMode(IconMode) while resizing

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 2 Posters 568 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.
  • EmrecpE Offline
    EmrecpE Offline
    Emrecp
    wrote on last edited by
    #1

    Hello,
    I have QListWidget and using custom widget, setting setViewMode to QListView.IconMode and while resizing, QListWidget item disappear. This is video: Video
    Thanks!

    1 Reply Last reply
    0
    • EmrecpE Offline
      EmrecpE Offline
      Emrecp
      wrote on last edited by
      #4

      I solved issue! with updating PyQt5 5.14.1 to 5.15.1.

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

        Hi,

        Which version of Qt ?
        On which OS ?
        Can you provide a minimal compilable example that show the behaviour ?

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

        EmrecpE 1 Reply Last reply
        0
        • SGaistS SGaist

          Hi,

          Which version of Qt ?
          On which OS ?
          Can you provide a minimal compilable example that show the behaviour ?

          EmrecpE Offline
          EmrecpE Offline
          Emrecp
          wrote on last edited by
          #3

          @SGaist
          PyQt5 Version 5.14.1
          Windows 10 1909

          Here and thanks for help;

          import sys, os
          from PyQt5 import QtCore, QtWidgets, QtGui
          from PyQt5.Qt import *
          from PyQt5.QtWidgets import QMessageBox, QMainWindow, QWidget, QSizePolicy, QHBoxLayout, QLabel, QPushButton, QTextEdit, \
              QGridLayout, QSpacerItem, QGraphicsOpacityEffect, QMenu, QAction, QApplication, QLineEdit, QTextBrowser, QFileDialog, QDialog, QSizeGrip, QAbstractItemView, QProgressBar, QTableWidgetItem, \
              QCheckBox, QVBoxLayout, QListWidget, QListWidgetItem, QListView
          
          
          class Form(QDialog):
              def __init__(self, parent=None):
                  super(Form, self).__init__()
                  self.parent = parent
          
              def setupUi(self):
                  try:
                      self.WID=QWidget()
                      self.resize(QSize(800,600))
                      self.qv_all = QVBoxLayout(self)
                      self.liste = QListWidget()
                      self.liste.setStyleSheet(
                          "QListWidget{background-color:transparent}QListWidget:item{border:2px solid gray;border-radius:10px}QPushButton{border-bottom-left-radius: 7px;border-bottom-right-radius: 7px;background-color:transparent}" )
                      self.liste.setSelectionMode(QAbstractItemView.SingleSelection)
          
                      self.liste.setMovement(QListView.Static)
                      self.liste.setViewMode(QListView.IconMode)
                      
                      self.liste.setSpacing(5)
                      self.liste.setResizeMode(self.liste.Adjust)
          
                      self.liste.setContextMenuPolicy(Qt.CustomContextMenu)
          
                      self.liste.setSpacing(15)
                      self.qv_all.addWidget(self.liste)
                      for i in range(3):
                          wid = QListWidgetItem()
                          wid.setText("")
                          #wid.setData(Qt.UserRole + 1, veri)
                          wid.setFont(QFont('Arial', 12))
                          wid.setSizeHint(QSize(256, 256))
                          self.liste.addItem(wid)
                          # wid.setData(Qt.DecorationRole,pix.scaled(128 + 32, 96, Qt.IgnoreAspectRatio,Qt.SmoothTransformation))
          
          
                          btnBaslat = QPushButton("btn_1")
                          btnBaslat.setFixedHeight(25)
                          btnBaslat.setStyleSheet("background-color:rgb(255,68,10);color:black;border-radius:10px")
          
                          widCustom = QPushButton()
                          QVToplam = QVBoxLayout(widCustom)
                          lblName = QLabel("<font color='black'>%s</font>" % ("caption"), self)
                          QVToplam.addWidget(lblName)
          
                          lblImage = QLabel()
                          lblImage.setAlignment(Qt.AlignCenter)
                          #pix = QPixmap('url:("C:/Users/User/Desktop/wallpaper/891884.jpg")')
                          pix = self.style().standardIcon(getattr(QStyle, "SP_MediaPlay")).pixmap(QSize(128,128))
                          lblImage.setPixmap(QPixmap(pix).scaled(128 + 32, 32 + 128, Qt.IgnoreAspectRatio, Qt.SmoothTransformation))
                          QVToplam.addWidget(lblImage)
          
                          lbl_bilgi_Sure = QLabel("<font color='red'>Oynanma Suresi:</font>")
                          lbl_bilgi_Sure.setAlignment(Qt.AlignCenter)
          
          
          
                          QVToplam.addWidget(lbl_bilgi_Sure)
                          QVToplam.addWidget(btnBaslat)
          
                          self.liste.setItemWidget(wid, widCustom)
          
                      
                  except Exception as err:
                      print("SetupUi: %s"% str(err))
          
          
          if __name__ == "__main__":
              app = QApplication(sys.argv)
              frm= Form()
              frm.setupUi()
              frm.show()
              
              sys.exit(app.exec())
          
          1 Reply Last reply
          0
          • EmrecpE Offline
            EmrecpE Offline
            Emrecp
            wrote on last edited by
            #4

            I solved issue! with updating PyQt5 5.14.1 to 5.15.1.

            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