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. Place QWidget inside QTableWidget view

Place QWidget inside QTableWidget view

Scheduled Pinned Locked Moved Unsolved General and Desktop
7 Posts 4 Posters 925 Views 2 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.
  • I Offline
    I Offline
    imaqt 0
    wrote on last edited by
    #1

    I have a QPushButton that I have placed inside a QTableView view. However when the number of items in the table reaches the maximum, the button gets pushed out of the view and it's not possible to press it. How can I anchor it to the bottom of the view?

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

      Hi,

      The most simple would likely be to position it manually rather than in a cell and update its position when the widget is resized.

      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
      • I imaqt 0

        I have a QPushButton that I have placed inside a QTableView view. However when the number of items in the table reaches the maximum, the button gets pushed out of the view and it's not possible to press it. How can I anchor it to the bottom of the view?

        JonBJ Offline
        JonBJ Offline
        JonB
        wrote on last edited by
        #3

        @imaqt-0
        It does not sound like it belongs there, place it after the view instead of in the view and then you wouldn't have a problem?

        1 Reply Last reply
        0
        • I Offline
          I Offline
          imaqt 0
          wrote on last edited by
          #4

          Hello,
          I think I didn't do a good job explaining the situation.
          0_1554712729814_file.gif
          I have the insert row button, which is positioned after the last table row. The problem is that the view doesn't allow me to scroll to it. How can i fix this?

          JonBJ 1 Reply Last reply
          0
          • mrjjM Offline
            mrjjM Offline
            mrjj
            Lifetime Qt Champion
            wrote on last edited by
            #5

            Hi
            Did you place it on an item ?
            with setCellWidget ?

            1 Reply Last reply
            0
            • I imaqt 0

              Hello,
              I think I didn't do a good job explaining the situation.
              0_1554712729814_file.gif
              I have the insert row button, which is positioned after the last table row. The problem is that the view doesn't allow me to scroll to it. How can i fix this?

              JonBJ Offline
              JonBJ Offline
              JonB
              wrote on last edited by
              #6

              @imaqt-0
              If you maintain having the button as a cell widget you're in a sticky situation.

              If you have the button placed after the QTableWidget (i.e. it is not a cell widget, it is a sibling of the whole table), any scroller on the table is not going to get you to the button. Make it so the table takes up all space except for allowing the button below it, which is always visible.

              This really should not be very hard. Please indicate clearly whether your button is a cell widget or a widget placed after the QTableWidget.

              1 Reply Last reply
              2
              • I Offline
                I Offline
                imaqt 0
                wrote on last edited by
                #7

                Hello,
                I created the button with:

                button = new QPushButton(table->viewport());
                

                and I update its position on the table to be after the last row each time a new row is inserted.

                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