Page 2 of 2 FirstFirst 12
Results 21 to 25 of 25

Thread: apply change to filtered rows is it possible?

  1. #21
    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 

  2. #22
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    4,124
    Thanks
    235
    Thanked 659 Times in 649 Posts
    Qt products
    Qt5
    Platforms
    Windows Android

    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?

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

    jaafari (11th July 2015)

  4. #23
    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

  5. #24
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    4,124
    Thanks
    235
    Thanked 659 Times in 649 Posts
    Qt products
    Qt5
    Platforms
    Windows Android

    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?

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

    jaafari (21st July 2015)

  7. #25
    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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.