Skip to content

Commit 388440e

Browse files
author
rugginoso
committed
Changed the behaviour of attribute editor as described into the discussion of ticker #289 to fix it.
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@11331 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent d143e5f commit 388440e

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed

src/plugins/grass/qgsgrassattributes.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
***************************************************************************/
1616

1717
#include "qgsgrassattributes.h"
18-
#include "qgsgrassedit.h"
1918
#include "qgsgrassprovider.h"
2019

2120
#include "qgslogger.h"
@@ -352,3 +351,12 @@ void QgsGrassAttributes::columnSizeChanged( int section, int oldSize, int newSiz
352351
QgsDebugMsg( QString( "path = %1 newSize = %2" ).arg( path ).arg( newSize ) );
353352
settings.setValue( path, newSize );
354353
}
354+
355+
void QgsGrassAttributes::setCategoryMode(QgsGrassEdit::CatMode mode, const QString &cat)
356+
{
357+
if (mode == QgsGrassEdit::CAT_MODE_NOCAT || (mode == QgsGrassEdit::CAT_MODE_MANUAL && cat.isEmpty())){
358+
newButton->setEnabled(false);
359+
} else {
360+
newButton->setEnabled(true);
361+
}
362+
}

src/plugins/grass/qgsgrassattributes.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
/* First attribute in the table is always field, second attribute is category */
2020

2121
#include "ui_qgsgrassattributesbase.h"
22+
#include "qgsgrassedit.h"
2223

2324
class QgsGrassProvider;
2425
class QgsGrassEdit;
@@ -105,6 +106,9 @@ class QgsGrassAttributes: public QDialog, private Ui::QgsGrassAttributesBase
105106
//! Remove all tabs
106107
void clear();
107108

109+
//! Enable/disable buttons depending on the category mode
110+
void setCategoryMode(QgsGrassEdit::CatMode mode, const QString &cat);
111+
108112
private:
109113
//! Pointer to vector provider
110114
QgsGrassProvider *mProvider;

src/plugins/grass/qgsgrassedittools.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -916,4 +916,6 @@ void QgsGrassEditAttributes::mouseClick( QgsPoint & point, Qt::MouseButton butto
916916
e->mAttributes->show();
917917
e->mAttributes->raise();
918918
}
919+
920+
e->mAttributes->setCategoryMode(static_cast<QgsGrassEdit::CatMode>(e->mCatModeBox->currentIndex()), e->mCatEntry->text());
919921
}

0 commit comments

Comments
 (0)