41 lines
962 B
C++
41 lines
962 B
C++
#include "queryeditor.h"
|
|
#include "ui_queryeditor.h"
|
|
#include <QMessageBox>
|
|
#include <vector>
|
|
|
|
QueryEditor::QueryEditor(QWidget *parent) :
|
|
QWidget(parent),
|
|
ui(new Ui::QueryEditor)
|
|
{
|
|
ui->setupUi(this);
|
|
ui->queryHead->setText(queryTexts.queryHead);
|
|
}
|
|
|
|
QueryEditor::~QueryEditor()
|
|
{
|
|
delete ui;
|
|
}
|
|
|
|
void QueryEditor::init(TraceNavigator *navigator)
|
|
{
|
|
this->navigator = navigator;
|
|
ui->transactiontreeWidget->init(navigator);
|
|
}
|
|
|
|
void QueryEditor::on_executeQuery_clicked()
|
|
{
|
|
try
|
|
{
|
|
std::vector<std::shared_ptr<Transaction>> result = navigator->TraceFile().getTransactionsWithCustomQuery(queryTexts.queryHead + " " + ui->queryEdit->toPlainText());
|
|
ui->transactiontreeWidget->clear();
|
|
for(const auto & trans : result)
|
|
{
|
|
ui->transactiontreeWidget->AppendTransaction(trans);
|
|
}
|
|
}
|
|
catch(sqlException ex)
|
|
{
|
|
QMessageBox::warning(this,"Query failed",ex.what());
|
|
}
|
|
}
|