Thanks again!
//TextButton.cpp
{
qDebug() << pos();
}
//TextButton.cpp
void TextButton::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
{
qDebug() << pos();
QGraphicsItem::mouseMoveEvent(event);
}
To copy to clipboard, switch view to plain text mode
menumanager.cpp
void MenuManager
::createMenu(const QDomElement &category, BUTTON_TYPE type
) {
.........
// create normal menu button
QString label
= currentNode.
toElement().
attribute("name");
item = new TextButton(label, TextButton::LEFT, type, this->window->scene, this->window->mainSceneRoot);
currentNode = currentNode.nextSibling();
item
->setFlags
(QGraphicsItem::ItemIsMovable);
///this line is my added
.........
}
menumanager.cpp
void MenuManager::createMenu(const QDomElement &category, BUTTON_TYPE type)
{
.........
// create normal menu button
QString label = currentNode.toElement().attribute("name");
item = new TextButton(label, TextButton::LEFT, type, this->window->scene, this->window->mainSceneRoot);
currentNode = currentNode.nextSibling();
item->setFlags(QGraphicsItem::ItemIsMovable); ///this line is my added
.........
}
To copy to clipboard, switch view to plain text mode
Only modified two places in the source of qtdemo.
But course that the moving item jump from (59, 233) to (0, 1) in the procedure of qtdemo.
Bookmarks