Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    [Solved]ComboBox drag and drop issue

    General and Desktop
    2
    3
    1383
    Loading More Posts
    • 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.
    • D
      deepakberiwal last edited by

      I have a requirement in which I have to drag an item from comboBox and drop it on a PushButton.

      For this I am writing a class for comboBox and handling all the drag events in the same class, also I am writing a class for pushButton where I am handling the drop event.

      The issue I am facing is that, when I am trying to drag the item from the comboBox, I can see the item moving, but on the same time none of the events are being called. And when I am dragging the whole comboBox the events are being called.

      If any one have some idea please do let me know.

      Thanks in Advance.

      1 Reply Last reply Reply Quote 0
      • S
        Sam last edited by

        For your pushButton in the DragEnterEvent() check for the accpeted mimeData formats eg

        @qDebug() << event->mimeData()->formats();@

        and you get the result as

        @application/x-qabstractitemmodeldatalist@

        Code :

        @void customButton::dragEnterEvent(QDragEnterEvent *event)
        {
        qDebug() << event->mimeData()->formats(); //just for test
        if(event->mimeData()->hasFormat("application/x-qstandarditemmodeldatalist"))
        event->accept();
        else
        event->ignore();
        }@

        This is a workaround you need to handle some filters/checks as per your requirement.

        1 Reply Last reply Reply Quote 0
        • D
          deepakberiwal last edited by

          Thanks Sam for the reply.

          1 Reply Last reply Reply Quote 0
          • First post
            Last post