简体   繁体   English

滚动条消失时查找QScrollArea小部件的大小

[英]Find size of QScrollArea widget when scrollbar disappears

I have the following Qt widget layout 我有以下Qt小部件布局

QSplitter
  QFrame (select area), a QTableView
  QScrollArea (data area)
     QWidget (entry and edit form)

The user might prefer to see more of the select area, that's why the "data area" is in a scroll area. 用户可能希望看到更多的选择区域,这就是“数据区域”在滚动区域中的原因。 I can adjust the size of the "select" and "data area" by the vertical splitter. 我可以通过垂直拆分器调整“选择”和“数据区域”的大小。 All fine. 一切都很好。

Now I want to implement a convenience feature (keyboard shortcut) so that the "data area" extends / resizes to the (exact) size where no scrollbar is needed. 现在,我想实现一种便利功能(键盘快捷键),以便“数据区域”可以扩展/调整大小(精确),而无需滚动条。 But how can I obtain that height? 但是我如何获得那个高度? I could increment height until the scrollbar disappears, but this is stupid. 我可以增加高度,直到滚动条消失,但这很愚蠢。

I do not want the "data area" consuming too much space, but just as it requires to be displayed without scrollbar. 我不希望“数据区域”占用太多空间,但是就像它需要不带滚动条显示一样。

是的,如果我使用内部小部件(“ entry ...”)并在其顶部添加一些偏移量(用于QSCrollArea ),则似乎可以正常工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM