diff --git a/HW2/anotherwindow.cpp b/HW2/anotherwindow.cpp index 6de04c486ffe3ecc686240aed22b4c036b7e0919..68a882450cada6f76b572c9346d195118cd45cf8 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 5b16f3520ff727c92b8d238dac16f0ba4b9a8c4b..f43d1898324dc19bc332016b5b03c954e47e7d20 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 5d77aad544e788c0a08352d0a1c7eb7030fbe10c..1a8998f9e2a1ab4f6fbf57ef0422f01135c8ae94 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); }