3500/CopyChannelSetting.cpp

60 lines
1.4 KiB
C++
Raw Normal View History

2023-04-14 19:30:30 +08:00
#include "CopyChannelSetting.h"
#include "ui_CopyChannelSetting.h"
2023-04-17 17:40:26 +08:00
#include<QGridLayout>
2023-04-14 19:30:30 +08:00
CopyChannelSetting::CopyChannelSetting(QWidget *parent) :
QWidget(parent),
ui(new Ui::CopyChannelSetting)
{
ui->setupUi(this);
}
CopyChannelSetting::~CopyChannelSetting()
{
delete ui;
}
2023-04-17 17:40:26 +08:00
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 ++ ;
}
2024-09-11 16:37:00 +08:00
m_mapCheckBox.insert(copyChannel[i].channelId,checkButton);
2023-04-17 17:40:26 +08:00
}
}
void CopyChannelSetting::on_pushButton_confirm_clicked()
{
2024-09-11 16:37:00 +08:00
QStringList listChannelID;
QMap<QString,QCheckBox*>::iterator iter = m_mapCheckBox.begin();
for (; iter != m_mapCheckBox.end(); iter++) {
if(iter.value()->checkState()){
listChannelID.append(iter.key());
}
2023-04-17 17:40:26 +08:00
}
2024-09-11 16:37:00 +08:00
sgCopyChannelData(listChannelID);
2023-04-17 17:40:26 +08:00
this->close();
}
void CopyChannelSetting::on_pushButton_selectAll_clicked()
{
2024-09-11 16:37:00 +08:00
QMap<QString,QCheckBox*>::iterator iter = m_mapCheckBox.begin();
for (; iter != m_mapCheckBox.end(); iter++) {
iter.value()->setCheckState(Qt::Checked);
2023-04-17 17:40:26 +08:00
}
}