-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmainwindow.cpp
67 lines (49 loc) · 1.86 KB
/
mainwindow.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include "imageinsequence.h"
#include "imageseqmodel.h"
#include "imagereceptordelegate.h"
#include "QDropEvent"
#include "iostream"
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
// Initiate some data
ImageInSequence oneS1 = new ImageInSequence();
oneS1.image_file = "image1.jpg";
ImageInSequence oneS2 = new ImageInSequence();
oneS2.image_file = "image2.jpg";
ImageInSequence oneS3 = new ImageInSequence();
oneS3.image_file = "image3.jpg";
QList<ImageInSequence> *listSeq = new QList<ImageInSequence>();
listSeq->push_front(oneS1);
listSeq->push_front(oneS2);
listSeq->push_front(oneS3);
ImageSeqModel *seqModel = new ImageSeqModel(this,listSeq);
ImageReceptorDelegate *delegate = new ImageReceptorDelegate();
//Set data and item delegate to the listView
ui->listView->setModel(seqModel);
ui->listView->setItemDelegate(delegate);
//Set accept drag and drop
ui->listView->setSelectionMode(QAbstractItemView::SingleSelection);
ui->listView->setDragEnabled(true);
ui->listView->setAcceptDrops(true);
ui->listView->setDropIndicatorShown(true);
QList<ImageInSequence> *listSeq2 = new QList<ImageInSequence>();
ImageSeqModel *seqModel2 = new ImageSeqModel(this,listSeq2);
ImageReceptorDelegate *delegate2 = new ImageReceptorDelegate();
//Set data and item delegate to the listView
ui->listView_2->setModel(seqModel2);
ui->listView_2->setItemDelegate(delegate2);
//Set drag an drop to the second listview
ui->listView_2->setSelectionMode(QAbstractItemView::SingleSelection);
ui->listView_2->setDragEnabled(true);
ui->listView_2->setAcceptDrops(true);
ui->listView_2->setDropIndicatorShown(true);
}
MainWindow::~MainWindow()
{
delete ui;
}