-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmainwindow.h
More file actions
114 lines (91 loc) · 2.5 KB
/
Copy pathmainwindow.h
File metadata and controls
114 lines (91 loc) · 2.5 KB
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include "struct.h"
#include "neuron.h"
#include "string.h"
#include "struct3d.h"
#include <QSqlDatabase>
#include <QSqlError>
#include <QSqlQuery>
#include <QSqlRecord>
#include <QStringList>
#include <QVariant>
#include <configwindow.h>
#include <QTableWidgetItem>
#include <QClipboard>
#include <QTableWidget>
#include <QKeyEvent>
#include <QApplication>
class plotter;
class QTableWidgetItem;
class QTableWidget;
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = 0);
bool connectDB();
~MainWindow();
public slots:
void NewStructure();
void New3dStructure();
void EditStructure();
void about();
void createNet();
void saveNet();
void openNet();
void runTest();
void runFastTest();
void createInputs();
void showDistribInfo();
void updateDiagramms();
void giveProto(QTableWidgetItem * item);
private:
Ui::MainWindow *ui;
AbstractStructure *cform;
net_hop * net;
plotter * plotWidget;
plotter * hamil_graph;
configWindow * configWin;
QTableWidget * distrInfo;
void toLog(QString message);
QSqlDatabase db;
void reLayout();
QTableWidget * protoInfo;
};
bool mysort (const QPointF & d1, const QPointF & d2);
bool mysort1 (const QPoint & d1, const QPoint & d2);
QString toBinary(long long n, int digitNum);
void makeInputFile(long n);
class QTableWidgetLongItem : public QTableWidgetItem
{
public:
QTableWidgetLongItem(QString text): QTableWidgetItem(text){};
bool operator< ( const QTableWidgetItem& other ) const {return this->text().toLongLong()<other.text().toLongLong();};
};
class TableWin : public QTableWidget
{
private:
void keyPressEvent(QKeyEvent *event){
{
qDebug()<<"ctrl+C";
if (!(event->matches(QKeySequence::Copy) )) return;
QString cbStr;
QModelIndexList list = this->selectionModel()->selectedIndexes();
int i, j, firstRow, lastRow, rowCount;
if( list.isEmpty() ) return;
firstRow = list.first().row(); lastRow = list.last().row();
rowCount = lastRow - firstRow + 1;
for(i = 0; i < rowCount; ++i, cbStr += '\n')
for(j = i; j < list.count(); j += rowCount, cbStr += '\t')
cbStr += this->model()->data(list[ j ], Qt::EditRole).toString();
QApplication::clipboard()->setText(cbStr);
return;
}
}
};
#endif // MAINWINDOW_H