Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. How to ignore user input (view-only mode) for a VNC server in Qt?
Forum Updated to NodeBB v4.3 + New Features

How to ignore user input (view-only mode) for a VNC server in Qt?

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
12 Posts 4 Posters 4.0k 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.
  • F FrozenTarzan

    I have an embedded Qt application that is started as a GUI server using the -qws parameter. In addition to the framebuffer a VNC connection is also in use. I now want to restrict the VNC client to only be able to view the content of my application suppressing any user input (keyboard, mouse,...).

    Can I configure this somehow for my Qt application via command line parameters or in the source code?

    It would also help if I could detect if a key event was sent via the VNC connection but I cannot image how to get this information from Qt's event system. Any ideas in that direction?

    If this is only possible with alternative VNC server approaches instead of Qt's one, I would also like to hear it :-)

    raven-worxR Offline
    raven-worxR Offline
    raven-worx
    Moderators
    wrote on last edited by
    #2

    @FrozenTarzan
    install an event-filter on the QApplication and filter out all input events by returning true in side your event-filter. See what even types inherit from QInputEvent.

    --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
    If you have a question please use the forum so others can benefit from the solution in the future

    F 1 Reply Last reply
    1
    • raven-worxR raven-worx

      @FrozenTarzan
      install an event-filter on the QApplication and filter out all input events by returning true in side your event-filter. See what even types inherit from QInputEvent.

      F Offline
      F Offline
      FrozenTarzan
      wrote on last edited by
      #3

      @raven-worx Thanks for the response. I was not clear enough about my intention. I want to forbid the user interaction via VNC. The interaction via the actual interface should still be possible. The system should work in a "presentation-only" mode. Filtering the input events would render the application useless ;-)

      raven-worxR 1 Reply Last reply
      0
      • F FrozenTarzan

        @raven-worx Thanks for the response. I was not clear enough about my intention. I want to forbid the user interaction via VNC. The interaction via the actual interface should still be possible. The system should work in a "presentation-only" mode. Filtering the input events would render the application useless ;-)

        raven-worxR Offline
        raven-worxR Offline
        raven-worx
        Moderators
        wrote on last edited by raven-worx
        #4

        @FrozenTarzan
        well than this has nothing to do with Qt or? But is rather a VNC (server) setting?!
        I assumed you are using the Qt VNC platform plugin...

        --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
        If you have a question please use the forum so others can benefit from the solution in the future

        1 Reply Last reply
        0
        • F Offline
          F Offline
          FrozenTarzan
          wrote on last edited by
          #5

          I am using the Qt VNC Server. I want to use it to connect a client to the application but only be able to view the content not sending any commands. When setting up the VNC server in my application I need to configure it but it seems that I cannot setup the VNC so that no input is allowed.

          So again:

          • I'm using Qt with VNC on an embedded device
          • In addition to the VNC "display" I'm using the regular embedded framebuffer
          • The user on the embedded device should be able to interact with the device as usual
          • The user connected via VNC should only be able to watch and not to interact/mess with the application
          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #6

            Hi,

            From a quick look at the VNC plugin source, you would need to modify it and add a parameter for "read-only" mode.

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

            F 1 Reply Last reply
            0
            • SGaistS SGaist

              Hi,

              From a quick look at the VNC plugin source, you would need to modify it and add a parameter for "read-only" mode.

              F Offline
              F Offline
              FrozenTarzan
              wrote on last edited by
              #7

              @SGaist said I was afraid that this would be the case. As far as I know the Qt VNC support should be used for debugging only and not offered to a customer. It works great so we wanted to use it anyways.

              Do you have any idea how I could determine if an event was sent via the VNC connection without modifying Qt's source? Then I could filter those events and ignore them. I thought about querying the sender of the event somehow. Using the QObject::eventFilter does not work because the QObject* is actually the receiver and the QEvent* does not contain any information of it origin/sender. Do you have any ideas on that?

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

                Sorry, I don't see a quick and clean way to do it.

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

                F 1 Reply Last reply
                0
                • F FrozenTarzan

                  @SGaist said I was afraid that this would be the case. As far as I know the Qt VNC support should be used for debugging only and not offered to a customer. It works great so we wanted to use it anyways.

                  Do you have any idea how I could determine if an event was sent via the VNC connection without modifying Qt's source? Then I could filter those events and ignore them. I thought about querying the sender of the event somehow. Using the QObject::eventFilter does not work because the QObject* is actually the receiver and the QEvent* does not contain any information of it origin/sender. Do you have any ideas on that?

                  jeremy_kJ Offline
                  jeremy_kJ Offline
                  jeremy_k
                  wrote on last edited by
                  #9

                  @FrozenTarzan Which version of Qt is being used?

                  Asking a question about code? http://eel.is/iso-c++/testcase/

                  1 Reply Last reply
                  0
                  • SGaistS SGaist

                    Sorry, I don't see a quick and clean way to do it.

                    F Offline
                    F Offline
                    FrozenTarzan
                    wrote on last edited by
                    #10

                    @SGaist Thanks for your quick answers anyways! :-)

                    @jeremy_k Qt for embedded Linux 4.8.6

                    Could you guys point me to a documentation of the QVNCServer? I could not find one that talkes about the C++ part or how to interact with the VNC server within the code. One can create a Qt server application by using the QApplication::GuiServer flag but it seems that I still need to configure it via the command line arguments or environment variables. Right now we use this:
                    export QWS_DISPLAY="Multi: transformed:Rot180:LinuxFb:tty=/dev/null VNC:0"
                    I would like to configure everything from source code or at least be able to enable/disable the VNC connection. It would even be ok for me to do it only in the constructor of the application since I'm afraid it is impossible to do that at run-time?

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

                      Aaaaaah... Crucial missing bit of information... I was assuming Qt 5...

                      Nevertheless the answer is the same BUT adding the code that would enable that is not that hard.

                      The files of interest are in src/plugins/platforms/vnc/. The QVNCIntegration class is what handles the command line arguments specific to the VNC plugin. There you could add the read-only flag handling. Then add a property to QVNCServer that will allow you to ignore input related events.

                      To do it at run time you would need to modify Qt a bit more but it is doable also.

                      On a side note, you might want to consider 4.8.7 which is the latest and last version of the Qt 4 series.

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

                      F 1 Reply Last reply
                      0
                      • SGaistS SGaist

                        Aaaaaah... Crucial missing bit of information... I was assuming Qt 5...

                        Nevertheless the answer is the same BUT adding the code that would enable that is not that hard.

                        The files of interest are in src/plugins/platforms/vnc/. The QVNCIntegration class is what handles the command line arguments specific to the VNC plugin. There you could add the read-only flag handling. Then add a property to QVNCServer that will allow you to ignore input related events.

                        To do it at run time you would need to modify Qt a bit more but it is doable also.

                        On a side note, you might want to consider 4.8.7 which is the latest and last version of the Qt 4 series.

                        F Offline
                        F Offline
                        FrozenTarzan
                        wrote on last edited by
                        #12

                        @SGaist Thanks a lot for all the valuable input! :-)

                        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