Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-86773

[REG 5.13.2-5.15.1] Qt.ToolTipRole HTML bug

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P1: Critical
    • None
    • 5.15.1
    • Widgets: Itemviews
    • None
    • Windows
    • Windows

    Description

      This worked correctly in version 5.13.2, and does not work correctly in version 5.15:

      class BSqlQueryModel(QSqlQueryModel):
          ...
          def data(self, index, role = Qt.DisplayRole):
              if index.column() == self.image_column:
                  ...
                  elif (role == Qt.ToolTipRole):
                      html = ("
                          <table>
                             <tr>
                                <td><img src="T802326143217.jpg" height="500"></td>
                                <td><img src="T802326143217-b.jpg" height="500"></td>
                             </tr>
                          </table>
                      ")
                      return html
      

      Sorry for python code (I work in PyQt), but it's evident.

      In version 5.13.2 when tooltip is displayed, width is ok for both pictures. In other words, Qt itself computes and displays the right width (not necessarily the same) for both pictures, 500x400 for first image and 500x300 for second. In version 5.15 Qt displays (for example) 500x100 for first image and 500x100 for second image, so it incorrectly computes the width and both images are displayed cropped (useless for the user).

      The original dimensions of the images are 1000x800 and 1000x600.

      So, I am now stuck with version 5.13.2.

      Edit: the code is more complex, for example I previously define filename depending on index row and column 3 ("T802326143217") and use:

      ...
      img_ = '<img src="' + filename + '" height="' + multi_image_height + '">' 
      
      img_b = '<img src="' + filename_b + '" height="' + multi_image_height + '">'
      
      html = '<table><tr><td>' + img_ + '</td><td>' + img_b + '</td></tr></table>'
      
      return html
      

      ...and the same for other pictures: filename_b,...

       

      Attachments

        1. Correct image - version 5.13.2.png
          805 kB
          Petar Djetlic
        2. Incorrect image - version 5.15.1.png
          189 kB
          Petar Djetlic

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              smd Jan Arve
              petar Petar Djetlic
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes