+ fixes #0001484: Do not sort properties in alphabetical order

This commit is contained in:
wmayer
2014-03-21 15:04:35 +01:00
parent 1c9c0d2e20
commit 2bfb120ff7
6 changed files with 75 additions and 33 deletions

View File

@@ -89,7 +89,7 @@ void PropertyEditor::commitData (QWidget * editor)
committing = false;
if (delaybuild) {
delaybuild = false;
propertyModel->buildUp(std::map<std::string, std::vector<App::Property*> >());
propertyModel->buildUp(PropertyModel::PropertyList());
}
}
@@ -126,7 +126,7 @@ void PropertyEditor::drawBranches(QPainter *painter, const QRect &rect, const QM
//painter->setPen(savedPen);
}
void PropertyEditor::buildUp(const std::map<std::string, std::vector<App::Property*> >& props)
void PropertyEditor::buildUp(const PropertyModel::PropertyList& props)
{
if (committing) {
Base::Console().Warning("While committing the data to the property the selection has changed.\n");

View File

@@ -31,6 +31,7 @@
#include <QTreeView>
#include "PropertyItem.h"
#include "PropertyModel.h"
namespace App {
class Property;
@@ -49,7 +50,7 @@ public:
~PropertyEditor();
/** Builds up the list view with the properties. */
void buildUp(const std::map<std::string, std::vector<App::Property*> >& props);
void buildUp(const PropertyModel::PropertyList& props);
void setAutomaticDocumentUpdate(bool);
bool isAutomaticDocumentUpdate(bool) const;

View File

@@ -199,15 +199,14 @@ QModelIndex PropertyModel::propertyIndexFromPath(const QStringList& path) const
return parent;
}
void PropertyModel::buildUp(const std::map<std::string, std::vector<App::Property*> >& props)
void PropertyModel::buildUp(const PropertyModel::PropertyList& props)
{
// fill up the listview with the properties
rootItem->reset();
// sort the properties into their groups
std::map<std::string, std::vector<std::vector<App::Property*> > > propGroup;
std::map<std::string, std::vector<App::Property*> >
::const_iterator jt;
PropertyModel::PropertyList::const_iterator jt;
for (jt = props.begin(); jt != props.end(); ++jt) {
App::Property* prop = jt->second.front();
const char* group = prop->getGroup();

View File

@@ -41,6 +41,8 @@ class PropertyModel : public QAbstractItemModel
Q_OBJECT
public:
typedef std::vector< std::pair< std::string, std::vector<App::Property*> > > PropertyList;
PropertyModel(QObject* parent);
virtual ~PropertyModel();
@@ -54,7 +56,7 @@ public:
int rowCount (const QModelIndex & parent = QModelIndex()) const;
QVariant headerData (int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
bool setHeaderData (int section, Qt::Orientation orientation, const QVariant & value, int role = Qt::EditRole);
void buildUp(const std::map<std::string, std::vector<App::Property*> >& props);
void buildUp(const PropertyList& props);
QStringList propertyPathFromIndex(const QModelIndex&) const;
QModelIndex propertyIndexFromPath(const QStringList&) const;