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 1 commit
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
Next Next commit
fixes problems when displaying info (tooltip)of hybrid connectors. Hy…
…brid connectors must not be shown. Fixes #3578
  • Loading branch information
failiz committed Aug 21, 2022
commit f008f55c7705b5535c4ee7ffc2318eb6c6f194be
37 changes: 27 additions & 10 deletions src/sketch/fgraphicsscene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,23 +35,40 @@ 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;

//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->toolTip().isEmpty()) {
text = item->toolTip();
point = helpEvent->screenPos();
Expand Down