Results 1 to 11 of 11

Thread: QMainWindow or QDialog show() - before displaying, the window area is painted white

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #11
    Join Date
    Oct 2020
    Posts
    10
    Thanked 1 Time in 1 Post
    Qt products
    Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: QMainWindow or QDialog show() - before displaying, the window area is painted whi

    I solved this problem.

    Qt Code:
    1. class Dialog1 : public QDialog
    2. {
    3. Q_OBJECT
    4.  
    5. public:
    6. explicit Dialog1(QWidget *parent = nullptr);
    7. ~Dialog1();
    8.  
    9. private:
    10. Ui::Dialog1 *ui;
    11. protected:
    12. bool event(QEvent*e);
    13. };
    To copy to clipboard, switch view to plain text mode 
    Qt Code:
    1. Dialog1::Dialog1(QWidget *parent) :
    2. QDialog(parent),ui(new Ui::Dialog1)
    3. {
    4. ui->setupUi(this);
    5.  
    6. setWindowFlags(Qt::Window);
    7. setWindowOpacity(0);
    8. }
    9.  
    10. bool Dialog1::event(QEvent*e)
    11. {
    12. if(e->type()==QEvent::WindowActivate)
    13. {
    14. QTimer::singleShot(0,NULL,[this](){this->setWindowOpacity(1);});
    15. return true;
    16. }
    17. if(e->type()==QEvent::Hide)
    18. {
    19. setWindowOpacity(0);
    20. return true;
    21. }
    22. return QDialog::event(e);
    23. }
    To copy to clipboard, switch view to plain text mode 
    This is not a Qt problem, this is a Windows problem. I looked at my WPF and Windows Forms projects and saw that they have this problem. You can also see it by running Windows Explorer or Windows Task Manager. Another question is whether this is considered a problem. I think so, Yes. This flickering hits my eyes
    Last edited by VVS; 27th October 2020 at 11:41.

  2. The following user says thank you to VVS for this useful post:

    d_stranz (27th October 2020)

Similar Threads

  1. Replies: 0
    Last Post: 13th October 2020, 13:42
  2. Replies: 2
    Last Post: 20th March 2015, 11:38
  3. 8bit greyscale raw picture find painted area
    By dazedly in forum Qt Programming
    Replies: 1
    Last Post: 17th April 2012, 09:00
  4. Replies: 4
    Last Post: 15th July 2011, 18:31
  5. QDialog::show() not displaying child
    By Wasabi in forum Newbie
    Replies: 3
    Last Post: 14th September 2010, 01:38

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.