/
qgsgrassattributes.h
125 lines (92 loc) · 3.62 KB
/
qgsgrassattributes.h
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
115
116
117
118
119
120
121
122
123
124
125
/***************************************************************************
qgsgrassattributes.h - Edit vector attributes
-------------------
begin : July, 2004
copyright : (C) 2004 by Radim Blazek
email : blazek@itc.it
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef QGSGRASSATTRIBUTES_H
#define QGSGRASSATTRIBUTES_H
/* First attribute in the table is always field, second attribute is category */
#include "ui_qgsgrassattributesbase.h"
#include "qgsgrassedit.h"
class QgsGrassProvider;
class QgsGrassEdit;
class QEvent;
class QTableWidget;
class QgsGrassAttributesKeyPress : public QObject
{
Q_OBJECT
public:
QgsGrassAttributesKeyPress( QTableWidget *tab );
~QgsGrassAttributesKeyPress();
protected:
bool eventFilter( QObject *o, QEvent *e );
private:
QTableWidget *mTable;
};
/*! \class QgsGrassAttributes
* \brief GRASS attributes.
*
*/
class QgsGrassAttributes: public QDialog, private Ui::QgsGrassAttributesBase
{
Q_OBJECT
public:
//! Constructor
QgsGrassAttributes( QgsGrassEdit *edit, QgsGrassProvider *provider, int line,
QWidget * parent = 0, const char * name = 0,
Qt::WFlags f = Qt::Window );
//Qt::WFlags f = Qt::WStyle_Customize | Qt::WStyle_DialogBorder | Qt::WStyle_Title | Qt::WType_Dialog | Qt::WStyle_Tool);
//! Destructor
~QgsGrassAttributes();
void setRowReadOnly( QTableWidget* table, int col, bool ro );
//! Add tab for one field:cat pair, returns tab id
int addTab( const QString & label );
//! Set field
void setField( int tab, int field );
//! Set Category
void setCat( int tab, const QString & name, int cat );
//! Add attribute (but no category)
void addAttribute( int tab, const QString &name, const QString &value, const QString &type );
//! Add text in one row usually warning
void addTextRow( int tab, const QString &text );
//! Set Line (must be used if the line is rewritten)
void setLine( int line );
//! Reset buttons
void resetButtons();
public slots:
//! Update DB for current tab
void on_updateButton_clicked() { updateAttributes(); }
void updateAttributes();
//! Add new category
void on_newButton_clicked() { addCat(); }
void addCat();
//! Add new category
void on_deleteButton_clicked() { deleteCat(); }
void deleteCat();
//! Called if tab is changed
void tabChanged( int index );
//! Column size changed
void columnSizeChanged( int section, int oldSize, int newSize );
//! Remove all tabs
void clear();
//! Enable/disable buttons depending on the category mode
void setCategoryMode(QgsGrassEdit::CatMode mode, const QString &cat);
private:
//! Pointer to vector provider
QgsGrassProvider *mProvider;
QgsGrassEdit *mEdit;
int mLine;
void restorePosition( void );
void saveWindowLocation( void );
};
#endif // QGSGRASSATTRIBUTES_H