8 #include <rosmon_msgs/State.h> 19 : QAbstractListModel(parent)
23 auto updateTimer =
new QTimer(
this);
24 connect(updateTimer, SIGNAL(timeout()), SLOT(
updateData()));
25 updateTimer->start(2000);
38 int row = index.row();
52 std::vector<ros::master::TopicInfo> topics;
58 for(
auto& topic : topics)
66 std::sort(nodeList.begin(), nodeList.end());
68 nodeList.prepend(
"[auto]");
73 while(oldIdx <
m_data.size() || newIdx < nodeList.size())
75 if(oldIdx ==
m_data.size())
77 beginInsertRows(QModelIndex(), oldIdx, oldIdx);
78 m_data.append(nodeList[newIdx]);
85 if(newIdx == nodeList.size())
87 beginRemoveRows(QModelIndex(), oldIdx, oldIdx);
93 auto oldT =
m_data[oldIdx];
94 auto newT = nodeList[newIdx];
103 beginRemoveRows(QModelIndex(), oldIdx, oldIdx);
109 beginInsertRows(QModelIndex(), oldIdx, oldIdx);
110 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