View Full Version : A variable in setTable()
thefatladysingsopera
1st August 2011, 17:16
Hello,is it possible to have a variable in
tableModel->setTable("myvariable"); if the table selected change oftenly?.
mcosta
1st August 2011, 17:47
IMO the answer is YES.
thefatladysingsopera
1st August 2011, 17:55
How is it done?.
mcosta
2nd August 2011, 07:29
You can write a slot/function like this
void MyClass::tableSelected (const QString & tableName)
{
if (tableName != tableModel->tableName()) {
tableModel->setTable (tableName);
tableModel->select(); // to populate the model
}
}
thefatladysingsopera
2nd August 2011, 08:11
This seems to work
QString japan = "tables";
tablesModel->setTable(japan);
mcosta
2nd August 2011, 08:23
if you don't call select() the model will not be populated
thefatladysingsopera
2nd August 2011, 08:37
The models are working okay and everything is working as it should. The set table part was the only problem.
Thanks.
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.