diff --git a/src/sofa/qt/GraphListenerQListView.cpp b/src/sofa/qt/GraphListenerQListView.cpp index cd0a857..0ffbcf5 100644 --- a/src/sofa/qt/GraphListenerQListView.cpp +++ b/src/sofa/qt/GraphListenerQListView.cpp @@ -317,9 +317,19 @@ void setMessageIconFrom(QTreeWidgetItem* item, Base* object) const bool haveWarnings = object->countLoggedMessages({Message::Warning})!=0; const bool haveErrors = object->countLoggedMessages({Message::Error, Message::Fatal})!=0; + auto messages = object->getLoggedMessages(); + std::stringstream tmp; + for(auto message : messages) + { + tmp << message.messageAsString(); + } + const QPixmap* pix = getPixmap(object, haveInfos, haveWarnings, haveErrors); - if (pix) + if (pix){ item->setIcon(0, QIcon(*pix)); + if(haveWarnings || haveErrors) + item->setToolTip(0, QString::fromStdString(tmp.str())); + } } ObjectStateListener::ObjectStateListener( diff --git a/src/sofa/qt/QSofaListView.cpp b/src/sofa/qt/QSofaListView.cpp index baeb9db..d5eeea1 100644 --- a/src/sofa/qt/QSofaListView.cpp +++ b/src/sofa/qt/QSofaListView.cpp @@ -84,6 +84,8 @@ QSofaListView::QSofaListView(const SofaListViewAttribute& attribute, connect(this, &QSofaListView::customContextMenuRequested ,this, &QSofaListView::RunSofaRightClicked); connect(this, &QSofaListView::itemDoubleClicked, this, &QSofaListView::RunSofaDoubleClicked); connect(this, &QSofaListView::itemClicked, this, [&](QTreeWidgetItem *item, int){ updateMatchingObjectmodel(item); }); + + setToolTipDuration(0.0); } QSofaListView::~QSofaListView() @@ -455,6 +457,8 @@ void QSofaListView::RunSofaRightClicked( const QPoint& point) act->setEnabled(object_.asBase()->getInstanciationSourceFileName() != ""); act = contextMenu->addAction("Go to Implementation...", this, SLOT(openImplementation())); act->setEnabled(object_.asBase()->getDefinitionSourceFileName() != ""); + act = contextMenu->addAction("Go to Error...", this, SLOT(openError())); + act->setEnabled(object_.asBase()->countLoggedMessages({sofa::helper::logging::Message::Error, sofa::helper::logging::Message::Fatal}) != 0); } contextMenu->addSeparator(); @@ -678,6 +682,19 @@ void QSofaListView::openImplementation() } } +void QSofaListView::openError() +{ + if(object_.isBase()) + { + auto messages = object_.asBase()->getLoggedMessages(); + if(messages.empty()) + return; + auto message = messages.back(); + openInExternalEditor(message.fileInfo()->filename, + message.fileInfo()->line); + } +} + void QSofaListView::openInEditor() { @@ -718,7 +735,6 @@ bool QSofaListView::isNodeErasable ( BaseNode* node) } return true; - } void QSofaListView::Export() diff --git a/src/sofa/qt/QSofaListView.h b/src/sofa/qt/QSofaListView.h index 243599c..8a29efa 100644 --- a/src/sofa/qt/QSofaListView.h +++ b/src/sofa/qt/QSofaListView.h @@ -132,6 +132,7 @@ protected Q_SLOTS: void RemoveNode(); void Modify(); void openInEditor(); + void openError(); void openInstanciation(); void openImplementation(); void copyFilePathToClipBoard();