Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion src/sofa/qt/GraphListenerQListView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Copy link
Contributor

@hugtalbot hugtalbot Oct 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here all the messages (possibly huge) will be displayed ..

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are totally right, we can focus on the last one or add some visual "clipping".

}

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(
Expand Down
18 changes: 17 additions & 1 deletion src/sofa/qt/QSofaListView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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()
{
Expand Down Expand Up @@ -718,7 +735,6 @@ bool QSofaListView::isNodeErasable ( BaseNode* node)
}

return true;

}

void QSofaListView::Export()
Expand Down
1 change: 1 addition & 0 deletions src/sofa/qt/QSofaListView.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ protected Q_SLOTS:
void RemoveNode();
void Modify();
void openInEditor();
void openError();
void openInstanciation();
void openImplementation();
void copyFilePathToClipBoard();
Expand Down
Loading