增加全选和取消全选功能.

Signed-off-by: rick.chan <chenyang@autoai.com>
This commit is contained in:
rick.chan 2020-08-28 10:17:38 +08:00
parent 390ad25bc4
commit 1ccb5a91a2
6 changed files with 96 additions and 19 deletions

View File

@ -1,6 +1,6 @@
/**
* @author: Lion Chen/QQ:174980551
* @date: 2014-01-23
* @author Rick Chan (cy187lion@sina.com)
* @date 2014-01-23
*/
#include "engine.h"

View File

@ -1,6 +1,6 @@
/**
* @author: Lion Chen/QQ:174980551
* @date: 2014-01-23
* @author Rick Chan (cy187lion@sina.com)
* @date 2014-01-23
*/
#ifndef ENGINE_H

View File

@ -1,6 +1,6 @@
/**
* @author: Lion Chen/QQ:174980551
* @date: 2014-01-23
* @author Rick Chan (cy187lion@sina.com)
* @date 2014-01-23
*/
#include "qtproaddfilehelper.h"

View File

@ -1,6 +1,6 @@
/**
* @author: Lion Chen/QQ:174980551
* @date: 2014-01-23
* @author Rick Chan (cy187lion@sina.com)
* @date 2020-08-28
*/
#include "qtproaddfilehelper.h"
@ -21,6 +21,27 @@ QtProAddFileHelper::QtProAddFileHelper(QWidget *parent) :
StatusLabel->adjustSize();
ui->statusBar->addWidget(StatusLabel);
StatusLabel->setText("By: Lion Chen @Giraffe Ver:2.3.0");
CheckBoxes.clear();
CheckBoxes.append(ui->cCheckBox);
CheckBoxes.append(ui->CpupuCheckBox);
CheckBoxes.append(ui->cppCheckBox);
CheckBoxes.append(ui->cxxCheckBox);
CheckBoxes.append(ui->ccCheckBox);
CheckBoxes.append(ui->tccCheckBox);
CheckBoxes.append(ui->hCheckBox);
CheckBoxes.append(ui->hpupuCheckBox);
CheckBoxes.append(ui->hppCheckBox);
CheckBoxes.append(ui->hxxCheckBox);
CheckBoxes.append(ui->MkfCheckBox);
CheckBoxes.append(ui->asmCheckBox);
CheckBoxes.append(ui->sCheckBox);
CheckBoxes.append(ui->xmlCheckBox);
for(QList<QCheckBox*>::Iterator itr=CheckBoxes.begin();
itr!=CheckBoxes.end();
itr++)
connect(*itr, &QCheckBox::clicked, this, &QtProAddFileHelper::OnCheckBoxesClicked);
}
QtProAddFileHelper::~QtProAddFileHelper()
@ -99,8 +120,8 @@ void QtProAddFileHelper::on_OKButton_clicked()
* | | hxx | hpp | h++ | h |
* | 0000 | 1 | 1 | 1 | 1 |
*
* |......|.xml.|.s.|.asm.|.Makefile.|
* |.0000.|..1..|.1.|..1..|.....1....|
* | |.xml.|.s.|.asm.|.Makefile.|
* | 0000 | 1 | 1 | 1 | 1 |
*/
FILE_TYPES selectedFile;
/**< Sources */
@ -282,3 +303,38 @@ void QtProAddFileHelper::on_PathEdit_editingFinished()
ui->ProEdit->setText(ui->PathEdit->text());
}
}
void QtProAddFileHelper::on_SeleAllcheckBox_clicked(bool checked)
{
if(checked)
{
for(QList<QCheckBox*>::Iterator itr=CheckBoxes.begin();
itr!=CheckBoxes.end();
itr++)
(*itr)->setChecked(true);
}
else
{
for(QList<QCheckBox*>::Iterator itr=CheckBoxes.begin();
itr!=CheckBoxes.end();
itr++)
(*itr)->setChecked(false);
}
}
void QtProAddFileHelper::OnCheckBoxesClicked(bool checked)
{
if(checked)
{
for(QList<QCheckBox*>::Iterator itr=CheckBoxes.begin();
itr!=CheckBoxes.end();
itr++)
{
if(!(*itr)->isChecked())
return;
}
ui->SeleAllcheckBox->setChecked(true);
}
else
ui->SeleAllcheckBox->setChecked(false);
}

View File

@ -1,18 +1,16 @@
/**
* @author: Lion Chen/QQ:174980551
* @date: 2014-01-23
* @author Rick Chan (cy187lion@sina.com)
* @date 2020-08-28
*/
#ifndef QTPROADDFILEHELPER_H
#define QTPROADDFILEHELPER_H
#include <QMainWindow>
/**
* @author: Lion Chen/QQ:174980551
* @data: 2014-01-23
*/
#include <QString>
#include <QLabel>
#include <QList>
#include <QCheckBox>
#include "engine.h"
namespace Ui {
@ -31,6 +29,7 @@ private:
Ui::QtProAddFileHelper *ui;
QLabel *StatusLabel;
Engine *KEngine;
QList<QCheckBox*> CheckBoxes;
void SetUiEnable(bool en);
@ -40,6 +39,9 @@ private slots:
void on_ProButton_clicked();
void on_PathButton_clicked();
void on_PathEdit_editingFinished();
void on_SeleAllcheckBox_clicked(bool checked);
void OnCheckBoxesClicked(bool checked);
};
#endif // QTPROADDFILEHELPER_H

View File

@ -12,7 +12,7 @@
</property>
<property name="minimumSize">
<size>
<width>240</width>
<width>340</width>
<height>305</height>
</size>
</property>
@ -206,15 +206,34 @@
<item>
<widget class="QCheckBox" name="RelaPthcheckBox">
<property name="text">
<string>相对路径方式</string>
<string>使用相对路径</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="SeleAllcheckBox">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>全选</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="OKButton">
<property name="minimumSize">
<size>
<width>120</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>确 定</string>
</property>
@ -232,7 +251,7 @@
<x>0</x>
<y>0</y>
<width>340</width>
<height>23</height>
<height>28</height>
</rect>
</property>
</widget>