8 #include <rosmon_msgs/State.h> 17 : QAbstractListModel(parent)
21 auto updateTimer =
new QTimer(
this);
22 connect(updateTimer, SIGNAL(timeout()), SLOT(
updateData()));
23 updateTimer->start(2000);
36 int row = index.row();
50 std::vector<ros::master::TopicInfo> topics;
56 for(
auto& topic : topics)
66 nodeList.prepend(
"[auto]");
71 while(oldIdx <
m_data.size() || newIdx < nodeList.size())
73 if(oldIdx ==
m_data.size())
75 beginInsertRows(QModelIndex(), oldIdx, oldIdx);
76 m_data.append(nodeList[newIdx]);
83 if(newIdx == nodeList.size())
85 beginRemoveRows(QModelIndex(), oldIdx, oldIdx);
91 auto oldT =
m_data[oldIdx];
92 auto newT = nodeList[newIdx];
101 beginRemoveRows(QModelIndex(), oldIdx, oldIdx);
107 beginInsertRows(QModelIndex(), oldIdx, oldIdx);
108 m_data.insert(oldIdx, newT);
ROSCPP_DECL std::string parentNamespace(const std::string &name)
QVariant data(const QModelIndex &index, int role) const override
ROSCPP_DECL bool getTopics(V_TopicInfo &topics)
ROSMonModel(QObject *parent=nullptr)
int rowCount(const QModelIndex &parent) const override