Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How can i create my custom ComboBox?
Forum Updated to NodeBB v4.3 + New Features

How can i create my custom ComboBox?

Scheduled Pinned Locked Moved Unsolved General and Desktop
8 Posts 3 Posters 1.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.
  • Y Offline
    Y Offline
    Yaldiz
    wrote on 17 Jan 2022, 06:39 last edited by
    #1

    HI:

    I want to create custom combobox with my custom widgets.

    For example custom objects locations, custom geometry.

    How can i do this?

    Regards.

    J 1 Reply Last reply 17 Jan 2022, 08:42
    0
    • Y Yaldiz
      17 Jan 2022, 06:39

      HI:

      I want to create custom combobox with my custom widgets.

      For example custom objects locations, custom geometry.

      How can i do this?

      Regards.

      J Offline
      J Offline
      jsulm
      Lifetime Qt Champion
      wrote on 17 Jan 2022, 08:42 last edited by
      #2

      @Yaldiz Depends on the amount of changes you want to do compared to standard combo box.
      Also, are we talking about widgets or QML.
      For widgets you can either subclass QComboBox and implement your changes or implement your own combo box from scratch.

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

      1 Reply Last reply
      0
      • Y Offline
        Y Offline
        Yaldiz
        wrote on 17 Jan 2022, 10:52 last edited by
        #3

        We are talking about widgets.

        Can I change the default views with the method you specified?

        If possible, can you share a source where I can get an example?

        J 1 Reply Last reply 17 Jan 2022, 10:55
        0
        • Y Yaldiz
          17 Jan 2022, 10:52

          We are talking about widgets.

          Can I change the default views with the method you specified?

          If possible, can you share a source where I can get an example?

          J Offline
          J Offline
          jsulm
          Lifetime Qt Champion
          wrote on 17 Jan 2022, 10:55 last edited by
          #4

          @Yaldiz said in How can i create my custom ComboBox?:

          Can I change the default views with the method you specified?

          I don't know what exactly you want to achieve.
          What is "custom objects locations" (what objects?)?
          What is "custom geometry"?

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

          1 Reply Last reply
          0
          • Y Offline
            Y Offline
            Yaldiz
            wrote on 17 Jan 2022, 11:03 last edited by
            #5

            A combobox where I can create the design with my own widgets, labels etc...

            C 1 Reply Last reply 17 Jan 2022, 11:08
            0
            • Y Yaldiz
              17 Jan 2022, 11:03

              A combobox where I can create the design with my own widgets, labels etc...

              C Offline
              C Offline
              Christian Ehrlicher
              Lifetime Qt Champion
              wrote on 17 Jan 2022, 11:08 last edited by
              #6

              @Yaldiz This still not answers how / what you need different from a normal combobox. How should your combobox look like? What's not achievable with the normal one?

              Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
              Visit the Qt Academy at https://academy.qt.io/catalog

              1 Reply Last reply
              0
              • Y Offline
                Y Offline
                Yaldiz
                wrote on 17 Jan 2022, 11:13 last edited by
                #7

                I want different stylesheets, for example I don't want default dropdown arrow, I want custom designed arrow I want to use my custom widgets, labels like combobox items

                J 1 Reply Last reply 17 Jan 2022, 12:02
                0
                • Y Yaldiz
                  17 Jan 2022, 11:13

                  I want different stylesheets, for example I don't want default dropdown arrow, I want custom designed arrow I want to use my custom widgets, labels like combobox items

                  J Offline
                  J Offline
                  jsulm
                  Lifetime Qt Champion
                  wrote on 17 Jan 2022, 12:02 last edited by
                  #8

                  @Yaldiz said in How can i create my custom ComboBox?:

                  I want to use my custom widgets, labels like combobox items

                  See https://doc.qt.io/qt-5/qcombobox.html
                  "QComboBox uses the model/view framework for its popup list and to store its items. By default a QStandardItemModel stores the items and a QListView subclass displays the popuplist. You can access the model and view directly (with model() and view()), but QComboBox also provides functions to set and get item data (e.g., setItemData() and itemText()). You can also set a new model and view (with setModel() and setView()). For the text and icon in the combobox label, the data in the model that has the Qt::DisplayRole and Qt::DecorationRole is used. Note that you cannot alter the SelectionMode of the view(), e.g., by using setSelectionMode()."

                  Regarding style see https://doc.qt.io/qt-5/stylesheet-syntax.html

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

                  1 Reply Last reply
                  2

                  1/8

                  17 Jan 2022, 06:39

                  • Login

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