Skip to content
GitLab
Explore
Projects
Groups
Topics
Snippets
Projects
Groups
Topics
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Register
Sign in
Toggle navigation
Menu
Юлия Леонова
HW 2 XML
Commits
efffaaf2
Commit
efffaaf2
authored
3 years ago
by
Юлия Леонова
Browse files
Options
Download
Patches
Plain Diff
하나
parent
3a2a73d2
master
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
HW2/anotherwindow.cpp
+5
-4
HW2/anotherwindow.cpp
HW2/mainwindow.cpp
+5
-3
HW2/mainwindow.cpp
HW2/xmlmodel.cpp
+1
-0
HW2/xmlmodel.cpp
with
11 additions
and
7 deletions
+11
-7
HW2/anotherwindow.cpp
+
5
−
4
View file @
efffaaf2
...
@@ -6,6 +6,11 @@ AnotherWindow::AnotherWindow(QStringList str, QWidget *parent) :
...
@@ -6,6 +6,11 @@ AnotherWindow::AnotherWindow(QStringList str, QWidget *parent) :
modelNew
=
new
XmlModel
(
this
);
modelNew
=
new
XmlModel
(
this
);
treeViewNew
=
new
QTreeView
(
this
);
treeViewNew
=
new
QTreeView
(
this
);
treeViewNew
->
setModel
(
modelNew
);
treeViewNew
->
setModel
(
modelNew
);
setWindowTitle
(
tr
(
"New Window"
));
setMinimumSize
(
160
,
160
);
resize
(
480
,
320
);
// setCentral(treeView);
// setCentral(treeView);
// QModelIndex index=mogetCurrentIndex();
// QModelIndex index=mogetCurrentIndex();
...
@@ -13,10 +18,6 @@ AnotherWindow::AnotherWindow(QStringList str, QWidget *parent) :
...
@@ -13,10 +18,6 @@ AnotherWindow::AnotherWindow(QStringList str, QWidget *parent) :
modelNew
->
addFiles
(
&
str
);
modelNew
->
addFiles
(
&
str
);
treeViewNew
->
reset
();
treeViewNew
->
reset
();
setWindowTitle
(
tr
(
"New Window"
));
setMinimumSize
(
160
,
160
);
resize
(
480
,
320
);
}
}
AnotherWindow
::~
AnotherWindow
()
AnotherWindow
::~
AnotherWindow
()
...
...
This diff is collapsed.
Click to expand it.
HW2/mainwindow.cpp
+
5
−
3
View file @
efffaaf2
...
@@ -67,10 +67,12 @@ void MainWindow::close()
...
@@ -67,10 +67,12 @@ void MainWindow::close()
void
MainWindow
::
openNew
()
void
MainWindow
::
openNew
()
{
{
auto
obj
=
model
->
getObjectByIndex
(
model
->
getCurrentIndex
());
auto
obj
=
model
->
getObjectByIndex
(
model
->
getCurrentIndex
());
QStringList
str
;
QStringList
strlist
;
obj
->
setProperty
(
"fullname"
,
str
);
QVariant
str
;
str
=
obj
->
property
(
"fullname"
);
strlist
=
str
.
toStringList
();
NewWindow
=
new
AnotherWindow
(
str
);
NewWindow
=
new
AnotherWindow
(
str
list
);
NewWindow
->
show
();
NewWindow
->
show
();
// model->removeRow(treeView->indexAt(model->getCurrentIndex()));
// model->removeRow(treeView->indexAt(model->getCurrentIndex()));
...
...
This diff is collapsed.
Click to expand it.
HW2/xmlmodel.cpp
+
1
−
0
View file @
efffaaf2
...
@@ -86,6 +86,7 @@ void XmlModel::addFiles(const QStringList* namesList){
...
@@ -86,6 +86,7 @@ void XmlModel::addFiles(const QStringList* namesList){
QObject
*
FirstElem
=
new
QObject
(
Root
);
QObject
*
FirstElem
=
new
QObject
(
Root
);
FirstElem
->
setProperty
(
"text"
,
name
);
FirstElem
->
setProperty
(
"text"
,
name
);
FirstElem
->
setProperty
(
"fullname"
,
nameFile
);
FirstElem
->
setProperty
(
"fullname"
,
nameFile
);
// getTextErrors(nameFile);
QDomElement
element
=
doc
.
documentElement
();
//represents one element in the DOM tree
QDomElement
element
=
doc
.
documentElement
();
//represents one element in the DOM tree
addElements
(
element
,
FirstElem
);
addElements
(
element
,
FirstElem
);
}
}
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Topics
Snippets