Python Forum
[PyQt] display content from left to right in QComboBox or QLineEdit
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[PyQt] display content from left to right in QComboBox or QLineEdit
#1
Hi all,

I have several QComboBoxes and QLineEdits on my UI, which can show different content depending on user selections.
However, when the user changes settings, the content of the QComboBox or QLineEdit gets displayed starting at the back of the content.

For instance:
I have the number 28.599999999999994 in a QComboBox. The QComboBox is too short to show the complete number.
But, instead of displaying 28.599 it displays 999994. How can I change this such that it start at the front of the string, rather then at the back?

Is there a solution for this?

Thanks!
Reply
#2
You may be able to use the resize function to change the length of your widget based on the length of user input.
Reply
#3
you can give the Combobox a fixed size.

your_combobox.setFixedWidth(xxx)
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  [PyQt] QLineEdit Caret (Text Cursor) Transparency malonn 5 2,807 Nov-04-2022, 09:04 PM
Last Post: malonn
  [PyQt] How do I display the DB table I will choose from the QComboBox in QTableWidget JokerSob 2 2,303 Aug-05-2021, 03:00 PM
Last Post: JokerSob
  How to accept only float number in QLineEdit input ism 5 28,373 Jul-06-2021, 05:23 PM
Last Post: deanhystad
  Simple printing the text for a QLineEdit thewolf 16 7,857 Mar-06-2021, 11:37 PM
Last Post: deanhystad
  PyQt5: How to retrieve a QLineEdit by its name ? arbiel 4 7,878 Oct-21-2020, 02:35 PM
Last Post: arbiel
  Two QlineEdit box, which interrelated GMCobraz 1 2,413 Aug-14-2020, 07:15 PM
Last Post: deanhystad
  [PyQt] Dynamically add and remove QLineEdit's GMCobraz 3 7,156 Jun-23-2020, 07:01 PM
Last Post: Yoriz
  prompt for input in qlineedit GMCobraz 3 3,216 Jun-22-2020, 01:51 PM
Last Post: GMCobraz
  QComboBox doesn't display selection as long as it has not lost the focus Meaulnes 3 3,237 May-07-2020, 03:42 PM
Last Post: Meaulnes
  QComboBox for PyQt code gvin47 3 2,102 Apr-22-2020, 04:01 PM
Last Post: gvin47

Forum Jump:

User Panel Messages

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