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. [SOLVED] QTableView + QStyledItemDelegate + BLOB Image - Having problems when I update an existing image to a new image.
Forum Updated to NodeBB v4.3 + New Features

[SOLVED] QTableView + QStyledItemDelegate + BLOB Image - Having problems when I update an existing image to a new image.

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 996 Views 1 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.
  • R Offline
    R Offline
    roahanramesh
    wrote on last edited by
    #1

    Hello
    I am currently using a TableView that has an QStyledItemDelegate to display the image that is stored as BLOB in a MySQL database. I am having a problem when I need to change an image in one cell. Please help. This is what i am currently doing.

    Now in some locations (cells - Column 3) I use a default image. I use a QTAbleview::clicked signal and in the corresponding cell index, i call a QFileDialog to get a filename. From the filename I get a QByteArray which i then use a QSqlQuery to update the database (I get no errors). Once i do that i call a function called refresh model which in essence reloads the entire model to the view. But somehow the image stays default (The last image does not update to the new one).
    Please help.

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

      Hi,

      Did you check that the data in your database did in fact get changed ?
      Are you sure the database has been reloaded ?

      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
      • R Offline
        R Offline
        roahanramesh
        wrote on last edited by
        #3

        Thanks SGaist. That was infact the problem. I read the ByteArray before and after writing and it was the same. Then I noticed I made a mistake while calling the addbindvalue. Corrected that and now it works like a charm

        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