Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
qtws26_logo

The Qt Event of the Year: Qt World Summit 2026

Save Your Spot >
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QComboBox - How to get RichText in QLineEdit
Qt 6.12 LTS is out! See what's new in the release blog

QComboBox - How to get RichText in QLineEdit

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 2.4k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • tomwebT Offline
    tomwebT Offline
    tomweb
    wrote on last edited by
    #1

    Hello,
    i have a editable combo box, the edit-field is for search-inputs, the drop down list is needed to reach lasts inputs easily.
    If the user inputs regular expressions, i want to highlight the special characters of that expressions like ".+*" etc.
    so:
    Is there an easy way to use rich edit formatting in the edit field of a QComboBox?
    Or can I replace the QLineEdit by (a one line) QTextEdit?

    If not, my plan is to display a QTextEdit and reduce the QComboBox to the popuplist-button and expand the popuplist.
    But do not prefer this,
    If the answer is, that i have to subclass QComboBox and override painting, is there a way to use rich edit formatting easily?

    Thank you

    raven-worxR 1 Reply Last reply
    0
    • tomwebT tomweb

      Hello,
      i have a editable combo box, the edit-field is for search-inputs, the drop down list is needed to reach lasts inputs easily.
      If the user inputs regular expressions, i want to highlight the special characters of that expressions like ".+*" etc.
      so:
      Is there an easy way to use rich edit formatting in the edit field of a QComboBox?
      Or can I replace the QLineEdit by (a one line) QTextEdit?

      If not, my plan is to display a QTextEdit and reduce the QComboBox to the popuplist-button and expand the popuplist.
      But do not prefer this,
      If the answer is, that i have to subclass QComboBox and override painting, is there a way to use rich edit formatting easily?

      Thank you

      raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by raven-worx
      #2

      @tomweb
      QLineEdit officially doesn't support rich text via it's public API.
      But internally it does support it! You can only set the formatting, but not retrieve it again.

      This is the only way i am aware of which makes it possible to set the formatting.

      p.s. replacing the line edit widget of a combobox isn't possible.

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      1 Reply Last reply
      3

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt
      • Unsolved