Python Forum
QComboBox for PyQt code
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
QComboBox for PyQt code
I have Stopwatch program with Current Time, Split Time and Lap Time display.
I have replaced QLable with QComboBox for Lap Time to see all the Laps in order.
But it shows in order from the First to the Last Lap record. But I need the reverse order: From the Last to the First. Is it possible to reverse addItem method ?
Actually I found the resolution (see my new code).
But I still would like to see the last Lap time to be seen in the ComboBox window,
which now remains without any change.
Only when I click on ComboBox window I can see the whole list of Lap times in the order I needed (last time - fist and fist time -last).

I think a list view would be a better choice for displaying a list of times. But if you want to use a ComboBox you will call "setCurrentIndex(0) after inserting your most recent lap time.
That's just magic ! How could I miss that option with "setCurrentIndex(0)" ?
Now it works exactly like I need. List View does not work for me because I do not have space for that and I have to look for the whole list of Lap Times occasionally. Thank you again for your such a helpful and prompt advice.

Possibly Related Threads…
Thread Author Replies Views Last Post
  [PyQt] display content from left to right in QComboBox or QLineEdit mart79 2 759 May-30-2020, 04:38 PM
Last Post: Axel_Erfurt
  QComboBox doesn't display selection as long as it has not lost the focus Meaulnes 3 707 May-07-2020, 03:42 PM
Last Post: Meaulnes
  [PyQt] PyQt4 dynamic QComboBox littleGreenDude 4 2,756 Jan-02-2019, 07:22 PM
Last Post: littleGreenDude
  [PyQt] Get Data from QComboBox Ferris 0 2,087 Feb-28-2018, 04:59 AM
Last Post: Ferris
  [PyQt] How can I get special data from QComboBox()? Sophus 0 3,399 Jul-26-2017, 04:56 PM
Last Post: Sophus

Forum Jump:

User Panel Messages

Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020