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 to create editorWidget when delegate is constructed?
QtWS25 Last Chance

How to create editorWidget when delegate is constructed?

Scheduled Pinned Locked Moved Unsolved General and Desktop
8 Posts 3 Posters 872 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.
  • H Offline
    H Offline
    hjohn
    wrote on last edited by hjohn
    #1

    no editor widgets are set up when the delegate is constructed. We only construct an editor widget when it is needed.

    here ,it says so.

    So what if I want an editorWidget as soon as a delegate is created?

    jsulmJ 1 Reply Last reply
    0
    • H hjohn

      no editor widgets are set up when the delegate is constructed. We only construct an editor widget when it is needed.

      here ,it says so.

      So what if I want an editorWidget as soon as a delegate is created?

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

      @hjohn Just construct it after creating the delegate?

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

      H 1 Reply Last reply
      1
      • jsulmJ jsulm

        @hjohn Just construct it after creating the delegate?

        H Offline
        H Offline
        hjohn
        wrote on last edited by
        #3

        @jsulm
        What I mean is, in this QSpinBox Delegate example,when we click on particular block in the table , the QSpinBox gets created and as soon as we select some other index, it vanishes.
        Is there a way to create a QSpinBox along with the Delegate where as soon as the table appears the spinBox appears too, without us clicking or attempting to edit it ? It should work as it works in the example linked above.

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

          Hi,

          Do you mean that you want the spin box to be shown permanently ?

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

          H 1 Reply Last reply
          0
          • SGaistS SGaist

            Hi,

            Do you mean that you want the spin box to be shown permanently ?

            H Offline
            H Offline
            hjohn
            wrote on last edited by hjohn
            #5

            @SGaist Yes, thats exactly what I mean.
            Can it be done !?

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

              You can try with openPersistentEditor. Note that you will hit a performance penalty if your model has a big number of rows.

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

              H 1 Reply Last reply
              2
              • SGaistS SGaist

                You can try with openPersistentEditor. Note that you will hit a performance penalty if your model has a big number of rows.

                H Offline
                H Offline
                hjohn
                wrote on last edited by
                #7

                @SGaist Thank you
                Now if there are more than one editors to add, How it knows which editor is to open in
                void openPersistantEditor(const QModelIndex &index)?

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

                  That is implemented in the delegate createEditor function.

                  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
                  0

                  • Login

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