50 lines
1.4 KiB
C++
50 lines
1.4 KiB
C++
#include "dialog_insertindex.h"
|
|
#include "ui_dialog_insertindex.h"
|
|
#include <QButtonGroup>
|
|
#include <QPushButton>
|
|
#include "app_cfg.h"
|
|
|
|
Dialog_InsertIndex::Dialog_InsertIndex(QWidget *parent) :
|
|
QDialog(parent),
|
|
ui(new Ui::Dialog_InsertIndex),
|
|
button_group(new QButtonGroup)
|
|
{
|
|
ui->setupUi(this);
|
|
setWindowFlags(Qt::Dialog | Qt::WindowCloseButtonHint);
|
|
|
|
button_group->addButton(ui->rbtn_first, 0);
|
|
button_group->addButton(ui->rbtn_beforeCurr, 1);
|
|
button_group->addButton(ui->rbtn_afterCurr, 2);
|
|
button_group->addButton(ui->rbtn_last, 3);
|
|
|
|
ui->buttonBox->button(QDialogButtonBox::Ok)->setText(tr("ok"));
|
|
ui->buttonBox->button(QDialogButtonBox::Cancel)->setText(tr("cancel"));
|
|
connect(button_group, SIGNAL(buttonClicked(int)), this, SLOT(on_rbtn_clicked(int)));
|
|
|
|
m_index = getCfgValue("insertScan", "insertType", 3);
|
|
if (0 == m_index)
|
|
ui->rbtn_first->setChecked(true);
|
|
else if (1 == m_index)
|
|
ui->rbtn_beforeCurr->setChecked(true);
|
|
else if (2 == m_index)
|
|
ui->rbtn_afterCurr->setChecked(true);
|
|
else
|
|
ui->rbtn_last->setChecked(true);
|
|
}
|
|
|
|
Dialog_InsertIndex::~Dialog_InsertIndex()
|
|
{
|
|
delete button_group;
|
|
delete ui;
|
|
}
|
|
|
|
void Dialog_InsertIndex::on_rbtn_clicked(int id)
|
|
{
|
|
m_index = id;
|
|
}
|
|
|
|
void Dialog_InsertIndex::on_buttonBox_accepted()
|
|
{
|
|
saveCfgValue("insertScan", "insertType", m_index);
|
|
}
|