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 handle Pictures
Forum Updated to NodeBB v4.3 + New Features

How to handle Pictures

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 816 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.
  • U Offline
    U Offline
    Ulrich.Goebel
    wrote on last edited by
    #1

    Hello,

    for my first python program I try to build a user interface for a litle address database. Therefor I use pyqt to build the formular, and later I will connect it to an existing SQLite DB, using APSW.

    Besides the "normal" things as name, address, email and others I want to store an image. Normaly that will be given as a file (.jpg, .png, or other type). I would let the user find the picture with a QFileDialog.getOpenFileName() dialog. But what to do after that? Here are my questions (may be not all of them are at the right place here):

    Which widget is able to show the picture?

    How to show the picture? That means: howto put the picture from the file into the widget?

    How to put the picture data into an blob(?) column in the database?

    How to get the data back from there and bring it in the widget?

    May be there is a tutorial which I didn't find yet?

    Thank's a lot for any help!

    Greetings
    Ulrich

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

      Hi and welcome to devnet,

      1. QLabel
      2. You have all the information needed in QLabel's documentation
        3-4 Have a look at the QtSql module, you have also the examples there that will help you get started. If you really want to save that in a blob just load the file content, maybe encode it in base64 to avoid char conversion problem and store it. Most of this can be found in the examples. For your blob column, you need to look at the Model/View documentation and related classes/examples.

      Hope it helps

      Happy coding !

      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

      • Login

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