Remember the last selected instance and select it on startup
This commit is contained in:

committed by
Petr Mrázek

parent
eff38858ef
commit
8831856172
@ -362,7 +362,7 @@ int InstanceList::add(InstancePtr t)
|
||||
return count() - 1;
|
||||
}
|
||||
|
||||
InstancePtr InstanceList::getInstanceById(QString instId)
|
||||
InstancePtr InstanceList::getInstanceById(QString instId) const
|
||||
{
|
||||
QListIterator<InstancePtr> iter(m_instances);
|
||||
InstancePtr inst;
|
||||
@ -378,7 +378,12 @@ InstancePtr InstanceList::getInstanceById(QString instId)
|
||||
return iter.peekPrevious();
|
||||
}
|
||||
|
||||
int InstanceList::getInstIndex(BaseInstance *inst)
|
||||
QModelIndex InstanceList::getInstanceIndexById(const QString &id) const
|
||||
{
|
||||
return index(getInstIndex(getInstanceById(id).get()));
|
||||
}
|
||||
|
||||
int InstanceList::getInstIndex(BaseInstance *inst) const
|
||||
{
|
||||
for (int i = 0; i < m_instances.count(); i++)
|
||||
{
|
||||
|
@ -91,7 +91,9 @@ public:
|
||||
int add(InstancePtr t);
|
||||
|
||||
/// Get an instance by ID
|
||||
InstancePtr getInstanceById(QString id);
|
||||
InstancePtr getInstanceById(QString id) const;
|
||||
|
||||
QModelIndex getInstanceIndexById(const QString &id) const;
|
||||
signals:
|
||||
void dataIsInvalid();
|
||||
|
||||
@ -106,7 +108,7 @@ slots:
|
||||
void groupChanged();
|
||||
|
||||
private:
|
||||
int getInstIndex(BaseInstance *inst);
|
||||
int getInstIndex(BaseInstance *inst) const;
|
||||
|
||||
protected:
|
||||
QString m_instDir;
|
||||
|
Reference in New Issue
Block a user