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 can I display/edit QSqlRelationalTableModel using custom input widgets in a QScrollArea
Forum Updated to NodeBB v4.3 + New Features

How can I display/edit QSqlRelationalTableModel using custom input widgets in a QScrollArea

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

    I was hoping someone could lead me in the right direction. I have created a custom widget with several QLineEdits and QComboBoxes. I am using the widget to display/edit contact addresses in a database.

    I have been able to display/edit one address at a time using the custom widget, QSqlRelationalTableModel and QDataWidgetMapper and a "Next" & "Previous" Button. I would like to be able to show all the addresses in the custom widget but have them in a list type view so I can see them on the same screen.

    I have managed to get the widgets to display in a scroll area, but I am not sure what I need to do so the data is displayed in its own “row”. I know I can use QDataWidgetMapper->toNext() and do it “by hand”. But I would like to use the model/view architecture and have it done automatically.

    I saw the chart example and it uses a subclass of QAbstractItemView. It of course is completely different than my “homemade table” so I am not sure if thats where I should be looking for my answers.

    I have attached a photo of the empty widgets listed in the scroll area as a visual cue.

    So my questions:
    Is this possible?
    If so, what class should I be using?

    !https://dl.dropboxusercontent.com/u/107816931/CustomWidgetOnScrollArea.png(customwidgetonscrollarea)!

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

      Hi,

      You should consider using a QListView + a custom QStyledItemDelegate. Otherwise, you can also use setCurrentItem on your QDataWidgetMapper.

      Hope it helps

      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