zoukankan      html  css  js  c++  java
  • qt widget设置Qt::FramelessWindowHint和Qt::WA_TranslucentBackground, 会出现一个bug: 在最小化后还原时界面停止刷新


    qt widget设置Qt::FramelessWindowHint和Qt::WA_TranslucentBackground, 会出现一个bug: 在最小化后还原时界面停止刷新

    Widget with Qt::FramelessWindowHint and Qt::WA_TranslucentBackground stops painting after minimize/restore

    被这个问题折腾了好几天, 真特么郁闷

    该bug在qt 5.1.1中修复, bugreport链接 https://bugreports.qt-project.org/browse/QTBUG-17548
    这个bug都发现N久了, 现在才修复

    之前的版本的话, 可以试下下面的方法, 基本可用, 但在setwindowflag后, 任务栏图标会滑动一下, 某些电脑可能还会略微闪烁
    void TestDlg::changeEvent( QEvent* e )
    {

    if( e->type() == QEvent::WindowStateChange)
    {
    if(this->windowState() & Qt::WindowMinimized )
    {
    //do something after minimize
    }
    else
    {
    setWindowFlags(Qt::Window);//set normal window flag
    setWindowFlags(Qt::Window | Qt::FramelessWindowHint | Qt::WindowMinimizeButtonHint);//and return to your old flags

    this->showNormal();

    }
    }
    }
    Qt 真是各种坑呐

    补充: 该方法对qmainwindow无效, 在Qt5.1 qmainwindow 依然存在此问题

  • 相关阅读:
    Beta 冲刺(1/7)
    福大软工 · 第十次作业
    11111111
    101
    7
    6
    5
    4
    p
    b2
  • 原文地址:https://www.cnblogs.com/lingdhox/p/3316910.html
Copyright © 2011-2022 走看看