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. [SOLVED] Close button
Forum Updated to NodeBB v4.3 + New Features

[SOLVED] Close button

Scheduled Pinned Locked Moved General and Desktop
4 Posts 3 Posters 2.6k 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.
  • D Offline
    D Offline
    david.luggen
    wrote on last edited by
    #1

    I have a question to the window close button. How is it possible to complete relink this button? When I use the QWidget::closeEvent() it does whatever I want this event to do, but it still closes the window.

    What I would need is to detach this button completely from its predefined behavior and give him a new behavior.

    1 Reply Last reply
    0
    • S Offline
      S Offline
      sidewinder
      wrote on last edited by
      #2

      Could you show us some code please? Your window shouldn't close if you ignore the close event.

      "Never memorize what you can look up in books."
      Albert Einstein

      1 Reply Last reply
      0
      • N Offline
        N Offline
        Neutron Stein
        wrote on last edited by
        #3

        i think this can help
        @
        void MyWidget::closeEvent(QCloseEvent *ev){
        ev->ignore(); // this ignores the close event
        }
        @

        Never Seen !

        1 Reply Last reply
        0
        • D Offline
          D Offline
          david.luggen
          wrote on last edited by
          #4

          Well there isn't much code to show. At the moment I use this event handler just to detect when the event takes place.

          @
          void MyWindow::closeEvent(QCloseEvent *)
          {
          qDebug() << "closed";
          }
          @

          That works fine, but the problem is, that this is just an event that takes place when I close that window. It doesn't matte how I achieve this, e.g. by using the window close button or by closing the application.

          The point is, when I click on the window close button (the one that is integrated in the frame) the window closes anyway. What I'm looking for is to detach this button from its behaviour. E.g. when I click on this button, something else happens (whatever I want) but it does not close the window.

          Edit: Exactly what Neutron Stein wrote, thx!

          1 Reply Last reply
          0

          • Login

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