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 increase the size of QICon send to ::data method of QtreevIew

how to increase the size of QICon send to ::data method of QtreevIew

Scheduled Pinned Locked Moved General and Desktop
4 Posts 3 Posters 1.2k Views 3 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.
  • Q Offline
    Q Offline
    Qt Enthusiast
    wrote on last edited by
    #1

    HI have a QtreeView and I have to send merge two images in a single QIcon and send the same ::data for Decoration role but , is it possible to increase the size of the ::icon send in ::data for Decoration role

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

      Hi,

      Since this question is likely related to this thread: why not return your QPixmap directly rather than create an icon from 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
      0
      • Q Offline
        Q Offline
        Qt Enthusiast
        wrote on last edited by
        #3

        In this case I have to reduce the size of QPixmap . The actula size of image is 24 X 24 and I want to be 16 x 16 . I tried

        QPixmap image1(16,16);
        image1= MyUtils::getPixMap();
        image1.scaledToWidth(16);
        image1.scaledToHeight(16);

        but it is not working

        mrjjM 1 Reply Last reply
        0
        • Q Qt Enthusiast

          In this case I have to reduce the size of QPixmap . The actula size of image is 24 X 24 and I want to be 16 x 16 . I tried

          QPixmap image1(16,16);
          image1= MyUtils::getPixMap();
          image1.scaledToWidth(16);
          image1.scaledToHeight(16);

          but it is not working

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

          @Qt-Enthusiast

          HI, the error is that scaledToHeight returns the modified image.
          And you dont assign it back to other image.

          QImage small = image1->scaled(16, 16,Qt::KeepAspectRatio);

          1 Reply Last reply
          1

          • Login

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