Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for Python
  4. how to show QComboBox item with first item in ComboBox.
Forum Updated to NodeBB v4.3 + New Features

how to show QComboBox item with first item in ComboBox.

Scheduled Pinned Locked Moved Unsolved Qt for Python
6 Posts 3 Posters 2.1k Views 1 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.
  • Y Offline
    Y Offline
    yashi95
    wrote on last edited by yashi95
    #1

    I am trying to create ComboBox with Qt designer , adding item through code "addItem" but I am not able to see my first item in QComboBox , list is coming but want to see first item in ComboBox.

    combo = QComboBox(self)
    combo.addItem("Apple")
    combo.addItem("Pear")
    combo.addItem("Lemon")
    
    jsulmJ 1 Reply Last reply
    0
    • Y yashi95

      I am trying to create ComboBox with Qt designer , adding item through code "addItem" but I am not able to see my first item in QComboBox , list is coming but want to see first item in ComboBox.

      combo = QComboBox(self)
      combo.addItem("Apple")
      combo.addItem("Pear")
      combo.addItem("Lemon")
      
      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @yashi95 https://doc.qt.io/qt-5/qcombobox.html#currentIndex-prop

      combo = QComboBox(self)
      combo.addItem("Apple")
      combo.addItem("Pear")
      combo.addItem("Lemon")
      combo.setCurrentIndex(0)
      

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      Y 1 Reply Last reply
      2
      • jsulmJ jsulm

        @yashi95 https://doc.qt.io/qt-5/qcombobox.html#currentIndex-prop

        combo = QComboBox(self)
        combo.addItem("Apple")
        combo.addItem("Pear")
        combo.addItem("Lemon")
        combo.setCurrentIndex(0)
        
        Y Offline
        Y Offline
        yashi95
        wrote on last edited by
        #3

        @jsulm c890ed7a-0267-4d07-b1b2-449e41c0a029-image.png

        see this look n field
        3f181d55-08f6-4d0c-a4d9-75712d7998ff-image.png

        did u see the difference, I want QComboBox like bellow image.

        jsulmJ 1 Reply Last reply
        0
        • Y yashi95

          @jsulm c890ed7a-0267-4d07-b1b2-449e41c0a029-image.png

          see this look n field
          3f181d55-08f6-4d0c-a4d9-75712d7998ff-image.png

          did u see the difference, I want QComboBox like bellow image.

          jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @yashi95 So, now you're asking about look and feel? Is your original question answered?

          By default your app should look and behave like the platform suggests (for example on Windows 10 it should look like Windows 10 apps usually look like). If you really want to change that then take a look at https://doc.qt.io/qt-5/stylesheet.html

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          Y 1 Reply Last reply
          0
          • jsulmJ jsulm

            @yashi95 So, now you're asking about look and feel? Is your original question answered?

            By default your app should look and behave like the platform suggests (for example on Windows 10 it should look like Windows 10 apps usually look like). If you really want to change that then take a look at https://doc.qt.io/qt-5/stylesheet.html

            Y Offline
            Y Offline
            yashi95
            wrote on last edited by
            #5

            @jsulm
            Hi,

            yes, thank you will check stylesheet, so it's possible to show like how look and feel in window.

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              Hi,

              Beware, trying to get the look and feel of a platform to another will get you in trouble with your users. People using Linux do not expect to have a Windows or macOS look on their application unless they specifically use a Window Manager that does that.

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              1

              • Login

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