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. QCombobox in a QTable header label

QCombobox in a QTable header label

Scheduled Pinned Locked Moved Unsolved General and Desktop
7 Posts 2 Posters 591 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.
  • C Offline
    C Offline
    CEO.
    wrote on last edited by CEO.
    #1
    This post is deleted!
    1 Reply Last reply
    0
    • VRoninV Offline
      VRoninV Offline
      VRonin
      wrote on last edited by
      #2

      See https://forum.qt.io/post/675050

      "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
      ~Napoleon Bonaparte

      On a crusade to banish setIndexWidget() from the holy land of Qt

      C 2 Replies Last reply
      0
      • VRoninV VRonin

        See https://forum.qt.io/post/675050

        C Offline
        C Offline
        CEO.
        wrote on last edited by
        #3

        @VRonin alright, thanks for this. I will give you a feedback.

        1 Reply Last reply
        0
        • VRoninV VRonin

          See https://forum.qt.io/post/675050

          C Offline
          C Offline
          CEO.
          wrote on last edited by
          #4

          @VRonin thank you very much but that doesn't answer my question. I can do what's there. That's about setting currentText of a combobox.

          What I am talking about here is when the combobox is a child of a qtable header label, not a label of the table and not a parameter of the database. It relies on one of the labels of the table which in my case is stock type.

          VRoninV 1 Reply Last reply
          0
          • C CEO.

            @VRonin thank you very much but that doesn't answer my question. I can do what's there. That's about setting currentText of a combobox.

            What I am talking about here is when the combobox is a child of a qtable header label, not a label of the table and not a parameter of the database. It relies on one of the labels of the table which in my case is stock type.

            VRoninV Offline
            VRoninV Offline
            VRonin
            wrote on last edited by
            #5

            @CEO said in QCombobox in a QTable header label:

            I can do what's there

            But you are not doing it. You are using setCellWidget that does not store the data back in the original cell, you should be using a delegate like the one shown in the linked wiki article.

            "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
            ~Napoleon Bonaparte

            On a crusade to banish setIndexWidget() from the holy land of Qt

            C 1 Reply Last reply
            0
            • VRoninV VRonin

              @CEO said in QCombobox in a QTable header label:

              I can do what's there

              But you are not doing it. You are using setCellWidget that does not store the data back in the original cell, you should be using a delegate like the one shown in the linked wiki article.

              C Offline
              C Offline
              CEO.
              wrote on last edited by
              #6

              @VRonin thanks for your time and contribution. I have fixed it.
              The fault lies in the conditional statement I set in the "if widgetitem and widgetitem.text() ..."field

              that else: I changed it to:
              else:
              rowdata.append(combobox.currentText())

              Although I tried that yesterday but it gave me an error. Probably I didn't do one or two things right here.

              Anyway, thanks for the time.

              Lest I forget, don't you think it would be more appropriately to look through someone's code to see the line one could be making mistake and advising instead of just directing one to a llink of long lectures?

              Remember, someone who decides to come here to ask questions must have tried lot of things in a bid to resolve issues. It would be ideal if you guys learn or agree to be going through codes and pointing the lines that needs to be worked on as it's done in Stackoverflow, otherwise there's no need sharing codes here.

              Once again, thanks for the time.

              VRoninV 1 Reply Last reply
              0
              • C CEO.

                @VRonin thanks for your time and contribution. I have fixed it.
                The fault lies in the conditional statement I set in the "if widgetitem and widgetitem.text() ..."field

                that else: I changed it to:
                else:
                rowdata.append(combobox.currentText())

                Although I tried that yesterday but it gave me an error. Probably I didn't do one or two things right here.

                Anyway, thanks for the time.

                Lest I forget, don't you think it would be more appropriately to look through someone's code to see the line one could be making mistake and advising instead of just directing one to a llink of long lectures?

                Remember, someone who decides to come here to ask questions must have tried lot of things in a bid to resolve issues. It would be ideal if you guys learn or agree to be going through codes and pointing the lines that needs to be worked on as it's done in Stackoverflow, otherwise there's no need sharing codes here.

                Once again, thanks for the time.

                VRoninV Offline
                VRoninV Offline
                VRonin
                wrote on last edited by VRonin
                #7

                @CEO said in QCombobox in a QTable header label:

                it would be more appropriately to look through someone's code to see the line one could be making mistake and advising instead of just directing one to a llink of long lectures?

                I agree totally but I can't write python, I can guess what your program does by reading it but I wouldn't be able to tell you what to chage line-by-line.
                I stand on the fact that setCellWidget should not be used in this case. Especially with a db backend as it will slow down to a crawl after a few items are inserted

                "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
                ~Napoleon Bonaparte

                On a crusade to banish setIndexWidget() from the holy land of Qt

                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