-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathUndoStackMasker.cpp
98 lines (86 loc) · 2.7 KB
/
UndoStackMasker.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#include "UndoStackMasker.h"
#include "QPushButton"
#include "QMouseEvent"
#include "qevent.h"
#include "QLayout"
#include "QApplication"
#include "QGraphicsScene"
#include "QScrollBar"
#include "QPainter"
#include "computer.h"
#include "QPalette"
//#include <QTest>
//#include "qtest
UndoStackMasker::UndoStackMasker(HistoryHandler* historian,QWidget *parent) : QWidget(parent)
{
Historian = historian;
QSV = new UndoStackView(Historian,this);
QSV->setVerticalScrollBar(new QScrollBar(Qt::Vertical));
QSV->setVerticalScrollBarPolicy(Qt::ScrollBarPolicy::ScrollBarAlwaysOn);
Middleman = new QWidget(this);
Middleman->setVisible(true);
QSV->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding);
connect(Historian,&HistoryHandler::indexChanged,this,&UndoStackMasker::updateSize);
connect(Historian,&HistoryHandler::indexChanged,this,&UndoStackMasker::signalFlare);
connect(Historian,&HistoryHandler::indexChanged,this,&UndoStackMasker::finishedDoing);
connect(QSV,&UndoStackView::pressed,this,&UndoStackMasker::pres);
// connect(QSV,&QUndoView::,this,&UndoStackMasker::startDoing);
// QSV->
}
void UndoStackMasker::pres(const QModelIndex &mold)
{
// if(mold)
// {
qDebug(QString().setNum(mold.row()).toLocal8Bit());
// }
// else
// {
// qDebug("No index");
// }
}
void UndoStackMasker::updateSize()
{
Middleman->resize(constructSize());
}
void UndoStackMasker::resizeEvent(QResizeEvent *event)
{
QWidget::resizeEvent(event);
}
const QSize UndoStackMasker::constructSize()
{
QSize* out = new QSize();
qDebug("Phase 2 " + QString().setNum(QSV->viewport()->width()).toLocal8Bit());
out->setWidth(this->width());
out->setHeight(this->height());
const QSize conout = QSize(out->width(),out->height());
qDebug(QString().setNum(conout.height()).toLocal8Bit());
qDebug(QString().setNum(conout.width()).toLocal8Bit());
delete(out);
return conout;
}
void UndoStackMasker::mousePressEvent(QMouseEvent *event)
{
MASK
QMouseEvent pressEvent(QEvent::MouseButtonPress,event->pos(),Qt::LeftButton,Qt::LeftButton,Qt::NoModifier);
QApplication::sendEvent(QSV->viewport(), &pressEvent);
UNMASK
}
void UndoStackMasker::startDoing()
{
MASK
qDebug("HHHHH");
}
void UndoStackMasker::finishedDoing()
{
UNMASK
IFNOMASK(Computer::getDefault()->update();)
}
void UndoStackMasker::mouseReleaseEvent(QMouseEvent *event)
{
QMouseEvent releaseEvent(QEvent::MouseButtonRelease,event->pos(),Qt::LeftButton,Qt::LeftButton,Qt::NoModifier);
QApplication::sendEvent(QSV->viewport(), &releaseEvent);
}
void UndoStackMasker::mouseMoveEvent(QMouseEvent *event)
{
// QApplication::sendEvent(QSV->viewport(),event);
}