From efffaaf2e2fa3b1258716af43f10dfaf6ceb2ea6 Mon Sep 17 00:00:00 2001 From: Julia Leonova Date: Sun, 23 Jan 2022 14:13:02 +0300 Subject: [PATCH] =?UTF-8?q?=ED=95=98=EB=82=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- HW2/anotherwindow.cpp | 9 +++++---- HW2/mainwindow.cpp | 8 +++++--- HW2/xmlmodel.cpp | 1 + 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/HW2/anotherwindow.cpp b/HW2/anotherwindow.cpp index 6de04c4..68a8824 100644 --- a/HW2/anotherwindow.cpp +++ b/HW2/anotherwindow.cpp @@ -6,6 +6,11 @@ AnotherWindow::AnotherWindow(QStringList str, QWidget *parent) : modelNew = new XmlModel(this); treeViewNew =new QTreeView(this); treeViewNew ->setModel(modelNew); + + setWindowTitle(tr("New Window")); + setMinimumSize(160, 160); + resize(480, 320); + // setCentral(treeView); // QModelIndex index=mogetCurrentIndex(); @@ -13,10 +18,6 @@ AnotherWindow::AnotherWindow(QStringList str, QWidget *parent) : modelNew->addFiles(&str); treeViewNew->reset(); - - setWindowTitle(tr("New Window")); - setMinimumSize(160, 160); - resize(480, 320); } AnotherWindow::~AnotherWindow() diff --git a/HW2/mainwindow.cpp b/HW2/mainwindow.cpp index 5b16f35..f43d189 100644 --- a/HW2/mainwindow.cpp +++ b/HW2/mainwindow.cpp @@ -67,10 +67,12 @@ void MainWindow::close() void MainWindow::openNew() { auto obj = model->getObjectByIndex(model->getCurrentIndex()); - QStringList str; - obj->setProperty("fullname",str); + QStringList strlist; + QVariant str; + str = obj->property("fullname"); + strlist = str.toStringList(); - NewWindow = new AnotherWindow(str); + NewWindow = new AnotherWindow(strlist); NewWindow->show(); // model->removeRow(treeView->indexAt(model->getCurrentIndex())); diff --git a/HW2/xmlmodel.cpp b/HW2/xmlmodel.cpp index 5d77aad..1a8998f 100644 --- a/HW2/xmlmodel.cpp +++ b/HW2/xmlmodel.cpp @@ -86,6 +86,7 @@ void XmlModel::addFiles(const QStringList* namesList){ QObject* FirstElem=new QObject(Root); FirstElem->setProperty("text", name); FirstElem->setProperty("fullname", nameFile); +// getTextErrors(nameFile); QDomElement element = doc.documentElement(); //represents one element in the DOM tree addElements(element, FirstElem); } -- GitLab