Hi
I would like to force a set signals (from combo boxes and spinboxes) to call slots in my application even though the indices have not changed. Is this possible?
Best regards
Hi
I would like to force a set signals (from combo boxes and spinboxes) to call slots in my application even though the indices have not changed. Is this possible?
Best regards
Yes. Just create your own signals and emit them whenever you want.
Can I do this with QComboBox and QSpinBox?
e.g
emit iterSpinBox->valueChanged(DEFAULT_ITERS);
gives me a compile error "is protected withinn this context"
Last edited by dbrmik; 13th March 2009 at 15:01. Reason: updated contents
Hi,
SLOTs are functions, so call it directly.
Òscar Llarch i Galán
Yes, just like ^NyAw^ says, a slot is just a function so you actually don't need signals. Here is an example:
Qt Code:
int combo_index = myComboBox->currentIndex(); mySlot(combo_index);To copy to clipboard, switch view to plain text mode
Thanks Jim,
I thought there might be a way of setting values in my comboxboxes which would force an automatic call to my slots. This happens if the index values change from their defaults but not if they remain the same
Last edited by dbrmik; 13th March 2009 at 15:17. Reason: updated contents
You ought to post your code, but as long as your connections are made before you do whatever you are doing in SetDefaults() then the signals should be properly emitted.
Thanks Jim, ^NyAw^
Yes, the connections are made before setDefaults() is called. I suppose what I was looking for is a way to propogate the settings of my spinboxes to MyClass even if their values have not changed ( I am now called the slots directly)
Thanks for your time
Bookmarks