#include "QPLCIndexUI.h" #pragma execution_character_set("utf-8") QPLCIndexUI::QPLCIndexUI(QWidget *parent) : QDialog(parent) { ui.setupUi(this); connect(ui.BtnPCLIndexOK, SIGNAL(clicked()), this, SLOT(onButtonClicked())); connect(ui.BtnPCLIndexCancel, SIGNAL(clicked()), this, SLOT(onButtonClicked())); } QPLCIndexUI::~QPLCIndexUI() { } void QPLCIndexUI::setModelName(QString strName) { setWindowTitle(strName); } void QPLCIndexUI::setModelIndex(int val) { ui.spBxPLCEdit->setValue(val); } int QPLCIndexUI::getModelIndex() { int ret = ui.spBxPLCEdit->value(); return ret; } Q_SLOT void QPLCIndexUI::onButtonClicked() { QString strObj = sender()->objectName(); if ("BtnPCLIndexOK" == strObj) { QDialog::accept(); } else if ("BtnPCLIndexCancel" == strObj) { QDialog::reject(); } }