1
#include "testcaseexecutiondialog.h"
2
#include "ui_testcaseexecutiondialog.h"
4
TestCaseExecutionDialog::TestCaseExecutionDialog(QString testcase, QString testdata, QUrl qmlFile, QWidget *parent) :
6
ui(new Ui::TestCaseExecutionDialog),
7
m_declarativeView(new QDeclarativeView)
10
ui->plainTextEdit->setPlainText(testdata);
11
this->setWindowTitle(testcase);
12
ui->horizontalLayout->addWidget(m_declarativeView);
14
QFile qmldata(qmlFile.toLocalFile());
16
if (qmldata.open(QIODevice::ReadOnly)) {
17
data = qmldata.readAll();
21
ui->plainTextEdit_2->setPlainText(data);
23
tmpQmlFile.write(data.toAscii());
26
m_declarativeView->engine()->addImportPath("..");
27
m_declarativeView->setSource(QUrl::fromLocalFile(tmpQmlFile.fileName()));
28
m_declarativeView->show();
29
m_declarativeView->viewport()->setFocusPolicy(Qt::StrongFocus);
32
void TestCaseExecutionDialog::on_pushButton_clicked() {
34
tmpQmlFile.write(ui->plainTextEdit_2->toPlainText().toAscii());
36
m_declarativeView->engine()->clearComponentCache();
37
m_declarativeView->setSource(QUrl::fromLocalFile(tmpQmlFile.fileName()));
40
TestCaseExecutionDialog::~TestCaseExecutionDialog()