Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-49282

Dragging of the item in QTableView or QTreeVIew works very slowly on Mac OS

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P3: Somewhat important P3: Somewhat important
    • None
    • 5.5.0
    • GUI: Drag and Drop
    • None
    • Mac OS 10.11

      Qt Creator 3.4.2 (opensource)
      Based on Qt 5.5.0 (Clang 6.0 (Apple), 64 bit)

      Built on Jun 29 2015 01:54:07
    • macOS

      Dragging of the item in QTableView or QTreeVIew works very slowly on Mac OS if method canDropMimeData of the model returns true.
      On windows all works fine.
      If canDropMimeData returns false - all works fine on Mac OS.

      To see the behaviour - look at attached short video.

      BTW: Qt creator shows such messages in application output:
      QNSView mouseDragged: Internal mouse button tracking invalid (missing Qt::LeftButton)

      I created a simple project to reproduce this issue:
      1 Create a simple project in the QtCreator for QDilag:
      2 Replace code in the dialog.cpp on code below:

      #include "dialog.h"
      #include "ui_dialog.h"
      
      #include <QTableView>
      #include <QHBoxLayout>
      
      class Model : public QAbstractTableModel
      {
          public:
      
              Model( QObject* parent )
              :
                  QAbstractTableModel( parent )
              {
      
              }
      
          public:
      
              int rowCount(const QModelIndex & parent = QModelIndex()) const
              {
                  return 5;
              }
      
              int columnCount(const QModelIndex & parent = QModelIndex()) const
              {
                  return 5;
              }
      
              QVariant data(const QModelIndex & index, int role = Qt::DisplayRole) const
              {
                  if( role == Qt::DisplayRole )
                  {
                      return "test";
                  }
      
                  return QVariant();
              }
      
              Qt::ItemFlags flags( const QModelIndex&	index ) const override
              {
                  return QAbstractTableModel::flags( index ) |
                          Qt::ItemIsDropEnabled |
                          Qt::ItemIsDragEnabled;
              }
      
              Qt::DropActions supportedDropActions( void ) const override
              {
                   return Qt::CopyAction;
              }
      
              bool canDropMimeData(
                  const QMimeData*	data,
                  Qt::DropAction		action,
                  int					row,
                  int					column,
                  const QModelIndex&	parent) const override
              {
                  return true;
              }
      };
      
      Dialog::Dialog(QWidget *parent) :
          QDialog(parent),
          ui(new Ui::Dialog)
      {
          ui->setupUi(this);
      
          QTableView* table = new QTableView;
          table->setModel( new Model( table ) );
      
          table->setSelectionBehavior( QAbstractItemView::SelectRows );
          table->viewport()->setAcceptDrops( true );
          table->setDropIndicatorShown( false );
          table->setDragDropMode( QAbstractItemView::DragDrop );
      
          QHBoxLayout* layout = new QHBoxLayout;
      
          setLayout( layout );
          layout->addWidget( table );
      }
      
      Dialog::~Dialog()
      {
          delete ui;
      }
      

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            tpochep Timur Pocheptsov
            yura-vel Yuriy
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes