Unsolved Get previous index of QComboBox
-
Hi,
I have a subClass MyComboBox and when current Index is changed (by user or programmatically) i want get the previous index.
Any idea ?
Thanks
MC -
@M-Cocktail said in Get previous index of QComboBox:
Any idea ?
Since you already subclassed it - just remember the previous one.
-
yes, but how can i do ?
I try to override signals and slots but it doesn't work -
@M-Cocktail said in Get previous index of QComboBox:
but how can i do ?
You get a signal when the index changes - why not save this index then?
-
Hi
Im not sure i understand it correctly as its very simple so i fear you are asking something else.In .h in the class.
int OldIndex=-1;
Then in its ctor
connect(this, QOverload<int>::of(&QComboBox::currentIndexChanged),
[this](int index){
OldIndex = Index;
});