forked from teamnwah/openmw-tes3coop
Sort icons in the DataDisplayDelegate
This commit is contained in:
parent
78a2725169
commit
5c16ce1d36
2 changed files with 24 additions and 3 deletions
|
@ -32,7 +32,7 @@ void CSVWorld::DataDisplayDelegate::buildPixmaps ()
|
||||||
|
|
||||||
while (it != mIcons.end())
|
while (it != mIcons.end())
|
||||||
{
|
{
|
||||||
mPixmaps.push_back (std::make_pair (it->first, it->second.pixmap (mIconSize) ) );
|
mPixmaps.push_back (std::make_pair (it->mValue, it->mIcon.pixmap (mIconSize) ) );
|
||||||
++it;
|
++it;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -142,9 +142,23 @@ void CSVWorld::DataDisplayDelegate::settingChanged (const CSMPrefs::Setting *set
|
||||||
|
|
||||||
void CSVWorld::DataDisplayDelegateFactory::add (int enumValue, const QString& enumName, const QString& iconFilename)
|
void CSVWorld::DataDisplayDelegateFactory::add (int enumValue, const QString& enumName, const QString& iconFilename)
|
||||||
{
|
{
|
||||||
mIcons.push_back (std::make_pair(enumValue, QIcon(iconFilename)));
|
|
||||||
EnumDelegateFactory::add(enumValue, enumName);
|
EnumDelegateFactory::add(enumValue, enumName);
|
||||||
|
|
||||||
|
Icon icon;
|
||||||
|
icon.mValue = enumValue;
|
||||||
|
icon.mName = enumName;
|
||||||
|
icon.mIcon = QIcon(iconFilename);
|
||||||
|
|
||||||
|
for (auto it=mIcons.begin(); it!=mIcons.end(); ++it)
|
||||||
|
{
|
||||||
|
if (it->mName > enumName)
|
||||||
|
{
|
||||||
|
mIcons.insert(it, icon);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
mIcons.push_back(icon);
|
||||||
}
|
}
|
||||||
|
|
||||||
CSVWorld::CommandDelegate *CSVWorld::DataDisplayDelegateFactory::makeDelegate (
|
CSVWorld::CommandDelegate *CSVWorld::DataDisplayDelegateFactory::makeDelegate (
|
||||||
|
|
|
@ -11,11 +11,18 @@ namespace CSMPrefs
|
||||||
|
|
||||||
namespace CSVWorld
|
namespace CSVWorld
|
||||||
{
|
{
|
||||||
|
struct Icon
|
||||||
|
{
|
||||||
|
int mValue;
|
||||||
|
QIcon mIcon;
|
||||||
|
QString mName;
|
||||||
|
};
|
||||||
|
|
||||||
class DataDisplayDelegate : public EnumDelegate
|
class DataDisplayDelegate : public EnumDelegate
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
typedef std::vector < std::pair < int, QIcon > > IconList;
|
typedef std::vector<Icon> IconList;
|
||||||
typedef std::vector<std::pair<int, QString> > ValueList;
|
typedef std::vector<std::pair<int, QString> > ValueList;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
Loading…
Reference in a new issue