[Qt-interest] How to generate specific column depends on SqlQuery ? [Mysql]
Aaron Lewis
aaron.lewis1989 at gmail.com
Sat Mar 13 07:44:17 CET 2010
Thanks Scott
Cause i need to use Raw Sql Queries , and setQuery() is a protected
function , so i turned to QSqlQueryModel ..
But i'm meeting some new problems.
Sample Code is:
-snip-
QSqlQueryModel model;
model.setQuery(Query); // Query is a QSqlQuery
ui->sqlTable->setModel(model); // sqlTable is a QTableView
-snip-
I can't use setModel , it told me:
/tools/Opt/qt4-opensrc/include/QtGui/qtableview.h:71: note: candidates
are: virtual void QTableView::setModel(QAbstractItemModel*)
Will appreciate your helps ;-)
Scott Aron Bloom wrote:
> Use QSqlTableModel
>
> On Mar 12, 2010, at 5:57 PM, Aaron Lewis wrote:
>
>> Hi,
>> I was wondering how to dynamically create a QTableView.
>>
>> e.g QSqlQuery.exec(select employee_name,employee_id from employees
>> where location_id = 110);
>>
>> I'd like to create a table , add new column depends on what you
>> selects , in this example ,
>> it should be employee_name , employee_id , but how do i know what
>> users type in ?
>>
>> I'm writing a Mysql Front End , want to generate a nice Table from
>> user's queries ...
>> e.g i have a QLineEdit to receive queries , and a PushButton to
>> triggered sql commands.
>>
>> Any ideas will appreciate. ;-)
>>
>> --
>> Best Regards,
>> Aaron Lewis - PGP: 0x4A6D32A0
>> FingerPrint EA63 26B2 6C52 72EA A4A5 EB6B BDFE 35B0 4A6D 32A0
>> irc: A4r0n on freenode
>>
>> _______________________________________________
>> Qt-interest mailing list
>> Qt-interest at trolltech.com
>> http://lists.trolltech.com/mailman/listinfo/qt-interest
>
--
Best Regards,
Aaron Lewis - PGP: 0x4A6D32A0
FingerPrint EA63 26B2 6C52 72EA A4A5 EB6B BDFE 35B0 4A6D 32A0
irc: A4r0n on freenode
More information about the Qt-interest-old
mailing list