Learn what Felgo offers to help your business succeed. Start your free evaluation today! Felgo for Your Business

Forums

OverviewFelgo 2 Support (Qt 5) › How to make a multi-column view with clickable rows and column headers

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #21429

    Flesh

    I have a ListModel I update from LocalStorage, it has a variable amount of columns and rows at run-time, I tried to use TableView, it is a Quick.Controls 1.x, and the 2.0 control is not out yet, and I could not figure out how to make the columns clickable with TableView, and I found examples of how to sort the columns, most use C++ to do this, and I did not want to do that, unless I can find no other way, I just want to be able to update a ListModel as a source to some control that can also list all the columns, and make the cells clickable, I do not need to edit them, but at least click on, so I can run an event, but I need the Header Columns to be clickable, so I can change the Model, which I clear it, and read it in from LocalStorage using Sqlite query, so all the data comes from Sql, but uses ListModel.append to populate the model, so it is doing a sort, without have to actually sort the list view, so I hope that someone has an example of doing something like this, TableView works now, I just cannot figure out how to capture header column clicks with it, if there is a way to use the delegate with an AppButton, that would be nice.

    I posted this as a Qml question, but help yet, this example uses two ListModel’s and a TableView and two push buttons to switch between the Model:

    https://stackoverflow.com/questions/55553586/problem-finding-click-event-in-qml-tableview-header-when-column-is-clicked

    and here at Qt, I have a lot of unanswered questions at that forum, so I posted it at StackOverflow also.

    https://forum.qt.io/topic/101507/how-to-change-models-using-tableview-column-click-event

    Thanks for any help.

    #21430

    Flesh

    Romha Korev on stackoverflow.com gave me this answer:

    onSortIndicatorColumnChanged: tableView.model = (sortIndicatorColumn == 0) ? myListModel1 : myListModel2
    onSortIndicatorOrderChanged: tableView.model = (sortIndicatorColumn == 0) ? myListModel1 : myListModel2
    
Viewing 2 posts - 1 through 2 (of 2 total)

RSS feed for this thread

You must be logged in to reply to this topic.

Qt_Technology_Partner_RGB_475 Qt_Service_Partner_RGB_475_padded