Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 2

Qt-interest Archive, October 2007
Searching in QSqlRelationalTableModel


Message 1 in thread

Is there a way to search in a QSqlRelationalTableModel, or a  
QSqlTableModel for that matter? I have a situation where I need to  
get a QSqlRecord from a table (or the row would work, as I could get  
the record from that), but all I have to work with is the unique  
value of the id column for that record. I'd like to avoid having to  
do another query to  the database to get data I already have cached  
locally in the existing QSqlRelationalTableModel. Thanks.

-----------------------------------------------
Israel Brewster
Computer Support Technician
Frontier Flying Service Inc.
5245 Airport Industrial Rd
Fairbanks, AK 99709
(907) 450-7250 x293
-----------------------------------------------


--
 [ signature omitted ] 

Message 2 in thread

You can search in model with mach command:

http://doc.trolltech.com/4.3/qabstractitemmodel.html#match

QModelIndex "start" tell just the column where search the value. Return 
QModelIndex list what can use with data command to get the interested 
value in record(s):

http://doc.trolltech.com/4.3/qsqlquerymodel.html#data
> Is there a way to search in a QSqlRelationalTableModel, or a 
> QSqlTableModel for that matter? I have a situation where I need to get 
> a QSqlRecord from a table (or the row would work, as I could get the 
> record from that), but all I have to work with is the unique value of 
> the id column for that record. I'd like to avoid having to do another 
> query to  the database to get data I already have cached locally in 
> the existing QSqlRelationalTableModel. Thanks.
>
> -----------------------------------------------
> Israel Brewster
> Computer Support Technician
> Frontier Flying Service Inc.
> 5245 Airport Industrial Rd
> Fairbanks, AK 99709
> (907) 450-7250 x293
> -----------------------------------------------
>
>
> -- 
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with 
> "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/
>
>
>

--
 [ signature omitted ] 

Message 3 in thread

Thanks, that did the trick. A little farther back along the  
inheritance tree than I thought to look :P

-----------------------------------------------
Israel Brewster
Computer Support Technician
Frontier Flying Service Inc.
5245 Airport Industrial Rd
Fairbanks, AK 99709
(907) 450-7250 x293
-----------------------------------------------


On Oct 9, 2007, at 9:59 PM, Dudás József wrote:

> You can search in model with mach command:
>
> http://doc.trolltech.com/4.3/qabstractitemmodel.html#match
>
> QModelIndex "start" tell just the column where search the value.  
> Return QModelIndex list what can use with data command to get the  
> interested value in record(s):
>
> http://doc.trolltech.com/4.3/qsqlquerymodel.html#data
>> Is there a way to search in a QSqlRelationalTableModel, or a  
>> QSqlTableModel for that matter? I have a situation where I need to  
>> get a QSqlRecord from a table (or the row would work, as I could  
>> get the record from that), but all I have to work with is the  
>> unique value of the id column for that record. I'd like to avoid  
>> having to do another query to  the database to get data I already  
>> have cached locally in the existing QSqlRelationalTableModel. Thanks.
>>
>> -----------------------------------------------
>> Israel Brewster
>> Computer Support Technician
>> Frontier Flying Service Inc.
>> 5245 Airport Industrial Rd
>> Fairbanks, AK 99709
>> (907) 450-7250 x293
>> -----------------------------------------------
>>
>>
>> -- 
>> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx  
>> with "unsubscribe" in the subject or the body.
>> List archive and information: http://lists.trolltech.com/qt-interest/
>>
>>
>>
>
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx  
> with "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/

--
 [ signature omitted ]