forked from AustralianSynchrotron/ctgui
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpositionlist.h
More file actions
87 lines (63 loc) · 2.07 KB
/
positionlist.h
File metadata and controls
87 lines (63 loc) · 2.07 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
#ifndef POSITIONLIST_H
#define POSITIONLIST_H
#include <QWidget>
#include <QSettings>
#include <QStyledItemDelegate>
#include <qcamotorgui.h>
#include <QTableWidget>
// to be used for the doble numbers in the list of positions
// in the irregular step serial scans.
class NTableDelegate : public QStyledItemDelegate {
Q_OBJECT;
public:
NTableDelegate(QObject* parent);
QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const;
void setEditorData(QWidget *editor, const QModelIndex &index) const;
void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const;
void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const;
};
// QTableWidget with support for copy and paste added
// Here copy and paste can copy/paste the entire grid of cells
class QTableWidgetWithCopyPaste : public QTableWidget
{
public:
QTableWidgetWithCopyPaste(int rows, int columns, QWidget *parent) :
QTableWidget(rows, columns, parent)
{};
QTableWidgetWithCopyPaste(QWidget *parent) :
QTableWidget(parent)
{};
private:
void copy();
void paste();
protected:
virtual void keyPressEvent(QKeyEvent * event);
};
#include "ui_positionlist.h"
class PositionList : public QWidget
{
Q_OBJECT;
private:
bool allOK;
bool freezListUpdates;
public:
Ui::PositionList * const ui; // do not change outside public only to store
QCaMotorGUI * motui; // do not change outside public only to move and store
explicit PositionList(QWidget *parent = 0);
~PositionList();
void putMotor(QCaMotorGUI * motor);
void putLabel(const QString & lab) {ui->label->setText(lab);}
bool amOK() {return allOK;}
void freezList(bool fz) {freezListUpdates=fz;}
void emphasizeRow(int row=-1);
double position(int row) const {return ui->list->item(row, 0)->text().toDouble();}
private slots:
void updateAmOK();
void updateNoF();
void moveMotorHere();
void getMotorPosition();
signals:
void amOKchanged(bool);
void parameterChanged();
};
#endif // POSITIONLIST_H