Results 1 to 5 of 5

Thread: select and edit like Microsoft Access with cute sql?

  1. #1
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    99
    Thanks
    1
    Thanked 3 Times in 3 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default select and edit like Microsoft Access with cute sql?

    Hello guys and girls,
    I’ve been playing around with onmanualsubmit, onfieldchange and onrowchange when trying to add an empty row on the bottom of a QTableview with a model getting data from a sqlite database.
    I think I should use onfieldchange to accomplish this.But I’m stuck.
    This is what I want (see image)

    When a tableview is not active, I always want an empty row at the bottom. Ok that’s easy : just use insertrow and you have it.
    When you go to another cell in the same row or another row, the new row should get submitted to the database and a new empty row is presented at the bottom.
    1) Is onfieldchange the good choice?
    2) Which eventfilter should I use to tell the tableview it should submit the data and create a new empty row at the bottom. Or is there a better way to accomplish this? I looked into signals, but didn’t come up with a good solution.
    All ideas and suggestions are welcome.

    Everallemptyrow.jpg

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,363
    Thanks
    3
    Thanked 5,012 Times in 4,791 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: select and edit like Microsoft Access with cute sql?

    Quote Originally Posted by Everall View Post
    1) Is onfieldchange the good choice?
    Seems so.

    2) Which eventfilter should I use to tell the tableview it should submit the data and create a new empty row at the bottom.
    You can submit the data when quitting the application.

    Or is there a better way to accomplish this? I looked into signals, but didn’t come up with a good solution.
    Consider implementing a proxy model that will handle the "*" row in the way that it inserts a new row into the base model only when it is complete (i.e. all required columns are populated with data).
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    99
    Thanks
    1
    Thanked 3 Times in 3 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: select and edit like Microsoft Access with cute sql?

    Thx wysota,

    Your idea to wait submitting the data to the databases seems rather severe at first, but after some more tought, I'm going to test it out. Probably I will end up submitting after a row has data in every cell, because I observed that qt needs all the cells filled in as you mentioned.

    I know proxymodel has filtering sorting/approach. But your point of view is totally new to me. so I will get to study it.
    Any good docs, tutorials, examples you know of besides the trolls docs?

    Everall

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,363
    Thanks
    3
    Thanked 5,012 Times in 4,791 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: select and edit like Microsoft Access with cute sql?

    Quote Originally Posted by Everall View Post
    Probably I will end up submitting after a row has data in every cell, because I observed that qt needs all the cells filled in as you mentioned.
    Qt only needs the primary key to be present. It does make sense to submit the row only when all of the obligatory data of a row is provided though.

    I know proxymodel has filtering sorting/approach. But your point of view is totally new to me. so I will get to study it.
    If you know design patterns then consider a proxy model a decorator of the QAbstractItemModel class. If you don't know design patterns then consider the proxy model as a way to slightly modify the behaviour of the original class without changing its API.

    Any good docs, tutorials, examples you know of besides the trolls docs?
    It really depends on what you are after. Getting to know the decorator pattern is a good start.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. #5
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    99
    Thanks
    1
    Thanked 3 Times in 3 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: select and edit like Microsoft Access with cute sql?

    thx for the directions,

    Everall

Similar Threads

  1. Connect to Microsoft Access 2010 *.accdb file
    By FuNkDaDdY in forum Newbie
    Replies: 11
    Last Post: 26th April 2018, 08:43
  2. Trouble Connecting to Microsoft Access *.accdb files
    By FuNkDaDdY in forum Qt Programming
    Replies: 1
    Last Post: 10th November 2010, 10:18
  3. Replies: 10
    Last Post: 30th September 2010, 06:16
  4. how to access LINE EDIT'S value
    By BalaQT in forum Qt Programming
    Replies: 8
    Last Post: 20th August 2009, 10:58
  5. how to connect to a microsoft access database?
    By mismael85 in forum Qt Programming
    Replies: 3
    Last Post: 7th March 2008, 09:25

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.