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. How can I edit the text in my combobox?
Forum Updated to NodeBB v4.3 + New Features

How can I edit the text in my combobox?

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
2 Posts 2 Posters 178 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.
  • M Offline
    M Offline
    MaximBozek
    wrote on last edited by
    #1

    How can I edit the text in my combobox? This is my combobox now:

            ComboBox {
                id: country_loaded
                width: 200
                height: 100
                model: ["Belgium", "The Netherlands", "France", "Germany", "Romania", "Poland", "Czech Republic", "Luxembourg"]
    
                background: Rectangle {
                    color: mecs_white
                    border.width: 3
                    border.color: mecs_white
                    radius: 10
                }
    
                contentItem: Text {
                    text: control.currentText
                    color: "black"
                    font.pointSize: 16
                    verticalAlignment: Text.AlignVCenter
                    horizontalAlignment: Text.AlignHCenter
                }
            }
    

    "ContentItem: Text" doesn't seem to work as my text dissapears:
    bb3a836e-efb6-4e4d-a04f-0cac4ead507b-image.png

    1 Reply Last reply
    0
    • A Offline
      A Offline
      Anumas
      wrote on last edited by
      #2

      Well, change your contentItem to an input control like TextField.

      Look how ComboBox is implemented for Material style: https://github.com/qt/qtdeclarative/blob/dev/src/quickcontrols/material/ComboBox.qml

      Say hello to a bright day.-

      Anumas.

      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