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] QLabel is not moving Fast as mouse pointer moves of the mouse.

[Solved] QLabel is not moving Fast as mouse pointer moves of the mouse.

Scheduled Pinned Locked Moved General and Desktop
7 Posts 3 Posters 2.3k 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.
  • IamSumitI Offline
    IamSumitI Offline
    IamSumit
    wrote on last edited by
    #1

    I want to move a QLabel from different thread. How Could I achieve this .

    Be Cute

    1 Reply Last reply
    0
    • D Offline
      D Offline
      dbzhang800
      wrote on last edited by
      #2

      Hi, QWidget and its sub-classes can not be used in work-threads.

      1 Reply Last reply
      0
      • IamSumitI Offline
        IamSumitI Offline
        IamSumit
        wrote on last edited by
        #3

        NIHAO 1+1=2,
        But I have used Its working .But Not moving fast as Mouse Cursor Moves.

        Be Cute

        1 Reply Last reply
        0
        • D Offline
          D Offline
          dbzhang800
          wrote on last edited by
          #4

          Yes, in some simple cases, it may works. But you should know that :

          From Qt documentation http://qt-project.org/doc/qt-5.1/qtcore/threads-qobject.html

          bq. the GUI classes, notably QWidget and all its subclasses, are not reentrant. They can only be used from the main thread

          BTW, if it doesn't move as fast as mouse moves, perhaps you main thread is busy on some other things.

          1 Reply Last reply
          0
          • raven-worxR Offline
            raven-worxR Offline
            raven-worx
            Moderators
            wrote on last edited by
            #5

            moving a QWidget form antoher thread may only be an issue when you don't use a QueuedConnection. If you do so it's safe to do it.

            Even if you do all the work in your main thread your widget will never move as fast as the mouse moves. This is due to the event based architecture.

            --- 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
            • IamSumitI Offline
              IamSumitI Offline
              IamSumit
              wrote on last edited by
              #6

              Actually my idea was making a label as a mouse pointer by adding an pixmap of mouse pointer and moving it according to the mouse pointer.
              I have achieved some movement but whenever i move my mouse fast then label jumps.
              So I should assume that There is no way of moving a label as fast as mouse moves in Qt.

              Be Cute

              1 Reply Last reply
              0
              • raven-worxR Offline
                raven-worxR Offline
                raven-worx
                Moderators
                wrote on last edited by
                #7

                then use "QCursor's constructor":http://qt-project.org/doc/qt-4.8/qcursor.html#QCursor-4 for that. In this way it will work as intended and you won't have lags.

                --- 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

                • Login

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