0
我面对的某种神秘:在QToolBar不可见秀第二个呼叫/调用setVisible(真)之前
if(itemSelectionne->parentItem()->type() == NodeType) {
((GraphicsScene*) this->scene())->unselectAll();
itemSelectionne->parentItem()->setSelected(true);
//Coordinate of my toolbar, works fine
int centreX = itemSelectionne->pos().x() +
itemSelectionne->boundingRect().center().x();
int centreY = itemSelectionne->pos().y() +
itemSelectionne->boundingRect().center().y();
QPointF point = this->mapFromScene(
itemSelectionne->mapToScene(QPoint(centreX, centreY))
);
_nm.move(point.x(), point.y());
_nm.show((GraphicsNodeItem*) itemSelectionne->parentItem());
}
压脚提升上的QGraphicsView鼠标点击,我进入这段代码展示我在QToolBar (_nm是一个自定义对象,包含2 QToolbar。Show(...)调用QToolbar上的show()) 第一次输入if和call show()时,QToolbar不显示。但它显示在第二次点击和其他每次点击之后。
任何想法它可能来自哪里?
THX
编辑:这是我在自定义类调用该函数。 _currentNode是一个指向自定义QGraphicsItemGroup子类的指针。
void NodeMenu::show(GraphicsNodeItem * node) {
_currentNode = node;
_menuTop.show();
_menuBottom.show();
}
我不认为QWidget :: show()需要任何参数......该线应该做什么,到底是什么? – Anthony 2012-04-21 17:28:21
对,这是因为我的班级中包含的2个QToolbar对象的显示调用(_nm由2个QToolbar组成) – 2012-04-21 17:33:10
您可以发布该功能吗? – Anthony 2012-04-21 17:35:39