| 1 |
#ifndef DROPTABLEWIDGET_H |
| 2 |
#define DROPTABLEWIDGET_H |
| 3 |
|
| 4 |
#include <QTableWidget> |
| 5 |
#include <QtWidgets> |
| 6 |
|
| 7 |
#include "utilvago.h" |
| 8 |
|
| 9 |
|
| 10 |
//Used in swapPositions function, for switching orders and maintain the disabled style |
| 11 |
struct tableRowProperties{ //No need for typedef in c++ :) |
| 12 |
QStringList cells; |
| 13 |
bool isDisabled; |
| 14 |
|
| 15 |
tableRowProperties(){ |
| 16 |
cells = QStringList(); //initialize the list on the constructor |
| 17 |
isDisabled=false; //if you don't initialize a variable at c++ it is random assigned! |
| 18 |
} |
| 19 |
}; |
| 20 |
|
| 21 |
class QMimeData; |
| 22 |
|
| 23 |
class DropTableWidget : public QTableWidget { |
| 24 |
|
| 25 |
Q_OBJECT |
| 26 |
|
| 27 |
public: |
| 28 |
DropTableWidget(QWidget *parent = 0, |
| 29 |
QBrush _disabledBackStyle = QPalette().brush(QPalette::Disabled,QPalette::Base), |
| 30 |
QBrush _disabledTextStyle = QPalette().brush(QPalette::Disabled,QPalette::WindowText)); |
| 31 |
|
| 32 |
const QBrush disabledBackStyle; |
| 33 |
const QBrush disabledTextStyle; |
| 34 |
|
| 35 |
void swapPositions(QList<int> rowsSelected, int numUnitsToMove); |
| 36 |
void resetStyleWidgetItem(QTableWidgetItem *currentItem); |
| 37 |
void setDisableStyleWidgetItem(QTableWidgetItem *currentItem); |
| 38 |
void updateTableToolTips(int row); |
| 39 |
QString getFileAbsolute(int row); |
| 40 |
QString getOutputAbsolute(int row); |
| 41 |
|
| 42 |
public slots: |
| 43 |
void clear(); |
| 44 |
|
| 45 |
signals: |
| 46 |
void changed(const QMimeData *mimeData = 0); |
| 47 |
void dropped(DropTableWidget *myTable, QStringList pathList); |
| 48 |
QString getTypeConversion(DropTableWidget *thisTable); |
| 49 |
void changeToCurrentSettings(int rows[], DropTableWidget* thisTable); |
| 50 |
void dtContextMenu(DropTableWidget* thisTable, QContextMenuEvent *event); |
| 51 |
|
| 52 |
protected: |
| 53 |
void dragEnterEvent(QDragEnterEvent *event); |
| 54 |
void dragMoveEvent(QDragMoveEvent *event); |
| 55 |
void dragLeaveEvent(QDragLeaveEvent *event); |
| 56 |
void dropEvent(QDropEvent *event); |
| 57 |
void contextMenuEvent(QContextMenuEvent * event); |
| 58 |
|
| 59 |
private: |
| 60 |
QTableWidget *tablewidget; |
| 61 |
}; |
| 62 |
|
| 63 |
#endif // DROPTABLEWIDGET_H |