代码拉取完成,页面将自动刷新
#include "funceditor.h"
#include "ui_funceditor.h"
funcEditor::funcEditor(QWidget *parent) :
QDialog(parent),
ui(new Ui::funcEditor)
{
ui->setupUi(this);
setWindowTitle("编辑函数");
QRegExp rx = QRegExp("[A-Za-z0-9]{0,11}");
QRegExpValidator *validator = new QRegExpValidator(rx);
ui->moduleName->setValidator(validator);
}
funcEditor::~funcEditor()
{
delete ui;
}
void funcEditor::setTable(){
removeNode = false;
ui->table->setColumnCount(2);
ui->table->setHorizontalHeaderLabels(QStringList()<<"变量名"<<"值");
ui->table->setSelectionBehavior(QAbstractItemView::SelectRows);
ui->table->setSelectionMode(QAbstractItemView::SingleSelection);
ui->table->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
}
void funcEditor::on_removeNode_clicked(){
removeNode = true;
accept();
}
void funcEditor::getVar(std::unordered_map<std::string,std::string> & m){
int l = ui->table->rowCount();
for(int i=0;i<l;i++){
m[ui->table->item(i,0)->text().toStdString()] = ui->table->item(i,1)->text().toStdString();
}
}
void funcEditor::on_saveNode_clicked(){
accept();
}
void funcEditor::setRows(int r){
ui->table->setRowCount(r);
}
void funcEditor::setRow(int r,const std::string & name,const std::string & val){
auto k = new QTableWidgetItem(name.c_str());
auto v = new QTableWidgetItem(val.c_str());
k->setFlags(Qt::NoItemFlags);
ui->table->setItem(r,0,k);
ui->table->setItem(r,1,v);
}
void funcEditor::setModuleName(const std::string & val){
ui->moduleName->setText(val.c_str());
}
void funcEditor::getModuleName(std::string & val){
val = ui->moduleName->text().toStdString();
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。