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. use view model with only some edit lines
Qt 6.11 is out! See what's new in the release blog

use view model with only some edit lines

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

    Hello,
    it's my first project with QT and I have got some lineEdits on my window and I want to update them using (file or read from USB device )
    So I want to make the model that can handle reading data from any source based on the clicked button and update the Line edits, and I want my design to follow the View model

    I found that QDataWidgetMapper.mapper() should take index -which does not exist in my case I don't use any tableview or trees ,
    What is the best practice to handle this case?
    also How can i validate user inputs to line Edit in the model view architecture ?

    7 1 Reply Last reply
    0
    • 7 7asna2

      Hello,
      it's my first project with QT and I have got some lineEdits on my window and I want to update them using (file or read from USB device )
      So I want to make the model that can handle reading data from any source based on the clicked button and update the Line edits, and I want my design to follow the View model

      I found that QDataWidgetMapper.mapper() should take index -which does not exist in my case I don't use any tableview or trees ,
      What is the best practice to handle this case?
      also How can i validate user inputs to line Edit in the model view architecture ?

      7 Offline
      7 Offline
      7asna2
      wrote on last edited by
      #2

      @7asna2 any one can help

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

        Hi
        Please see
        https://doc.qt.io/qt-5/qtwidgets-itemviews-simplewidgetmapper-example.html

        You can use a std item model and fill from your file/usb
        model = new QStandardItemModel(5, 3, this);

        or you can create a custom model that directly can also read itself from the "sources"
        https://doc.qt.io/qt-5/qabstractitemmodel.html

        1 Reply Last reply
        1

        • Login

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