Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. ComboBox text color
Forum Updated to NodeBB v4.3 + New Features

ComboBox text color

Scheduled Pinned Locked Moved Solved QML and Qt Quick
3 Posts 3 Posters 2.7k Views 2 Watching
  • 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.
  • M Offline
    M Offline
    Mark81
    wrote on last edited by
    #1

    Reading the documentation I cannot find a way to change the color of the text in a ComboBox (QtQuick.Controls 2.12).
    I'm not talking about the dropdown menu, but just the displayed text.

    I see in the docs the ComboBoxStyle, but there are no examples. And trying to assign it to the style property:

    ComboBox {
          id: combo
          anchors.fill: parent
          model: _model
          style: ComboBoxStyle {
              textColor: _waiting ? "red" : "forestgreen";
          }
    

    is says style is a non-existing property.
    What is the right way to do this?

    raven-worxR 1 Reply Last reply
    0
    • M Mark81

      Reading the documentation I cannot find a way to change the color of the text in a ComboBox (QtQuick.Controls 2.12).
      I'm not talking about the dropdown menu, but just the displayed text.

      I see in the docs the ComboBoxStyle, but there are no examples. And trying to assign it to the style property:

      ComboBox {
            id: combo
            anchors.fill: parent
            model: _model
            style: ComboBoxStyle {
                textColor: _waiting ? "red" : "forestgreen";
            }
      

      is says style is a non-existing property.
      What is the right way to do this?

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

      @Mark81 said in ComboBox text color:

      Reading the documentation I cannot find a way to change the color of the text in a ComboBox (QtQuick.Controls 2.12)

      https://doc-snapshots.qt.io/qt5-5.12/qtquickcontrols2-customize.html#customizing-combobox

      --- 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
      • A Offline
        A Offline
        aconnell
        wrote on last edited by
        #3

        The link doesn't work - still looking for an answer to Mark81's question

        1 Reply Last reply
        0

        • Login

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