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. How enable and add action to closeButton(QMessageBox)?

How enable and add action to closeButton(QMessageBox)?

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 3 Posters 1.9k Views 3 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.
  • EngelardE Offline
    EngelardE Offline
    Engelard
    wrote on last edited by
    #1

    How can i set my close crest icon enabled? There is no buttons i have with ::NoRole, so that thing at top-right angle of MessageBox is always disabled, but i would like set some custom action on it(without adding another button).

    setWindowFlags(Qt::WindowCloseButtonHint); do nothing, don't helped at all. And i hoped that .exec(); might return something special for closed action, but didn't find such stuff. +as i said close button disabled so...

    K 1 Reply Last reply
    0
    • EngelardE Engelard

      How can i set my close crest icon enabled? There is no buttons i have with ::NoRole, so that thing at top-right angle of MessageBox is always disabled, but i would like set some custom action on it(without adding another button).

      setWindowFlags(Qt::WindowCloseButtonHint); do nothing, don't helped at all. And i hoped that .exec(); might return something special for closed action, but didn't find such stuff. +as i said close button disabled so...

      K Offline
      K Offline
      koahnig
      wrote on last edited by
      #2

      @Engelard

      Did you consider using the different return codes?
      (E.g. for information)

      Vote the answer(s) that helped you to solve your issue(s)

      EngelardE 1 Reply Last reply
      0
      • K koahnig

        @Engelard

        Did you consider using the different return codes?
        (E.g. for information)

        EngelardE Offline
        EngelardE Offline
        Engelard
        wrote on last edited by
        #3

        @koahnig said in How enable and add action to closeButton(QMessageBox)?:

        Did you consider using the different return codes?

        No sense to consider all that stuff while main close button is disabled by default. First need to set it enabled, thats the point of this topic(first of two).

        mrjjM 1 Reply Last reply
        0
        • EngelardE Engelard

          @koahnig said in How enable and add action to closeButton(QMessageBox)?:

          Did you consider using the different return codes?

          No sense to consider all that stuff while main close button is disabled by default. First need to set it enabled, thats the point of this topic(first of two).

          mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @Engelard
          Hi
          You must have one button with QMessageBox::RejectRole
          to have the close button enabled. ( the X )

          EngelardE 1 Reply Last reply
          0
          • mrjjM mrjj

            @Engelard
            Hi
            You must have one button with QMessageBox::RejectRole
            to have the close button enabled. ( the X )

            EngelardE Offline
            EngelardE Offline
            Engelard
            wrote on last edited by
            #5

            @mrjj i know! But that will mean that i will have one extra button, unnecessary one.

            I wanted it just like that:

            1. Accept button
            2. Refresh button

            That's it, not third button must be, but user should be able just close that modal window if he understand that none of two options fit him. I've added third button because of that, but only because of that flow of QMessageBox.

            P.S. is it possible to hide third button somehow?

            mrjjM 1 Reply Last reply
            0
            • EngelardE Engelard

              @mrjj i know! But that will mean that i will have one extra button, unnecessary one.

              I wanted it just like that:

              1. Accept button
              2. Refresh button

              That's it, not third button must be, but user should be able just close that modal window if he understand that none of two options fit him. I've added third button because of that, but only because of that flow of QMessageBox.

              P.S. is it possible to hide third button somehow?

              mrjjM Offline
              mrjjM Offline
              mrjj
              Lifetime Qt Champion
              wrote on last edited by
              #6

              @Engelard
              Hi
              In theory you could use FindChild and hide it.
              But i never tried it. :)

              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