【问题标题】:How to change QTableView scrollbar position to be below header?如何将 QTableView 滚动条位置更改为标题下方?
【发布时间】:2016-12-06 15:19:40
【问题描述】:

如何将滚动条位置从标题旁边更改

到下面的标题?

任何如何实现这一点的想法都值得赞赏。

【问题讨论】:

    标签: qt qt5 qtableview qscrollarea


    【解决方案1】:

    您可以尝试以下 hack:

    1. QTableView 放入QVBoxLayout
    2. 使用horizontalHeader()从QTableView获取水平标题视图
    3. QVBoxLayoutQTableView 顶部插入水平标题视图

    【讨论】:

      【解决方案2】:

      您可以在 qss 中执行此操作(我假设您的标题有 50px 高度和蓝色):

      QScrollBar::sub-line:vertical {
          padding-top: 50px;
          height: 20px;
          background-color: blue;
      }
      QScrollBar::vertical {
          margin-top: 50px;
          padding-top: 20px;
      }
      

      【讨论】:

        猜你喜欢
        • 2010-11-17
        • 1970-01-01
        • 1970-01-01
        • 2017-10-23
        • 2011-05-28
        • 1970-01-01
        • 1970-01-01
        • 2018-12-16
        • 2017-11-08
        相关资源
        最近更新 更多