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. Animated widget , what s the best approach?
Forum Updated to NodeBB v4.3 + New Features

Animated widget , what s the best approach?

Scheduled Pinned Locked Moved General and Desktop
6 Posts 4 Posters 2.7k 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.
  • G Offline
    G Offline
    giordi
    wrote on last edited by
    #1

    Hi everyone , I have been using pyqt and pyside for couple of years now and lately qt aswell.
    So I am trying to make more interactive uis and the specific goal I have for now is to have some animations in the widgets , for example one would be having a qlistWidget and when I am drag and dropping in the widget I would like the other widget for example to separate a little , in order to give a nicer feedback on where I would like to drop my widget. What s best way to implement this kind of animation in qt? What approach would you guys take?
    Or any suggestion about how implement more general animation for wiget like button pressing and so on would be totally aprreciated.

    Thanks a lot everyone! see ya around in the community

    Coding is powaaaaa

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

      Hi,

      You should first have a look at the various Drag & Drop examples from Qt's documentation they should provide you with some good knowledge to get started.

      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
      • G Offline
        G Offline
        giordi
        wrote on last edited by
        #3

        [quote author="SGaist" date="1381954268"]Hi,

        You should first have a look at the various Drag & Drop examples from Qt's documentation they should provide you with some good knowledge to get started.[/quote]

        Hi man thanks for your answer , I already did and implemented my custom drag and drob using custom widget and using QMime as translator and all that just work fine , but let s say I start a drag and drop obtion so I have my custom widget being dragged in the QListWidget for example I am moving it from bottom to top mean while passing ovver all the other widget in the list . What I would like to achieve is that if my widget is between widget X and Y i would like those to slide a little away and make a small gap between the two so to give a visual nice hint to the user that if I drop now my widget will end up there.
        I mean it s purely an aestetic feature , nothing to do with actual functionality of drag and drop.

        Coding is powaaaaa

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

          There's something that is not really clear, do you want items in a QListWidget to move or e.g. move your dragged element between two labels and they should move ?

          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
          • T Offline
            T Offline
            thEClaw
            wrote on last edited by
            #5

            Maybe you could take a look into the sources of QMainWindow? Somewhere in there (or probably in a related private class) is a function that animates things like QToolBars or QDockWidgets being dragged around in the QMainWindow. I haven't looked at the code myself, but the animations are very well done, so maybe you can help yourself by learning from the readily available sources.

            I would suggest using a layout with a special "dummy"-widget, that indicates the drop-location. You could then add that dummy at the cursors position (keeping the UI snappy could be tedious, since the drag operation is modal as far as I know), which should automatically move around all the other elements. If you pick a suitable layout, this could actually be relatively painless.

            1 Reply Last reply
            0
            • VRoninV Offline
              VRoninV Offline
              VRonin
              wrote on last edited by
              #6

              If you are hard coding the widget positions (not using a layout) you can use QPropertyAnimation on size and pos properties to get the result you want.
              If you are using a layout you should subclass it and reimplement the setgeometry method so that it will use QPropertyAnimation when resizing and positioning widgets

              "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
              ~Napoleon Bonaparte

              On a crusade to banish setIndexWidget() from the holy land of Qt

              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