Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. QMessageBox
Forum Updated to NodeBB v4.3 + New Features

QMessageBox

Scheduled Pinned Locked Moved Unsolved Qt Creator and other tools
8 Posts 3 Posters 711 Views 2 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.
  • A Offline
    A Offline
    AEM22
    wrote on last edited by
    #1

    Hi, I have a problem with QMessageBox.

    I have created different messages both information and warning messages. They appear correctly in the interface but the problem is that when they appear, I automatically change the color of the buttons and labels of my interface. Once I close the message my interface goes back to the colors that I have assigned to it. Could you help me?colorsNormal.PNG colorsWhenQMessageAppears.PNG

    The first image is the normal colors of my interface, the second one is when it changes when the message appears. I need these colors not to change.

    THANKS!!!!

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      Do you have any style sheet applied in your application ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      A 1 Reply Last reply
      0
      • M Offline
        M Offline
        mchinand
        wrote on last edited by
        #3

        @AEM22 said in QMessageBox:

        I automatically change the color of the buttons and labels of my interface

        Can you share your code here how you do the above and how you create and show the dialogs?

        A 1 Reply Last reply
        0
        • SGaistS SGaist

          Hi and welcome to devnet,

          Do you have any style sheet applied in your application ?

          A Offline
          A Offline
          AEM22
          wrote on last edited by
          #4

          @SGaist yes! I color the buttons and labels through the setStyleSheet("background-color : #d6e7f7") method for example. Shouldn't I? It is that through the own palette of the button it does not make it to me correctly.
          (I'm new with Qt hehehe)

          1 Reply Last reply
          0
          • M mchinand

            @AEM22 said in QMessageBox:

            I automatically change the color of the buttons and labels of my interface

            Can you share your code here how you do the above and how you create and show the dialogs?

            A Offline
            A Offline
            AEM22
            wrote on last edited by
            #5

            @mchinand yes!
            For example:
            I show the buttons as follows:
            this->ui->botonIncrementar->setStyleSheet("background-color : #a8d2a0");
            this->ui->botonDecrementar->setStyleSheet("background-color : #a8d2a0");
            this->ui->botonIncrementar->show();
            this->ui->botonDecrementar->show();

            In this way they are displayed with the colors I need.
            Then I start working with QMessageBox and when the message appears is when I change these initial colors and once I close the message, they return to their initial colors.
            mensajeInfo.information(this,"Información","¡Gracias!");

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              When are you changing these colors ?
              Are you still showing the same widget as before the message box is shown ?

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              A 1 Reply Last reply
              0
              • SGaistS SGaist

                When are you changing these colors ?
                Are you still showing the same widget as before the message box is shown ?

                A Offline
                A Offline
                AEM22
                wrote on last edited by
                #7

                @SGaist said in QMessageBox:

                When are you changing these colors ?
                Are you still showing the same widget as before the message box is shown ?

                Initially my interface appears with the colors I want and that's when I use the SetStyleSheet, then while the message is displayed, that's when it changes the color to black. Once I hit Ok on that message, the colors return to the colors I want and set using the SetStyleSheet.
                I explain, the problem is that while the message is on screen, the colors are not the right ones, once I remove that message, everything returns to its colors.

                1 Reply Last reply
                0
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  Can you provide a minimal compilable example that shows this behaviour ?

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  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