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. QTableWidget: Prevent users from changing the row height
Forum Updated to NodeBB v4.3 + New Features

QTableWidget: Prevent users from changing the row height

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 3 Posters 729 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
    hbatalha
    wrote on last edited by
    #1

    I want to stop the users from being able to change height of rows in qtablewidget.
    I thought this was a trivial task(a function call away) but I can't seem to find a way to do that.
    Screenshot_2.png
    In the pic above you can see that user increased the height of the row 2. How can I stop that from happening?

    Thanks in advance.

    1 Reply Last reply
    0
    • Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      You're looking for QHeaderView::setSectionResizeMode()

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

      H 1 Reply Last reply
      2
      • Christian EhrlicherC Christian Ehrlicher

        You're looking for QHeaderView::setSectionResizeMode()

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

        @Christian-Ehrlicher Screenshot_3.png

        JonBJ 1 Reply Last reply
        0
        • H hbatalha

          @Christian-Ehrlicher Screenshot_3.png

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

          @hbatalha
          Yes, it is not a member of a QTableWidget/QTableView. @Christian-Ehrlicher shows you it's a member of QHeaderView. See QTableView::horizontalHeader/verticalHeader().

          H 1 Reply Last reply
          3
          • JonBJ JonB

            @hbatalha
            Yes, it is not a member of a QTableWidget/QTableView. @Christian-Ehrlicher shows you it's a member of QHeaderView. See QTableView::horizontalHeader/verticalHeader().

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

            @JonB oh ok, now I got it. It works, thank you guys.

            table->verticalHeader()->setSectionResizeMode(QHeaderView::Fixed);
            
            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