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?

How to create editorWidget when delegate is constructed?

Scheduled Pinned Locked Moved Unsolved General and Desktop
8 Posts 3 Posters 883 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 25 Jun 2018, 05:59 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?

    J 1 Reply Last reply 25 Jun 2018, 07:48
    0
    • H hjohn
      25 Jun 2018, 05:59

      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?

      J Offline
      J Offline
      jsulm
      Lifetime Qt Champion
      wrote on 25 Jun 2018, 07:48 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 25 Jun 2018, 09:02
      1
      • J jsulm
        25 Jun 2018, 07:48

        @hjohn Just construct it after creating the delegate?

        H Offline
        H Offline
        hjohn
        wrote on 25 Jun 2018, 09:02 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
        • S Offline
          S Offline
          SGaist
          Lifetime Qt Champion
          wrote on 25 Jun 2018, 21:34 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 26 Jun 2018, 05:00
          0
          • S SGaist
            25 Jun 2018, 21:34

            Hi,

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

            H Offline
            H Offline
            hjohn
            wrote on 26 Jun 2018, 05:00 last edited by hjohn
            #5

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

            1 Reply Last reply
            0
            • S Offline
              S Offline
              SGaist
              Lifetime Qt Champion
              wrote on 26 Jun 2018, 20:35 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 27 Jun 2018, 06:31
              2
              • S SGaist
                26 Jun 2018, 20:35

                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 27 Jun 2018, 06:31 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
                • S Offline
                  S Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on 27 Jun 2018, 21:08 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

                  1/8

                  25 Jun 2018, 05:59

                  • 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