• QT QSplitter设置初始比例setStretchFactor失效解决


    QSplitter如下为常用 设置显示比例

    1 pRightSplitter=new QSplitter(Qt::Vertical);
    2 pRightSplitter->setMouseTracking(true);
    3 pRightSplitter->setStretchFactor(0,8);
    4 pRightSplitter->setStretchFactor(1,2);
    但是由于内部有子窗口的布局时,会失效

    使用下面方法设置

    1 //pRightTopWidget 为子窗口1
    2 QSizePolicy rightTopPolicy = pRightTopWidget->sizePolicy();
    3 rightTopPolicy.setVerticalStretch(8);
    4 pRightTopWidget->setSizePolicy(rightTopPolicy);
    5 //pRightDownWidget 为子窗口2
    6 QSizePolicy rightDownPolicy = pRightDownWidget->sizePolicy();
    7 rightDownPolicy.setVerticalStretch(2);
    8 pRightDownWidget->setSizePolicy(rightDownPolicy);
    参考 https://blog.csdn.net/baidu_33850454/article/details/80845582
    ————————————————
    版权声明:本文为CSDN博主「剑峰随心」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
    原文链接:https://blog.csdn.net/qq_36190978/article/details/103244087

  • 相关阅读:
    线程池
    队列Queue、栈LifoQueue、优先级队列PriorityQueue
    线程的定时器Timer
    线程的条件Condiition
    线程的信号量Semaphore
    死锁的原因及解决办法RLock递归锁
    线程锁Lock
    守护线程daemon
    threding模块的其他用法
    变量的存储方式和生存期
  • 原文地址:https://www.cnblogs.com/yuyuanbaobei521/p/14845933.html
Copyright © 2020-2023  润新知