Skip to content
Snippets Groups Projects
Commit a92dd7fc authored by Emmanuel Lepage Vallee's avatar Emmanuel Lepage Vallee
Browse files

[ #51339 ] Correctly initialize the currentVideoDevice index

parent c7870ecd
No related branches found
No related tags found
No related merge requests found
......@@ -180,7 +180,8 @@ int VideoDeviceModel::activeIndex() const
ExtendedVideoDeviceModel* ExtendedVideoDeviceModel::m_spInstance = nullptr;
ExtendedVideoDeviceModel::ExtendedVideoDeviceModel() : QAbstractListModel(QCoreApplication::instance())
ExtendedVideoDeviceModel::ExtendedVideoDeviceModel() : QAbstractListModel(QCoreApplication::instance()),
m_CurrentSelection(-1)
{
m_Display.rect = QRect(0,0,0,0);
}
......@@ -274,6 +275,7 @@ void ExtendedVideoDeviceModel::switchTo(const int idx)
VideoDeviceModel::instance()->index(idx-ExtendedDeviceList::__COUNT,0).data(Qt::DisplayRole).toString());
break;
};
m_CurrentSelection = (ExtendedDeviceList) idx;
}
void ExtendedVideoDeviceModel::switchTo(VideoDevice* device)
......@@ -294,6 +296,14 @@ VideoDevice* ExtendedVideoDeviceModel::deviceAt(const QModelIndex& idx) const
};
}
int ExtendedVideoDeviceModel::activeIndex() const
{
if (m_CurrentSelection == -1) {
return ExtendedDeviceList::__COUNT + VideoDeviceModel::instance()->activeIndex();
}
return m_CurrentSelection;
}
void ExtendedVideoDeviceModel::setFile(const QUrl& url)
{
m_CurrentFile = url;
......
......@@ -46,6 +46,8 @@ public:
VideoDevice* deviceAt(const QModelIndex& idx) const;
int activeIndex() const;
//Singleton
static ExtendedVideoDeviceModel* instance();
private:
......@@ -67,6 +69,7 @@ private:
static ExtendedVideoDeviceModel* m_spInstance;
QUrl m_CurrentFile;
Display m_Display;
int m_CurrentSelection;
public Q_SLOTS:
void switchTo(const QModelIndex& idx);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment