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. QTableView: How to determine, if scrollbar shows up?
Forum Updated to NodeBB v4.3 + New Features

QTableView: How to determine, if scrollbar shows up?

Scheduled Pinned Locked Moved Solved General and Desktop
7 Posts 3 Posters 547 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.
  • A Offline
    A Offline
    andi456
    wrote on last edited by
    #1

    When a QTableView Instance is created dynamically according to configuration file, it seems that the scrollbar is not shown, while I still can use the mouse wheel to scroll through the table's content.

    Are there any properties or similar to check, why the scrollbar does not show?

    Kind regards,

    Andreas

    JonBJ 1 Reply Last reply
    0
    • A andi456

      When a QTableView Instance is created dynamically according to configuration file, it seems that the scrollbar is not shown, while I still can use the mouse wheel to scroll through the table's content.

      Are there any properties or similar to check, why the scrollbar does not show?

      Kind regards,

      Andreas

      JonBJ Online
      JonBJ Online
      JonB
      wrote on last edited by
      #2

      @andi456 said in QTableView: How to determine, if scrollbar shows up?:

      When a QTableView Instance is created dynamically according to configuration file

      You might show code for how you do this? I do not recall a scrollbar not being shown when it should be.

      A 1 Reply Last reply
      0
      • JonBJ JonB

        @andi456 said in QTableView: How to determine, if scrollbar shows up?:

        When a QTableView Instance is created dynamically according to configuration file

        You might show code for how you do this? I do not recall a scrollbar not being shown when it should be.

        A Offline
        A Offline
        andi456
        wrote on last edited by
        #3

        @JonB Why not? Depending on certain conditions in the config file, the following code would be used to instantiate a QTableView

        tview = new QTableView(ContentWidget);
        tview->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
        

        I haven't put it any layout so far. Maybe that's the problem?

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

          Hi,

          That's the default policy.

          Please provide a minimal compilable example that shows the behaviour.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          A 1 Reply Last reply
          0
          • SGaistS SGaist

            Hi,

            That's the default policy.

            Please provide a minimal compilable example that shows the behaviour.

            A Offline
            A Offline
            andi456
            wrote on last edited by
            #5

            @SGaist Ok, I'll do so, but it will take some time.

            For now, maybe the following could be relevant. As the QTableView should be shown in the Tab of a QTabWidget instance, I had to create a baseWidget for the Tab and a contentWidget as its child for the QTableView instance.

            Maybe I need to play around with the contentWidget or the baseWidget?

            SGaistS 1 Reply Last reply
            0
            • A andi456

              @SGaist Ok, I'll do so, but it will take some time.

              For now, maybe the following could be relevant. As the QTableView should be shown in the Tab of a QTabWidget instance, I had to create a baseWidget for the Tab and a contentWidget as its child for the QTableView instance.

              Maybe I need to play around with the contentWidget or the baseWidget?

              SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              @andi456 if you want to show only the QTableView in your tab, why not set it directly on it ?

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              A 1 Reply Last reply
              0
              • SGaistS SGaist

                @andi456 if you want to show only the QTableView in your tab, why not set it directly on it ?

                A Offline
                A Offline
                andi456
                wrote on last edited by andi456
                #7

                @SGaist: After another look at my code, i found the error: The width of the QTableViews rectangle was too big.

                Thanks for your help, anyway.

                Kind regards,

                Andreas

                1 Reply Last reply
                0
                • A andi456 has marked this topic as solved on

                • Login

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • Users
                • Groups
                • Search
                • Get Qt Extensions
                • Unsolved