Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
grapa_alisa
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Alisa Jung
grapa_alisa
Commits
bdc74ec5
Commit
bdc74ec5
authored
Nov 23, 2015
by
Alisa Jung
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
edit names of rbt/children
parent
c7707b1a
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
0 deletions
+27
-0
controller.cpp
helloqube/controller.cpp
+4
-0
controller.h
helloqube/controller.h
+2
-0
mainwindow.cpp
helloqube/mainwindow.cpp
+16
-0
mainwindow.h
helloqube/mainwindow.h
+5
-0
No files found.
helloqube/controller.cpp
View file @
bdc74ec5
...
...
@@ -295,6 +295,10 @@ void Controller::itemDoubleClicked(QModelIndex q){
selectedItem
=
scene
->
getItem
(
q
);
}
QString
Controller
::
getCurrentName
(){
return
selectedItem
->
getName
();
}
void
Controller
::
changeItemName
(
QString
q
){
//TODO this is not working.
qDebug
()
<<
"Name entered: "
<<
q
;
...
...
helloqube/controller.h
View file @
bdc74ec5
...
...
@@ -49,6 +49,8 @@ public:
SceneGraph
*
getSceneGraph
();
QString
getCurrentName
();
//of double clicked thingy
private
:
QAction
*
modeCameraAction
;
QAction
*
modeManipulateAction
;
...
...
helloqube/mainwindow.cpp
View file @
bdc74ec5
...
...
@@ -258,9 +258,14 @@ MainWindow::MainWindow(QWidget *parent)
connect
(
treeView
,
SIGNAL
(
clicked
(
QModelIndex
)),
controller
,
SLOT
(
itemSelected
(
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
()));
controller
->
initTreeView
(
treeView
);
textInput
=
new
QLineEdit
(
toolBar
);
textInput
->
setText
(
"Test"
);
toolBar
->
addWidget
(
textInput
);
}
...
...
@@ -282,3 +287,14 @@ void MainWindow::showAboutBox(){
msgBox
.
setText
(
"Written by Alisa"
);
msgBox
.
exec
();
}
void
MainWindow
::
showTextEditBox
(){
bool
ok
;
QString
text
=
QInputDialog
::
getText
(
this
,
"Edit Name"
,
tr
(
"New Name:"
),
QLineEdit
::
Normal
,
controller
->
getCurrentName
(),
&
ok
);
if
(
ok
&&
!
text
.
isEmpty
()){
qDebug
(
"Text received"
);
controller
->
changeItemName
(
text
);
}
}
helloqube/mainwindow.h
View file @
bdc74ec5
...
...
@@ -20,6 +20,8 @@
#include <scenegraph.h>
#include <myitemmodel.h>
#include <QDockWidget>
#include <QLineEdit>
#include <QInputDialog>
class
MainWindow
:
public
QMainWindow
{
Q_OBJECT
...
...
@@ -93,8 +95,11 @@ private:
QDockWidget
*
dockWidget
;
QTreeView
*
treeView
;
QLineEdit
*
textInput
;
public
slots
:
void
showAboutBox
(
)
;
void
showTextEditBox
();
};
#endif // MAINWINDOW_H
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment