当他们的孩子被隐藏时调整qt小部件的大小 [英] Resizing qt widgets when their children are hidden

查看:56
本文介绍了当他们的孩子被隐藏时调整qt小部件的大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当重试子项被隐藏时,我将如何调整小部件的大小,使其看起来像第一张图片?主布局是一个 QVBoxLayout,重试子布局也是一个带有 QVBoxLayout 的小部件.

How would I go about resizing the widget when the retry child is hidden so that it looks as in the first image? The main layout is a QVBoxLayout, the retry child is a widget with a QVBoxLayout as well.

我尝试了以下方法:

  • 更新()
  • updateGeometry()
  • setGeometry(childrenRect())
  • layout()->activate()

一旦我将重试小部件设置为隐藏,就在主小部件上.我需要拦截一些事件才能做到这一点吗?

on the main widget as soon as I've set the retry widget to hidden. Do I need to intercept some event to do this?

推荐答案

adjustSize 函数可以做你想做的事.

The adjustSize function may do what you want.

这篇关于当他们的孩子被隐藏时调整qt小部件的大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆