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. I want to check the communication status with a color blinking or label.
Qt 6.11 is out! See what's new in the release blog

I want to check the communication status with a color blinking or label.

Scheduled Pinned Locked Moved Solved General and Desktop
8 Posts 2 Posters 1.6k Views
  • 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.
  • M Offline
    M Offline
    meria0503
    wrote on last edited by
    #1

    Hello, I'm a new Qt developer.

    I'm asking this question because I want to check if the communication is smooth for PCs with DB servers.

    Here's how I thought of it

    If the DB server and the PC with the QT program are communicating well, the green light comes on, and if the communication is not smooth, the red light comes on. Green light and red light are images. We're thinking about a minute apart when we're sending and receiving signals. I searched on the Internet and found that there were some examples that I thought of, but I couldn't apply them.

    I just drew it up.

    화면 캡처 2022-07-04 161757.png

    It's like this. When the signal goes back and forth, the red light disappears

    It's how the red light comes on and the green light disappears when the signal doesn't go smoothly.

    Is there a good example or code example?

    The method is TCP/IP. I'm thinking of using QTcpsocket.

    jsulmJ 1 Reply Last reply
    0
    • M meria0503

      Hello, I'm a new Qt developer.

      I'm asking this question because I want to check if the communication is smooth for PCs with DB servers.

      Here's how I thought of it

      If the DB server and the PC with the QT program are communicating well, the green light comes on, and if the communication is not smooth, the red light comes on. Green light and red light are images. We're thinking about a minute apart when we're sending and receiving signals. I searched on the Internet and found that there were some examples that I thought of, but I couldn't apply them.

      I just drew it up.

      화면 캡처 2022-07-04 161757.png

      It's like this. When the signal goes back and forth, the red light disappears

      It's how the red light comes on and the green light disappears when the signal doesn't go smoothly.

      Is there a good example or code example?

      The method is TCP/IP. I'm thinking of using QTcpsocket.

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @meria0503 It is not really clear what you are asking.
      You can hide a widget calling hide() on it and you can show it again calling show() on it. So that is what you could do. Or use only one widget (QLabel) to show the image and simply show the one (red or green) which is needed to show the state.

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      M 1 Reply Last reply
      1
      • jsulmJ jsulm

        @meria0503 It is not really clear what you are asking.
        You can hide a widget calling hide() on it and you can show it again calling show() on it. So that is what you could do. Or use only one widget (QLabel) to show the image and simply show the one (red or green) which is needed to show the state.

        M Offline
        M Offline
        meria0503
        wrote on last edited by
        #3

        @jsulm

        The content is a little strange because the translation is not smooth.

        To be exact, when you communicate with the server and the client,

        I'm thinking about how the green light turns on if it's normal, and the red light turns on if it's defective.

        I want to implement this.

        jsulmJ 1 Reply Last reply
        0
        • M meria0503

          @jsulm

          The content is a little strange because the translation is not smooth.

          To be exact, when you communicate with the server and the client,

          I'm thinking about how the green light turns on if it's normal, and the red light turns on if it's defective.

          I want to implement this.

          jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @meria0503 So, you are asking how to decide whether you need to show red or green light?
          Well, I do not know what your requirements are. For example if connection breaks you switch to red light. But you have to specify what "defective" means for you.

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          M 1 Reply Last reply
          2
          • jsulmJ jsulm

            @meria0503 So, you are asking how to decide whether you need to show red or green light?
            Well, I do not know what your requirements are. For example if connection breaks you switch to red light. But you have to specify what "defective" means for you.

            M Offline
            M Offline
            meria0503
            wrote on last edited by
            #5

            @jsulm The reason why I need it is that I receive data from the server where DB is located, but if the connection is disconnected, I cannot receive the data, so I need to know the contents

            It doesn't matter if it's not that green light or red light, it doesn't matter if it's a text message of connect and disconnect.

            jsulmJ 1 Reply Last reply
            0
            • M meria0503

              @jsulm The reason why I need it is that I receive data from the server where DB is located, but if the connection is disconnected, I cannot receive the data, so I need to know the contents

              It doesn't matter if it's not that green light or red light, it doesn't matter if it's a text message of connect and disconnect.

              jsulmJ Offline
              jsulmJ Offline
              jsulm
              Lifetime Qt Champion
              wrote on last edited by
              #6

              @meria0503 Do you use https://doc.qt.io/qt-6/qtsql-index.html ? You can set red light when your SQL queries fail.

              https://forum.qt.io/topic/113070/qt-code-of-conduct

              M 2 Replies Last reply
              0
              • jsulmJ jsulm

                @meria0503 Do you use https://doc.qt.io/qt-6/qtsql-index.html ? You can set red light when your SQL queries fail.

                M Offline
                M Offline
                meria0503
                wrote on last edited by
                #7

                @jsulm Yes, I'm using sql.

                1 Reply Last reply
                0
                • jsulmJ jsulm

                  @meria0503 Do you use https://doc.qt.io/qt-6/qtsql-index.html ? You can set red light when your SQL queries fail.

                  M Offline
                  M Offline
                  meria0503
                  wrote on last edited by
                  #8

                  @jsulm I solved it in a different way.

                  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