MergePointDialog.h
#ifndef MERGEPOINTDIALOG_H
#define MERGEPOINTDIALOG_H
#include
#include
using namespace std;
typedef std::function<void(QString)> Complete;
namespace Ui {
class MergePointDialog;
}
class MergePointDialog : public QDialog
{
Q_OBJECT
public:
explicit MergePointDialog(QWidget *parent = 0);
~MergePointDialog();
void setOnCompleteListener(Complete complete);
private slots:
void on_btnConfirm_clicked();
void on_btnCancel_clicked();
private:
Ui::MergePointDialog *ui;
Complete mComplete=NULL;
};
#endif // MERGEPOINTDIALOG_H
MergePointDialog.c
#include "MergePointDialog.h"
#include "ui_MergePointDialog.h"
#include
MergePointDialog::MergePointDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::MergePointDialog)
{
ui->setupUi(this);
}
MergePointDialog::~MergePointDialog()
{
delete ui;
}
void MergePointDialog::setOnCompleteListener(Complete complete){
this->mComplete=complete;
}
void MergePointDialog::on_btnConfirm_clicked(){
if(this->mComplete!=NULL){
this->mComplete(ui->leValue->text());
}
this->close();
}
void MergePointDialog::on_btnCancel_clicked(){
this->close();
}
MergePointDialog *dialog=new MergePointDialog;
dialog->setOnCompleteListener([=](QString value){
qDebug()<<"========";
// ProjectUtil::mergePoint(value);
this->drawPointLine(Constant::SCREEN_SEG_LIST);
});
dialog->show();