Start to make it possible to move columns around

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Tomaz Canabrava 2015-01-06 21:49:48 -02:00 committed by Dirk Hohndel
parent 325f47c8d8
commit fd41ff4ab9
2 changed files with 22 additions and 0 deletions

View file

@ -211,6 +211,27 @@ void ColumnNameResult::setColumnValues(QList<QStringList> columns)
endInsertRows();
}
void ColumnDropCSVView::mousePressEvent(QMouseEvent *press)
{
QModelIndex atClick = indexAt(press->pos());
if (!atClick.isValid() || atClick.row())
return;
QRect indexRect = visualRect(atClick);
QPixmap pix(indexRect.width(), indexRect.height());
pix.fill(QColor(0,0,0,0));
render(&pix, QPoint(0, 0),QRegion(indexRect));
QDrag *drag = new QDrag(this);
QMimeData *mimeData = new QMimeData;
mimeData->setData(subsurface_mimedata, atClick.data().toByteArray());
drag->setPixmap(pix);
drag->setMimeData(mimeData);
if (drag->exec() != Qt::IgnoreAction){
// Do stuff here.
}
}
DiveLogImportDialog::DiveLogImportDialog(QStringList fn, QWidget *parent) : QDialog(parent),
selector(true),
ui(new Ui::DiveLogImportDialog)

View file

@ -58,6 +58,7 @@ class ColumnDropCSVView : public QTableView {
public:
ColumnDropCSVView(QWidget *parent);
protected:
void mousePressEvent(QMouseEvent *press);
void dragLeaveEvent(QDragLeaveEvent *leave);
void dragEnterEvent(QDragEnterEvent *event);
void dragMoveEvent(QDragMoveEvent *event);