3500/CopyChannelSetting.cpp

60 lines
1.4 KiB
C++

#include "CopyChannelSetting.h"
#include "ui_CopyChannelSetting.h"
#include<QGridLayout>
CopyChannelSetting::CopyChannelSetting(QWidget *parent) :
QWidget(parent),
ui(new Ui::CopyChannelSetting)
{
ui->setupUi(this);
}
CopyChannelSetting::~CopyChannelSetting()
{
delete ui;
}
void CopyChannelSetting::displayCopyChannel()
{
QGridLayout* layout = new QGridLayout(ui->widget);
int col = 0,row = 0;
for(int i = 0; i < copyChannel.size();i++){
QCheckBox *checkButton = new QCheckBox(copyChannel[i].channelName,ui->widget);
if(!int((i+1) % 2)){
layout->addWidget(checkButton, col, row);
col ++ ;
row = 0;
}else{
layout->addWidget(checkButton, col, row);
row ++ ;
}
m_mapCheckBox.insert(copyChannel[i].channelId,checkButton);
}
}
void CopyChannelSetting::on_pushButton_confirm_clicked()
{
QStringList listChannelID;
QMap<QString,QCheckBox*>::iterator iter = m_mapCheckBox.begin();
for (; iter != m_mapCheckBox.end(); iter++) {
if(iter.value()->checkState()){
listChannelID.append(iter.key());
}
}
sgCopyChannelData(listChannelID);
this->close();
}
void CopyChannelSetting::on_pushButton_selectAll_clicked()
{
QMap<QString,QCheckBox*>::iterator iter = m_mapCheckBox.begin();
for (; iter != m_mapCheckBox.end(); iter++) {
iter.value()->setCheckState(Qt::Checked);
}
}