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. Scrollbar not working in QTableView
Qt 6.11 is out! See what's new in the release blog

Scrollbar not working in QTableView

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 2 Posters 2.7k Views 1 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.
  • Q Offline
    Q Offline
    Qt Enthusiast
    wrote on last edited by
    #1

    Hi All
    I have a QTableView , I am using following code

    errorTableView = new QTableView();
    errorTableView->verticalHeader()->show();
    errorTableView->setSelectionBehavior(QAbstractItemView::SelectRows);
    /we can select multiple rows with ctrl click/
    errorTableView->setSelectionMode(QAbstractItemView::ExtendedSelection);
    errorTableView->horizontalHeader()->setResizeMode(QHeaderView::Interactive);
    errorTableView->horizontalHeader()->setStretchLastSection(true);
    errorTableView->resizeColumnsToContents();

    proxyModel = new QSortFilterProxyModel;;
    model = new QAbstractTableModel;
    proxyModel->setSourceModel(modell);
    errorTableView->setModel(d_proxyModel);
    errorTableView->setSortingEnabled(true);
    errorTableView->sortByColumn(0,Qt::AscendingOrder);
    if(errorTableView->horizontalHeader()) {
    errorTableView->horizontalHeader()->setSortIndicator(0,Qt::AscendingOrder);
    }

    In this case Horizontal scrollbar is not working

    1 Reply Last reply
    0
    • VRoninV Offline
      VRoninV Offline
      VRonin
      wrote on last edited by
      #2

      model = new QAbstractTableModel; is illegal
      errorTableView->resizeColumnsToContents(); before setting the model is useless

      What is wrong with the scroll bar? doesn't appear?

      "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
      0
      • Q Offline
        Q Offline
        Qt Enthusiast
        wrote on last edited by
        #3

        It appears , but I cannot move it further with mouse button and it is some how freezed

        1 Reply Last reply
        0
        • Q Offline
          Q Offline
          Qt Enthusiast
          wrote on last edited by
          #4

          It appears , but I cannot move it further with mouse button and it is some how freezed and also it is visible when not required , when all the data is visible in the QTableView

          1 Reply Last reply
          0
          • VRoninV Offline
            VRoninV Offline
            VRonin
            wrote on last edited by
            #5

            Try explicitly setting the policy http://doc.qt.io/qt-5/qabstractscrollarea.html#horizontalScrollBarPolicy-prop

            "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
            0
            • Q Offline
              Q Offline
              Qt Enthusiast
              wrote on last edited by
              #6

              It is not working . Any other suggestion

              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