Results 1 to 20 of 25

Thread: apply change to filtered rows is it possible?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Oct 2009
    Posts
    483
    Thanked 97 Times in 94 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: apply change to filtered rows is it possible?

    Quote Originally Posted by jaafari View Post
    and how to use QAbstractItemModel::setData() ?
    Easy:
    1. you stop being lazy;
    2. you go read the documentation as you were already advised to;
    3. you try to solve your problem;
    4. you come back and explain the approaches you tried, and ask specific questions.

    Does that sound reasonable to you, or would you rather have other people do for free the work you are paid for?

  2. #2
    Join Date
    Mar 2014
    Posts
    25
    Thanks
    12
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: apply change to filtered rows is it possible?

    Quote Originally Posted by yeye_olive View Post
    Does that sound reasonable to you, or would you rather have other people do for free the work you are paid for?
    i am not a programmer bro.. i am just here to learn and in fact there is no documentation in my language thank you

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

    Default Re: apply change to filtered rows is it possible?

    Quote Originally Posted by jaafari View Post
    i am not a programmer bro.. i am just here to learn and in fact there is no documentation in my language thank you
    There is documentation in English. This forum is English. If you can't understand English documentation, how are you going to understand my English explanation?
    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.


  4. The following user says thank you to wysota for this useful post:

    jaafari (3rd April 2015)

  5. #4
    Join Date
    Mar 2014
    Posts
    25
    Thanks
    12
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: apply change to filtered rows is it possible?

    Quote Originally Posted by wysota View Post
    There is documentation in English. This forum is English. If you can't understand English documentation, how are you going to understand my English explanation?
    it is very difficult for me and in some conversation i try translator (thanks to google).. i hope one day other people can find Qt in other languages

  6. #5
    Join Date
    Mar 2014
    Posts
    25
    Thanks
    12
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: apply change to filtered rows is it possible?

    any help guys or should i pay to someone to tell how?

  7. #6
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: apply change to filtered rows is it possible?

    Quote Originally Posted by jaafari View Post
    any help guys or should i pay to someone to tell how?
    What's wrong with the solution already given in comment #11?

    Cheers,
    _

  8. The following user says thank you to anda_skoa for this useful post:

    jaafari (5th April 2015)

  9. #7
    Join Date
    Mar 2014
    Posts
    25
    Thanks
    12
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: apply change to filtered rows is it possible?

    my dear i just want an example even if i will pay for it no problem


    Added after 5 minutes:


    Quote Originally Posted by yeye_olive View Post
    Easy:
    Does that sound reasonable to you, or would you rather have other people do for free the work you are paid for?
    give me a example pravite and i am ready to pay for it.. just tell me how much that will cust?
    Last edited by jaafari; 5th April 2015 at 20:32.

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

    Default Re: apply change to filtered rows is it possible?

    I can give you an example for free.

    Qt Code:
    1. model.setData(model.index(0, 0), 7, Qt::EditRole); // sets 7 into default role of item (0, 0)
    To copy to clipboard, switch view to plain text mode 
    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.


  11. The following user says thank you to wysota for this useful post:

    jaafari (9th July 2015)

  12. #9
    Join Date
    Mar 2014
    Posts
    25
    Thanks
    12
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: apply change to filtered rows is it possible?

    and what about combobox:
    Qt Code:
    1. void myEditDialog::on_myFirstComboBox_currentIndexChanged(int index)
    2. {
    3.  
    4. }
    To copy to clipboard, switch view to plain text mode 

    should i do it like this?

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

    Default Re: apply change to filtered rows is it possible?

    What about it?
    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.


  14. #11
    Join Date
    Mar 2014
    Posts
    25
    Thanks
    12
    Qt products
    Qt4
    Platforms
    Unix/X11

    Question Re: apply change to filtered rows is it possible?

    i mean should i use it in this way?

    Qt Code:
    1. void myEditDialog::on_myFirstComboBox_currentIndexChanged(int index)
    2. {
    3. model.setData(model.index(0, 0), 7, Qt::EditRole); // sets 7 into default role of item (0, 0)
    4. }
    To copy to clipboard, switch view to plain text mode 

  15. #12
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,328
    Thanks
    317
    Thanked 871 Times in 858 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: apply change to filtered rows is it possible?

    So every time someone selects a different item from the combo box, you want to store the value 7 into item( 0, 0 )? Why?

    Why don't you try to explain what you really want to do when someone changes the combo box selection?

  16. The following user says thank you to d_stranz for this useful post:

    jaafari (11th July 2015)

  17. #13
    Join Date
    Mar 2014
    Posts
    25
    Thanks
    12
    Qt products
    Qt4
    Platforms
    Unix/X11

    Arrow Re: apply change to filtered rows is it possible?

    in my diagram below i have a form with a lineedit a tableview a combobox..
    in my database table i have 4 columns and many rows and this columns are: ID , Name , Filter Code , Other Data... and i am just working in tow columns.. Name and Filter Code columns..
    and as i am showing in my diagram in column (Filter Code) there are alot of rows but they divided into groups and every group has a different number which is that (filter code ) the lineedit displays the filtered number.. for example if it is 22 the filter code column in tableview displays only the group with that number..

    now the combobox displays column (Name) contains which is name1 , name2 , name3 , name4... i assume that the column (Name) in tableview displays name2 and the 22 group belongs to that name.. the combobox should display the same name which is name2 and if we change the contain in combobox the change should be applied to all the rows that belongs to the group that already filtered by the number 22 which displayd in lineedit..

    this is already happened because i am using QDataWidgetMapper but the change apply only to the last row not to all rows which i want..

    in my form i am using: QLineEdit QComboBox QTableView , QSqlRelationalTableModel , QSortFilterProxyModel , QDataWidgetMapper..

    wolcome
    Attached Images Attached Images

  18. #14
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,328
    Thanks
    317
    Thanked 871 Times in 858 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: apply change to filtered rows is it possible?

    I am sorry but I don't understand what you are trying to do.

    Do you want to change the database? (That is, if the user types a new name into the combobox do you want "newName" to replace "name2" in the database)?

    Do you want to select something new from the database (read only) when the user changes the combobox selection or enters a new code in the line edit?

  19. The following user says thank you to d_stranz for this useful post:

    jaafari (21st July 2015)

  20. #15
    Join Date
    Mar 2014
    Posts
    25
    Thanks
    12
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: apply change to filtered rows is it possible?

    hi!

    for the lineedit i used it only to filter database.. so the table displays only filtered rows... the combo box i want to use it with filtered rows so if i change data in that combo box the data should be changed also in the filtered rows so if the names were name2 in the table and changed combobox to name3 the change should be aplied to all that filtered rows only (the filtered rows with linedit) after that i will call SubmitAll function with save button to update database... thats all thank you.


    Added after 9 minutes:


    Quote Originally Posted by d_stranz View Post

    Do you want to select something new from the database (read only) when the user changes the combobox selection
    yes i already have names in the database and it is a relationship database the combo box will update values because it is a forignkey.. and use qsqlrelationaltablemodel with itemdelegate.. thank you!
    Last edited by jaafari; 21st July 2015 at 23:18.

Similar Threads

  1. Replies: 1
    Last Post: 27th September 2012, 22:07
  2. Filter a Filtered QSortFilterProxyModel !?
    By solook in forum Qt Programming
    Replies: 4
    Last Post: 25th October 2011, 19:22
  3. WM_INPUT not being filtered by winEventFilter()
    By been_1990 in forum Qt Programming
    Replies: 1
    Last Post: 12th October 2010, 03:19
  4. QTableView How to change height for all rows?
    By sergey_85 in forum Qt Programming
    Replies: 2
    Last Post: 1st December 2009, 19:49
  5. Replies: 4
    Last Post: 20th September 2007, 13:11

Tags for this Thread

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
  •  
Qt is a trademark of The Qt Company.