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]ComboBox drag and drop issue

[Solved]ComboBox drag and drop issue

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

    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
    0
    • S Offline
      S Offline
      Sam
      wrote on last edited by
      #2

      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
      0
      • D Offline
        D Offline
        deepakberiwal
        wrote on last edited by
        #3

        Thanks Sam for the reply.

        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