Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct


    Qt World Summit: Early-Bird Tickets

    Cache problem when preview picture use QAbstractItemDelegate in QListWidget.

    General and Desktop
    2
    8
    1172
    Loading More Posts
    • 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
      opengpu2 last edited by

      i write a delegate to preview the picture in the QListWidget, but there are lots of pictures, and there should be a cache method to Only load and show the Items in the current viewRect.
      how can i get the items in the current viewport?
      and now i use QPixmap, is there any way to cache it? i know when construct it use: QPixmap ppp(strFilePath), it will be loaded and the file is read...so is there any way to use it in order to work with the Cache mechanism?

      thank you

      1 Reply Last reply Reply Quote 0
      • SGaist
        SGaist Lifetime Qt Champion last edited by

        Hi,

        QPixmapCache and visualItemRect comes to mind for that

        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 Reply Quote 0
        • O
          opengpu2 last edited by

          thank you, is it right to use QPixmap to open the image file in order to preview the images?
          i found when there are lots of image files, it's very slow to load.
          is there any good way to accelerate this?
          or may i load there QListWidgetItems one by one, which will make the user feel a little better...

          1 Reply Last reply Reply Quote 0
          • SGaist
            SGaist Lifetime Qt Champion last edited by

            You can create downscaled thumbnails of the images and load them rather than the original

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

            O 1 Reply Last reply Reply Quote 0
            • O
              opengpu2 last edited by

              u mean i manually downscale the original image to another image file whose resolution is smaller.

              1 Reply Last reply Reply Quote 0
              • SGaist
                SGaist Lifetime Qt Champion last edited by

                Yes, that's it

                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 Reply Quote 0
                • O
                  opengpu2 @SGaist last edited by

                  @SGaist You can create downscaled thumbnails of the images and load them rather than the original

                  is there any way to use Qt to downscale various kind formats of pictures?

                  1 Reply Last reply Reply Quote 0
                  • SGaist
                    SGaist Lifetime Qt Champion last edited by

                    @opengpu2 See @Chris-Kawa answer to your other thread

                    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 Reply Quote 0
                    • First post
                      Last post