1
1
/* **************************************************************************
2
- BeataDialog.cpp
3
- BEtter Attribute TAble
2
+ QgsAttributeTableDialog.cpp
4
3
-------------------
5
4
date : Feb 2009
6
5
copyright : Vita Cizek
17
16
18
17
#include < QtGui>
19
18
20
- #include " BeataDialog .h"
21
- #include " BeataModel .h"
22
- #include " BeataView .h"
19
+ #include " qgsattributetabledialog .h"
20
+ #include " qgsattributetablemodel .h"
21
+ #include " qgsattributetableview .h"
23
22
24
23
#include < qgsapplication.h>
25
24
#include < qgsvectordataprovider.h>
32
31
#include " qgslogger.h"
33
32
34
33
35
- class QBeataTableDock : public QDockWidget
34
+ class QgsAttributeTableTableDock : public QDockWidget
36
35
{
37
36
public:
38
- QBeataTableDock ( const QString & title, QWidget * parent = 0 , Qt::WindowFlags flags = 0 )
37
+ QgsAttributeTableTableDock ( const QString & title, QWidget * parent = 0 , Qt::WindowFlags flags = 0 )
39
38
: QDockWidget( title, parent, flags )
40
39
{
41
40
setObjectName ( " AttributeTable" ); // set object name so the position can be saved
@@ -48,7 +47,7 @@ class QBeataTableDock : public QDockWidget
48
47
};
49
48
50
49
51
- BeataDialog::BeataDialog ( QgsVectorLayer *theLayer, QWidget *parent, Qt::WindowFlags flags )
50
+ QgsAttributeTableDialog::QgsAttributeTableDialog ( QgsVectorLayer *theLayer, QWidget *parent, Qt::WindowFlags flags )
52
51
: QDialog( parent, flags ), mDock( NULL )
53
52
{
54
53
mLayer = theLayer;
@@ -61,8 +60,8 @@ BeataDialog::BeataDialog( QgsVectorLayer *theLayer, QWidget *parent, Qt::WindowF
61
60
restoreGeometry ( settings.value ( " /Windows/BetterAttributeTable/geometry" ).toByteArray () );
62
61
63
62
mView ->setLayer ( mLayer );
64
- mFilterModel = ( BeataFilterModel * ) mView ->model ();
65
- mModel = ( BeataModel * )(( BeataFilterModel * )mView ->model () )->sourceModel ();
63
+ mFilterModel = ( QgsAttributeTableFilterModel * ) mView ->model ();
64
+ mModel = ( QgsAttributeTableModel * )(( QgsAttributeTableFilterModel * )mView ->model () )->sourceModel ();
66
65
67
66
mQuery = query;
68
67
mColumnBox = columnBox;
@@ -72,7 +71,7 @@ BeataDialog::BeataDialog( QgsVectorLayer *theLayer, QWidget *parent, Qt::WindowF
72
71
bool myDockFlag = mySettings.value ( " /qgis/dockAttributeTable" , false ).toBool ();
73
72
if ( myDockFlag )
74
73
{
75
- mDock = new QBeataTableDock ( tr ( " Attribute table - %1" ).arg ( mLayer ->name () ), QgisApp::instance () );
74
+ mDock = new QgsAttributeTableTableDock ( tr ( " Attribute table - %1" ).arg ( mLayer ->name () ), QgisApp::instance () );
76
75
mDock ->setAllowedAreas ( Qt::BottomDockWidgetArea | Qt::TopDockWidgetArea );
77
76
mDock ->setWidget ( this );
78
77
QgisApp::instance ()->addDockWidget ( Qt::BottomDockWidgetArea, mDock );
@@ -111,11 +110,11 @@ BeataDialog::BeataDialog( QgsVectorLayer *theLayer, QWidget *parent, Qt::WindowF
111
110
updateSelectionFromLayer ();
112
111
}
113
112
114
- BeataDialog ::~BeataDialog ()
113
+ QgsAttributeTableDialog ::~QgsAttributeTableDialog ()
115
114
{
116
115
}
117
116
118
- void BeataDialog ::closeEvent ( QCloseEvent* event )
117
+ void QgsAttributeTableDialog ::closeEvent ( QCloseEvent* event )
119
118
{
120
119
QDialog::closeEvent ( event );
121
120
@@ -127,7 +126,7 @@ void BeataDialog::closeEvent( QCloseEvent* event )
127
126
}
128
127
129
128
130
- QIcon BeataDialog ::getThemeIcon ( const QString theName )
129
+ QIcon QgsAttributeTableDialog ::getThemeIcon ( const QString theName )
131
130
{
132
131
// copied from QgisApp::getThemeIcon. To be removed when merged to SVN
133
132
@@ -149,12 +148,12 @@ QIcon BeataDialog::getThemeIcon( const QString theName )
149
148
}
150
149
}
151
150
152
- void BeataDialog ::showAdvanced ()
151
+ void QgsAttributeTableDialog ::showAdvanced ()
153
152
{
154
153
mMenuActions ->exec ( QCursor::pos () );
155
154
}
156
155
157
- void BeataDialog ::on_mSelectedToTopButton_clicked ()
156
+ void QgsAttributeTableDialog ::on_mSelectedToTopButton_clicked ()
158
157
{
159
158
int freeIndex = 0 ;
160
159
@@ -194,35 +193,35 @@ void BeataDialog::on_mSelectedToTopButton_clicked()
194
193
updateSelection ();
195
194
}
196
195
197
- void BeataDialog ::on_mCopySelectedRowsButton_clicked ()
196
+ void QgsAttributeTableDialog ::on_mCopySelectedRowsButton_clicked ()
198
197
{
199
198
QgisApp::instance ()->editCopy ( mLayer );
200
199
}
201
200
202
- void BeataDialog ::on_mZoomMapToSelectedRowsButton_clicked ()
201
+ void QgsAttributeTableDialog ::on_mZoomMapToSelectedRowsButton_clicked ()
203
202
{
204
203
QgisApp::instance ()->zoomToSelected ();
205
204
}
206
205
207
- void BeataDialog ::on_mInvertSelectionButton_clicked ()
206
+ void QgsAttributeTableDialog ::on_mInvertSelectionButton_clicked ()
208
207
{
209
208
mLayer ->invertSelection ();
210
209
}
211
210
212
- void BeataDialog ::on_mRemoveSelectionButton_clicked ()
211
+ void QgsAttributeTableDialog ::on_mRemoveSelectionButton_clicked ()
213
212
{
214
213
mLayer ->removeSelection ();
215
214
}
216
215
217
- void BeataDialog ::on_cbxShowSelectedOnly_toggled ( bool theFlag )
216
+ void QgsAttributeTableDialog ::on_cbxShowSelectedOnly_toggled ( bool theFlag )
218
217
{
219
218
mFilterModel ->mHideUnselected = theFlag;
220
219
mFilterModel ->invalidate ();
221
220
// TODO: weird
222
221
// mModel->changeLayout();
223
222
}
224
223
225
- void BeataDialog ::columnBoxInit ()
224
+ void QgsAttributeTableDialog ::columnBoxInit ()
226
225
{
227
226
QgsFieldMap fieldMap = mLayer ->dataProvider ()->fields ();
228
227
QgsFieldMap::Iterator it = fieldMap.begin ();
@@ -231,7 +230,7 @@ void BeataDialog::columnBoxInit()
231
230
mColumnBox ->addItem ( it.value ().name () );
232
231
}
233
232
234
- int BeataDialog ::columnBoxColumnId ()
233
+ int QgsAttributeTableDialog ::columnBoxColumnId ()
235
234
{
236
235
QgsFieldMap fieldMap = mLayer ->dataProvider ()->fields ();
237
236
QgsFieldMap::Iterator it = fieldMap.begin ();
@@ -243,7 +242,7 @@ int BeataDialog::columnBoxColumnId()
243
242
return 0 ;
244
243
}
245
244
246
- void BeataDialog ::updateSelection ()
245
+ void QgsAttributeTableDialog ::updateSelection ()
247
246
{
248
247
QModelIndex index ;
249
248
mView ->setSelectionMode ( QAbstractItemView::MultiSelection );
@@ -272,7 +271,7 @@ void BeataDialog::updateSelection()
272
271
*/
273
272
}
274
273
275
- void BeataDialog ::updateRowSelection ( int index )
274
+ void QgsAttributeTableDialog ::updateRowSelection ( int index )
276
275
{
277
276
// map index to filter model
278
277
// index = mFilterModel->mapFromSource(mModel->index(index, 0)).row();
@@ -326,7 +325,7 @@ void BeataDialog::updateRowSelection( int index )
326
325
}
327
326
328
327
// fast row deselection needed
329
- void BeataDialog ::updateRowSelection ( int first, int last, bool startNewSelection )
328
+ void QgsAttributeTableDialog ::updateRowSelection ( int first, int last, bool startNewSelection )
330
329
{
331
330
disconnect ( mLayer , SIGNAL ( selectionChanged () ), this , SLOT ( updateSelectionFromLayer () ) );
332
331
@@ -398,14 +397,14 @@ void BeataDialog::updateRowSelection( int first, int last, bool startNewSelectio
398
397
connect ( mLayer , SIGNAL ( selectionChanged () ), this , SLOT ( updateSelectionFromLayer () ) );
399
398
}
400
399
401
- void BeataDialog ::updateSelectionFromLayer ()
400
+ void QgsAttributeTableDialog ::updateSelectionFromLayer ()
402
401
{
403
402
QgsDebugMsg ( " updateFromLayer" );
404
403
mSelectedFeatures = mLayer ->selectedFeaturesIds ();
405
404
updateSelection ();
406
405
}
407
406
408
- void BeataDialog ::doSearch ( QString searchString )
407
+ void QgsAttributeTableDialog ::doSearch ( QString searchString )
409
408
{
410
409
// parse search string and build parsed tree
411
410
QgsSearchString search;
@@ -462,7 +461,7 @@ void BeataDialog::doSearch( QString searchString )
462
461
QMessageBox::information ( this , tr ( " Search results" ), str );
463
462
}
464
463
465
- void BeataDialog ::search ()
464
+ void QgsAttributeTableDialog ::search ()
466
465
{
467
466
468
467
QString str = mColumnBox ->currentText ();
@@ -483,7 +482,7 @@ void BeataDialog::search()
483
482
doSearch ( str );
484
483
}
485
484
486
- void BeataDialog ::on_mAdvancedSearchButton_clicked ()
485
+ void QgsAttributeTableDialog ::on_mAdvancedSearchButton_clicked ()
487
486
{
488
487
QgsSearchQueryBuilder dlg ( mLayer , this );
489
488
dlg.setSearchString ( mQuery ->displayText () );
@@ -492,12 +491,12 @@ void BeataDialog::on_mAdvancedSearchButton_clicked()
492
491
doSearch ( dlg.searchString () );
493
492
}
494
493
495
- void BeataDialog ::on_mToggleEditingButton_toggled ()
494
+ void QgsAttributeTableDialog ::on_mToggleEditingButton_toggled ()
496
495
{
497
496
emit editingToggled ( mLayer );
498
497
}
499
498
500
- void BeataDialog ::editingToggled ()
499
+ void QgsAttributeTableDialog ::editingToggled ()
501
500
{
502
501
mToggleEditingButton ->setChecked ( mLayer ->isEditable () );
503
502
@@ -509,19 +508,19 @@ void BeataDialog::editingToggled()
509
508
}
510
509
511
510
// not used now
512
- void BeataDialog ::startEditing ()
511
+ void QgsAttributeTableDialog ::startEditing ()
513
512
{
514
513
mLayer ->startEditing ();
515
514
}
516
515
517
516
// not used now
518
- void BeataDialog ::submit ()
517
+ void QgsAttributeTableDialog ::submit ()
519
518
{
520
519
mLayer ->commitChanges ();
521
520
}
522
521
523
522
// not used now
524
- void BeataDialog ::revert ()
523
+ void QgsAttributeTableDialog ::revert ()
525
524
{
526
525
mLayer ->rollBack ();
527
526
mModel ->revert ();
0 commit comments