Skip to content

Commit

Permalink
Changed the behaviour of attribute editor as described into the discu…
Browse files Browse the repository at this point in the history
…ssion of ticker #289 to fix it.

git-svn-id: http://svn.osgeo.org/qgis/trunk@11331 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
rugginoso committed Aug 10, 2009
1 parent 5eb0467 commit 60a8f73
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/plugins/grass/qgsgrassattributes.cpp
Expand Up @@ -15,7 +15,6 @@
***************************************************************************/

#include "qgsgrassattributes.h"
#include "qgsgrassedit.h"
#include "qgsgrassprovider.h"

#include "qgslogger.h"
Expand Down Expand Up @@ -352,3 +351,12 @@ void QgsGrassAttributes::columnSizeChanged( int section, int oldSize, int newSiz
QgsDebugMsg( QString( "path = %1 newSize = %2" ).arg( path ).arg( newSize ) );
settings.setValue( path, newSize );
}

void QgsGrassAttributes::setCategoryMode(QgsGrassEdit::CatMode mode, const QString &cat)
{
if (mode == QgsGrassEdit::CAT_MODE_NOCAT || (mode == QgsGrassEdit::CAT_MODE_MANUAL && cat.isEmpty())){
newButton->setEnabled(false);
} else {
newButton->setEnabled(true);
}
}
4 changes: 4 additions & 0 deletions src/plugins/grass/qgsgrassattributes.h
Expand Up @@ -19,6 +19,7 @@
/* First attribute in the table is always field, second attribute is category */

#include "ui_qgsgrassattributesbase.h"
#include "qgsgrassedit.h"

class QgsGrassProvider;
class QgsGrassEdit;
Expand Down Expand Up @@ -105,6 +106,9 @@ class QgsGrassAttributes: public QDialog, private Ui::QgsGrassAttributesBase
//! 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;
Expand Down
2 changes: 2 additions & 0 deletions src/plugins/grass/qgsgrassedittools.cpp
Expand Up @@ -916,4 +916,6 @@ void QgsGrassEditAttributes::mouseClick( QgsPoint & point, Qt::MouseButton butto
e->mAttributes->show();
e->mAttributes->raise();
}

e->mAttributes->setCategoryMode(static_cast<QgsGrassEdit::CatMode>(e->mCatModeBox->currentIndex()), e->mCatEntry->text());
}

0 comments on commit 60a8f73

Please sign in to comment.