Commit 00286a48 by Alisa Jung

display changed name in status bar

parent bdc74ec5
...@@ -292,15 +292,16 @@ void Controller::itemSelected(QModelIndex q){ ...@@ -292,15 +292,16 @@ void Controller::itemSelected(QModelIndex q){
void Controller::itemDoubleClicked(QModelIndex q){ void Controller::itemDoubleClicked(QModelIndex q){
qDebug() << "item Double clicked. Row: " << q.row() << ", column: " << q.column(); qDebug() << "item Double clicked. Row: " << q.row() << ", column: " << q.column();
selectedItem = scene->getItem(q); selectedItemIndex = q;
} }
QString Controller::getCurrentName(){ QString Controller::getCurrentName(){
return selectedItem->getName(); return scene->getItem(selectedItemIndex)->getName();
} }
void Controller::changeItemName(QString q){ void Controller::changeItemName(QString q){
//TODO this is not working. //TODO this is not working.
qDebug() << "Name entered: " << q; qDebug() << "Name entered: " << q;
selectedItem->setName(q); scene->getItem(selectedItemIndex)->setName(q);
itemSelected(selectedItemIndex);
} }
...@@ -79,7 +79,7 @@ private: ...@@ -79,7 +79,7 @@ private:
RigidBodyTransformation* currentTransform; RigidBodyTransformation* currentTransform;
TreeItem* selectedItem;//might equal currentTransform. Or not. QModelIndex selectedItemIndex;//might equal currentTransform. Or not.
SceneGraph* scene; SceneGraph* scene;
......
...@@ -257,14 +257,13 @@ MainWindow::MainWindow(QWidget *parent) ...@@ -257,14 +257,13 @@ MainWindow::MainWindow(QWidget *parent)
connect(treeView,SIGNAL(clicked(QModelIndex)),controller, SLOT(itemSelected(QModelIndex))); connect(treeView,SIGNAL(clicked(QModelIndex)),controller, SLOT(itemSelected(QModelIndex)));
connect(treeView,SIGNAL(doubleClicked(QModelIndex)),controller,SLOT(itemDoubleClicked(QModelIndex))); connect(treeView,SIGNAL(doubleClicked(QModelIndex)),controller,SLOT(itemDoubleClicked(QModelIndex)));
connect(treeView, SIGNAL(objectNameChanged(QString)),controller,SLOT(changeItemName(QString)));
connect(treeView, SIGNAL(doubleClicked(QModelIndex)),this,SLOT(showTextEditBox())); connect(treeView, SIGNAL(doubleClicked(QModelIndex)),this,SLOT(showTextEditBox()));
controller->initTreeView(treeView); controller->initTreeView(treeView);
textInput = new QLineEdit(toolBar); // textInput = new QLineEdit(toolBar);
textInput->setText("Test"); // textInput->setText("Test");
toolBar->addWidget(textInput); // toolBar->addWidget(textInput);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment