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 n drop problem with Linux

Drag n drop problem with Linux

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 2 Posters 401 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.
  • M Offline
    M Offline
    MeyerDumont
    wrote on last edited by
    #1

    Hi, I got a small application with drag n drop in a treeview perfectly working on windows. When i try it on linux (Ubuntu) I got many problems :

    1. I don't have any visual feedback when I move items around ( no action icons ( move, copy, forbidden))
    2. When I accept an event only once in the dragMoveEvent function during the movement of an item, the dropEvent function will be called, even if I ignore the event after.

    => The only way for the dropEvent to not be called is to avoid passing over an "acceptable droppable location"

    Any idea ?

    Thanks in advance
    Meyer

    1 Reply Last reply
    1
    • S Offline
      S Offline
      stryga42
      wrote on last edited by stryga42
      #2

      Which distro & which WM? Can you post some skeleton code which demonstrates the issue? And are you dragging within your app or across applications?

      M 1 Reply Last reply
      0
      • S stryga42

        Which distro & which WM? Can you post some skeleton code which demonstrates the issue? And are you dragging within your app or across applications?

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

        @stryga42 Ubuntu 22.04.2 LTS with the standard wayland WM.
        I am dragging within my app (I drag a treeItem from its location to another in the same treeview).

        The code itself is very basic and it works as expected on windows

        void ProjectWidget::dragMoveEvent(QDragMoveEvent * event)
        {
            QTreeWidgetItem* currentItem = itemAt(event->position().toPoint());
        
            if (currentItem == NULL)
                {
                    event->ignore();
                    return;
                }
            if (latestDraggedItem == NULL)
                {
                    event->ignore();
                    return;
                }
        
            QVariant v = latestDraggedItem->data(0,Qt::UserRole);
            if (v.value<ModelTemplate *>())
                {
                if (currentItem == cardNode)             
                    {
                    event->setDropAction(Qt::MoveAction);
                    event->accept();
                    return;
                    }
               }
        
        event->ignore();
        }
        
        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