PDA

View Full Version : Search by Product Name in QTableView which load from SQL Database



joeboy69
28th April 2018, 14:38
Hello Seniors ;)

I need some help from you all. I'm having difficulties and I've no idea on how to do/code "12812" in QT Creator C++.

I would really need help from you guys if there's any tutorials or steps to do it. Your kind help would be much appreciated, thank you in adv :) #qtcreator #cplusplus

P/S: I'm still a new beginner in/for QT Creator :(

d_stranz
28th April 2018, 16:51
Search by Product Name in QTableView which load from SQL Database

What exactly do you want to do? Do you want to search the database for all entries that match the product name, or do you want to see if a certain product name was retrieved from the database and is displayed in the table?

What you you want to do after you find a match? Do you want to leave the table as it is and just highlight the matching entries? Do you want to clear the table and only display the matching entries?

What have you tried already?

If you don't want to change the database search results, but just want to highlight matching entries, then you should look at making a custom QIdentityProxyModel. If you want to filter out results that don't match, then you should look at a custom QSortFilterProxyModel. In either case, you should study the examples and tutorials from the Qt distribution to see how these classes are used.