Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Prevent QDialog from hiding
Forum Updated to NodeBB v4.3 + New Features

Prevent QDialog from hiding

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 2 Posters 503 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • krzysieklfcK Offline
    krzysieklfcK Offline
    krzysieklfc
    wrote on last edited by
    #1

    Hello,

    How can I prevent QWidget::hide from being called from within done? I want to implement fade in/out animation when the widget is created/destroyed, and right now it's being hidden immediately.

    void QDialog::done(int r)
    {
        Q_D(QDialog);
        d->hide(r);
        d->finalize(r, r);
    }
    
    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi
      It's virtual so you can just override it.
      https://doc.qt.io/qt-5/qdialog.html#done

      krzysieklfcK 1 Reply Last reply
      4
      • mrjjM mrjj

        Hi
        It's virtual so you can just override it.
        https://doc.qt.io/qt-5/qdialog.html#done

        krzysieklfcK Offline
        krzysieklfcK Offline
        krzysieklfc
        wrote on last edited by
        #3

        @mrjj Thanks. Also I had to override QDialog::open instead of overriding QDialog::exec, otherwise it wouldn't return until hide is called.

        1 Reply Last reply
        1
        • mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by mrjj
          #4

          Hi
          Thanks you for updating.
          What will you use for the animation? (if i may ask)
          Q animation classes and setWindowOpacity ?
          There is also QGraphicsOpacityEffect.

          krzysieklfcK 1 Reply Last reply
          0
          • mrjjM mrjj

            Hi
            Thanks you for updating.
            What will you use for the animation? (if i may ask)
            Q animation classes and setWindowOpacity ?
            There is also QGraphicsOpacityEffect.

            krzysieklfcK Offline
            krzysieklfcK Offline
            krzysieklfc
            wrote on last edited by
            #5

            @mrjj I'm using QPropertyAnimation on a windowOpacity property.
            I shared the code in the answer here. I also added dark overlay effect.

            fadeout.gif

            1 Reply Last reply
            2

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved