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. Drag and Drop implementation proposal
Forum Update on Monday, May 27th 2025

Drag and Drop implementation proposal

Scheduled Pinned Locked Moved General and Desktop
6 Posts 5 Posters 4.7k 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.
  • A Offline
    A Offline
    alex.barakhtyan
    wrote on last edited by
    #1

    Dear collegues!

    The problem: implementation of drag and drop requires subclassing of widget classes, so Designer becomes useless.

    The proposed solution: implement drag and drop policy classes (with virtual methods like dragEnter, dragMove, dropEvent etc., even possibly shallIBeginDrag ), instances of subclasses of which can be set to widgets and other drag/drop sources/targets by setDragDropPolicy method.

    What do you think? What is overall procedure of putting proposals to API?
    Thanks in advance

    1 Reply Last reply
    0
    • X Offline
      X Offline
      xsacha
      wrote on last edited by
      #2

      I'm in favour of this. Bump. I wrote an app recently where I needed to subclass Widget with:
      @void dragEnterEvent(QDragEnterEvent *event);
      void dragLeaveEvent(QDragLeaveEvent *event);
      void dragMoveEvent(QDragMoveEvent *event);
      void dropEvent(QDropEvent *event);@

      Don't see why these can't be included.

      • Sacha
      1 Reply Last reply
      0
      • G Offline
        G Offline
        giesbert
        wrote on last edited by
        #3

        You can use user defined classes in designer. Just put the base class on the widget (e.g. a checkbox) and the add a custom class (right click on the widget --> Use as placeholder for user defined class).
        Then you have a custom class in designer which you can implement in your source code.

        Nokia Certified Qt Specialist.
        Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

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

          Gerolf, I guess you are talking about promoting widgets (at least it is the name of the operation in Qt Creator).

          1 Reply Last reply
          0
          • G Offline
            G Offline
            giesbert
            wrote on last edited by
            #5

            Denis, thats exactly what I meant. I just looked into QtDesigner, and didn't find how to switch designer to english, it speaks german to me :-)

            Nokia Certified Qt Specialist.
            Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

            1 Reply Last reply
            0
            • I Offline
              I Offline
              infoctopus
              wrote on last edited by
              #6

              Also event filters can be of use, if you don't want to subclass a widget for some reason

              Qt rulez

              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