【问题标题】:How to set height of horizontal header QHeaderView?如何设置水平标题QHeaderView的高度?
【发布时间】:2012-07-03 15:45:57
【问题描述】:

我需要调整两个表格的标题,彼此靠近,因为标题有不同的文本行。 这似乎是不可能的。

请帮忙!

【问题讨论】:

    标签: c++ qt qheaderview


    【解决方案1】:

    创建一个派生自QHeaderView 的类,并提供您自己的sizeHint 实现以返回您想要的正确高度。即

    QSize MyCustomHeaderView::sizeHint() const
    {
        // Get the base implementation size.
        QSize baseSize = QHeaderView::sizeHint();
    
        // Override the height with a custom value.
        baseSize.setHeight( 25 );
    
        return baseSize;
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-09-09
      • 1970-01-01
      • 2016-07-08
      • 2011-12-03
      • 2019-10-13
      • 1970-01-01
      相关资源
      最近更新 更多