Small fix to make unconnected devices still show up properly in the connection window
This commit is contained in:
@@ -151,16 +151,13 @@ QVariant CANConnectionModel::data(const QModelIndex &index, int role) const
|
|||||||
CANConnection *conn_p = getAtIdx(index.row(), busId);
|
CANConnection *conn_p = getAtIdx(index.row(), busId);
|
||||||
CANBus bus;
|
CANBus bus;
|
||||||
bool ret;
|
bool ret;
|
||||||
|
if (!conn_p) return QVariant();
|
||||||
ret = conn_p->getBusSettings(busId, bus);
|
ret = conn_p->getBusSettings(busId, bus);
|
||||||
bool isSocketCAN = (conn_p->getType() == CANCon::SOCKETCAN) ? true: false;
|
bool isSocketCAN = (conn_p->getType() == CANCon::SOCKETCAN) ? true: false;
|
||||||
|
|
||||||
//qDebug() << "ConnP: " << conn_p << " ret " << ret;
|
//qDebug() << "ConnP: " << conn_p << " ret " << ret;
|
||||||
|
|
||||||
if (role == Qt::DisplayRole) {
|
if (role == Qt::DisplayRole) {
|
||||||
if(!conn_p)
|
|
||||||
return QVariant();
|
|
||||||
|
|
||||||
if(!ret) return QVariant();
|
|
||||||
|
|
||||||
switch (index.column())
|
switch (index.column())
|
||||||
{
|
{
|
||||||
@@ -183,6 +180,7 @@ QVariant CANConnectionModel::data(const QModelIndex &index, int role) const
|
|||||||
else qDebug() << "Tried to show connection port but connection was NULL";
|
else qDebug() << "Tried to show connection port but connection was NULL";
|
||||||
break;
|
break;
|
||||||
case 3: //speed
|
case 3: //speed
|
||||||
|
if(!ret) return QVariant();
|
||||||
if (!isSocketCAN) return QString::number(bus.speed);
|
if (!isSocketCAN) return QString::number(bus.speed);
|
||||||
else return QString("N/A");
|
else return QString("N/A");
|
||||||
case 4: //Listen Only
|
case 4: //Listen Only
|
||||||
|
|||||||
Reference in New Issue
Block a user