87 lines
2.3 KiB
C++
87 lines
2.3 KiB
C++
#include "form_maininterface.h"
|
|
#include "ui_form_maininterface.h"
|
|
#include <QPainter>
|
|
#include "imgfmt/HGImgFmt.h"
|
|
#include "HGUIGlobal.h"
|
|
#include "form_texttips.h"
|
|
|
|
Form_mainInterface::Form_mainInterface(QWidget *parent)
|
|
: QWidget(parent)
|
|
, ui(new Ui::Form_mainInterface)
|
|
{
|
|
ui->setupUi(this);
|
|
|
|
QString path("../../doc/config.json");
|
|
AnalysisJson analysisJson(path);
|
|
|
|
std::vector<AnalysisJson::json_node> list_jsonNode = analysisJson.GetNode();
|
|
for(int i = 0; i < list_jsonNode.size(); ++i)
|
|
{
|
|
AnalysisJson::json_node node = list_jsonNode[i];
|
|
ui->listWidget->addItem(node.title);
|
|
}
|
|
|
|
this->setMinimumWidth(400);
|
|
ui->listWidget->setMinimumWidth(200);
|
|
ui->listWidget->setCurrentRow(0);
|
|
ui->pbtn_preStep->setEnabled(false);
|
|
}
|
|
|
|
Form_mainInterface::~Form_mainInterface()
|
|
{
|
|
delete ui;
|
|
}
|
|
|
|
void Form_mainInterface::paintEvent(QPaintEvent *event)
|
|
{
|
|
(void)event;
|
|
QPainter p(this);
|
|
p.setPen(QColor("gray"));
|
|
p.drawRect(0, 0, width() -1, height() -1);
|
|
}
|
|
|
|
void Form_mainInterface::on_listWidget_currentRowChanged(int currentRow)
|
|
{
|
|
ui->pbtn_preStep->setEnabled(ui->listWidget->currentRow() != 0);
|
|
ui->pbtn_nextStep->setEnabled(ui->listWidget->currentRow() != ui->listWidget->count() - 1);
|
|
|
|
if (currentRow == 0)
|
|
{
|
|
Form_textTips *textTips = new Form_textTips();
|
|
ui->stackedWidget->addWidget(textTips);
|
|
ui->stackedWidget->setCurrentWidget(textTips);
|
|
}
|
|
if (currentRow == 1)
|
|
{
|
|
HGImgView *m_view = new HGImgView();
|
|
ui->stackedWidget->addWidget(m_view);
|
|
ui->stackedWidget->setCurrentWidget(m_view);
|
|
|
|
HGImage img;
|
|
QString filename("C:\\Users\\yang'jia'xuan\\Pictures\\4.jpg");
|
|
HGImgFmt_LoadImage(getStdFileName(filename).toStdString().c_str(), 0, 0, 0, 0, &img);
|
|
m_view->addImage(img);
|
|
}
|
|
}
|
|
|
|
void Form_mainInterface::on_pbtn_preStep_clicked()
|
|
{
|
|
ui->listWidget->setCurrentRow(ui->listWidget->currentRow() - 1);
|
|
}
|
|
|
|
void Form_mainInterface::on_pbtn_nextStep_clicked()
|
|
{
|
|
ui->listWidget->setCurrentRow(ui->listWidget->currentRow() + 1);
|
|
}
|
|
|
|
void Form_mainInterface::on_pbtn_fail_clicked()
|
|
{
|
|
ui->listWidget->item(ui->listWidget->currentRow())->setBackgroundColor("red");
|
|
}
|
|
|
|
void Form_mainInterface::on_pbtn_pass_clicked()
|
|
{
|
|
ui->listWidget->item(ui->listWidget->currentRow())->setBackgroundColor("white");
|
|
}
|
|
|