Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not show hybrid connectors tooltip Fixes #3578 #3973

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
38 changes: 28 additions & 10 deletions src/sketch/fgraphicsscene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,23 +35,41 @@ FGraphicsScene::FGraphicsScene( QObject * parent) : QGraphicsScene(parent)
void FGraphicsScene::helpEvent(QGraphicsSceneHelpEvent *helpEvent)
{
// TODO: how do we get a QTransform?
QGraphicsItem * item = this->itemAt(helpEvent->scenePos(), QTransform());
if (item == NULL) return;
QList<QGraphicsItem*> itemList = this->items(helpEvent->scenePos(), Qt::IntersectsItemShape, Qt::DescendingOrder, QTransform());

bool found = false;
QString text;
QPoint point;
ItemBase * itemBase = dynamic_cast<ItemBase *>(item);
if (itemBase == NULL) {
ConnectorItem * connectorItem = dynamic_cast<ConnectorItem *>(item);
if (connectorItem) {
connectorItem->updateTooltip();
QGraphicsItem * item = nullptr;

//Find connectors first
for (int i = 0; i < itemList.size(); i++) {
item = itemList.at(i);
ItemBase * itemBase = dynamic_cast<ItemBase *>(item);
if (itemBase == NULL) {
ConnectorItem * connectorItem = dynamic_cast<ConnectorItem *>(item);
if (connectorItem && !connectorItem->isHybrid()) {
connectorItem->updateTooltip();
found = true;
break;
}
}

}
else {
itemBase->updateTooltip();

//If there are not connectors, find parts
if (!found){
for (int i = 0; i < itemList.size(); i++) {
item = itemList.at(i);
ItemBase * itemBase = dynamic_cast<ItemBase *>(item);
if (itemBase) {
itemBase->updateTooltip();
break;
}
}
}

if(!item) return;

if (!item->toolTip().isEmpty()) {
text = item->toolTip();
point = helpEvent->screenPos();
Expand Down