Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for Python
  4. QWidgetDataMapper and data types for SQLite3 database

QWidgetDataMapper and data types for SQLite3 database

Scheduled Pinned Locked Moved Unsolved Qt for Python
3 Posts 3 Posters 292 Views
  • 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.
  • J Offline
    J Offline
    judethedude
    wrote on last edited by judethedude
    #1

    Hey everyone,

    I'm using QDataWidgetMapper to map some various widgets to my TableModel. I have QLineEdit's, some radio buttons, and some time spinboxes.
    I tried finding in the documentation, but couldn't...what data type should I provision in my SQLite3 database for these types of items? Obviously TEXT for QLineEdit, but should I just use BLOBs for everything else?

    Or better yet, how would I find out the datatype for each widget.

    Bonus question, is there an easy way to map the QDataWidgetMapper with a radio button group? Instead of a separate column for each radio in the database.

    Thanks for your time, Jude.

    JonBJ 1 Reply Last reply
    0
    • J judethedude

      Hey everyone,

      I'm using QDataWidgetMapper to map some various widgets to my TableModel. I have QLineEdit's, some radio buttons, and some time spinboxes.
      I tried finding in the documentation, but couldn't...what data type should I provision in my SQLite3 database for these types of items? Obviously TEXT for QLineEdit, but should I just use BLOBs for everything else?

      Or better yet, how would I find out the datatype for each widget.

      Bonus question, is there an easy way to map the QDataWidgetMapper with a radio button group? Instead of a separate column for each radio in the database.

      Thanks for your time, Jude.

      JonBJ Online
      JonBJ Online
      JonB
      wrote on last edited by JonB
      #2

      @judethedude
      You don't provision the database for what types of widgets QDataWidgetMapper displays, it is the other way round. It picks a text edit for a string, a number edit for a number, and so on, depending on your data types. So I don't know what your question is asking, or what you would want to store a BLOB in the database for.

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

        Hi,

        From the look of your widgets:

        • Text
        • Boolean
        • Number

        To find which type for which widget, look at the user property of the widget. Otherwise you can configure which property the mapper shall use with the widget assigned.

        QDataWidgetMapper maps one column with one widget so a button group would not make sense.

        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
        2

        • Login

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