Solved How to access QSqlRelationalModel from function?
-
Can I do something like this?
ui.type_search_cbo->cancelEventoncurrentIndexChanged; ui.type_search_cbo->setModel(model); ui.type_search_cbo->resetEventoncurrentIndexChanged;
(nice code, eh?)
-
well i would prefer if you could just wait to connect the slots
so its ok it says index changed.There is
http://doc.qt.io/qt-5/qobject.html#blockSignalsbut again, you are fixing a symptom so it not the best.
-
Yes, it works with block signals.
So, this is not the correct remedy?How could I wait to connect the slots?
I don't want just to fix the symptom, I want to do it properly. -
@Panoss
well where do you hook up the oncurrentIndexChanged signal? -
It's a slot for a combo:
void RepairDevices::on_type_search_cbo_currentIndexChanged(int index) { refresh_devices_search_tbl(); }
-
@Panoss said in How to access QSqlRelationalModel from function?:
Ah you are using the auto connect feature?
you do not have connect( xxxx) , correct ? -
No, I don't even know what autoconnect is.
I have no connect( xxxx) for this function.
(unless you 're meaning that this way, it 's autoconnected) -
well it means it will hook it up if names matches.
QMetaObject::connectSlotsByName(MainWindow);
( in setupUI)just use blockSignals then. :)
-
Thank you very much mrjj, you helped me A LOT!
-
@Panoss
Np.
Thats why i lurk around here :)