Skip to content

Commit

Permalink
完善:三个删除前的弹窗提示
Browse files Browse the repository at this point in the history
  • Loading branch information
EsZHU committed May 3, 2022
1 parent b3290f1 commit 49b67f3
Show file tree
Hide file tree
Showing 8 changed files with 256 additions and 203 deletions.
16 changes: 11 additions & 5 deletions absencemanagedialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,17 @@ void AbsenceManageDialog::deleteState()
}
}
if(ableDel){
if (rowIndex!=-1)
{
ui->tableWidget->removeRow(rowIndex);
}
database->manageDeleteState(delName);
ConfirmSthDialog* confirmDeleteDialog = new ConfirmSthDialog([=](){
if (rowIndex!=-1)
{
ui->tableWidget->removeRow(rowIndex);
}
database->manageDeleteState(delName);
});
confirmDeleteDialog->show();
confirmDeleteDialog->setWindowModality(Qt::ApplicationModal);
confirmDeleteDialog->setLabelText("删除后不可恢复,您确认删除?");
confirmDeleteDialog->setWindowTitle("提示弹窗");
}
}
}
Expand Down
1 change: 1 addition & 0 deletions absencemanagedialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include "sqlitedatabase.h"
#include <QHeaderView>
#include "stateeditdialog.h"
#include "confirmsthdialog.h"

namespace Ui {
class AbsenceManageDialog;
Expand Down
159 changes: 107 additions & 52 deletions absencemanagedialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>320</width>
<width>526</width>
<height>450</height>
</rect>
</property>
Expand All @@ -18,72 +18,127 @@
</property>
<property name="maximumSize">
<size>
<width>320</width>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout" rowstretch="0,0" columnstretch="0,0,0">
<item row="1" column="0">
<widget class="QPushButton" name="addButton">
<property name="font">
<font>
<pointsize>18</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true">QPushButton{background-color: rgb(243, 243, 243);border:0.5px groove gray;border-radius:7px;padding:2px 4px;border-style: outset;}
QPushButton:hover{background-color:rgb(229, 241, 251); color: black;}
QPushButton:pressed{background-color:rgb(191, 190, 192);border-style: inset;}</string>
</property>
<property name="text">
<string>添加</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QPushButton" name="deleteButton">
<layout class="QGridLayout" name="gridLayout" rowstretch="0,0,0" columnstretch="0,0,0,0,0">
<item row="0" column="0" colspan="3">
<widget class="QTableWidget" name="tableWidget">
<property name="font">
<font>
<pointsize>18</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true">QPushButton{background-color: rgb(255, 41, 0);border:0.5px groove gray;border-radius:7px;padding:2px 4px;border-style: outset;color: white;}
QPushButton:hover{background-color:rgb(232, 15, 0); color: white;}
QPushButton:pressed{background-color:rgb(140, 14, 0);border-style: inset;color:white}</string>
</property>
<property name="text">
<string>删除</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QPushButton" name="editButton">
<property name="font">
<font>
<pointsize>18</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true">QPushButton{background-color: rgb(243, 243, 243);border:0.5px groove gray;border-radius:7px;padding:2px 4px;border-style: outset;}
<item row="0" column="3">
<widget class="QWidget" name="widget" native="true">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="addButton">
<property name="minimumSize">
<size>
<width>100</width>
<height>28</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>100</width>
<height>28</height>
</size>
</property>
<property name="font">
<font>
<pointsize>18</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true">QPushButton{background-color: rgb(243, 243, 243);border:0.5px groove gray;border-radius:7px;padding:2px 4px;border-style: outset;}
QPushButton:hover{background-color:rgb(229, 241, 251); color: black;}
QPushButton:pressed{background-color:rgb(191, 190, 192);border-style: inset;}</string>
</property>
<property name="text">
<string>编辑</string>
</property>
</widget>
</item>
<item row="0" column="0" colspan="3">
<widget class="QTableWidget" name="tableWidget">
<property name="font">
<font>
<pointsize>18</pointsize>
</font>
</property>
</property>
<property name="text">
<string>添加</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="editButton">
<property name="minimumSize">
<size>
<width>100</width>
<height>28</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>100</width>
<height>28</height>
</size>
</property>
<property name="font">
<font>
<pointsize>18</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true">QPushButton{background-color: rgb(243, 243, 243);border:0.5px groove gray;border-radius:7px;padding:2px 4px;border-style: outset;}
QPushButton:hover{background-color:rgb(229, 241, 251); color: black;}
QPushButton:pressed{background-color:rgb(191, 190, 192);border-style: inset;}</string>
</property>
<property name="text">
<string>编辑</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="deleteButton">
<property name="minimumSize">
<size>
<width>100</width>
<height>28</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>100</width>
<height>28</height>
</size>
</property>
<property name="font">
<font>
<pointsize>18</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true">QPushButton{background-color: rgb(255, 41, 0);border:0.5px groove gray;border-radius:7px;padding:2px 4px;border-style: outset;color: white;}
QPushButton:hover{background-color:rgb(232, 15, 0); color: white;}
QPushButton:pressed{background-color:rgb(140, 14, 0);border-style: inset;color:white}</string>
</property>
<property name="text">
<string>删除</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
Expand Down
23 changes: 13 additions & 10 deletions dptmanagedialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@ DptManageDialog::DptManageDialog(QWidget *parent) :
});
connect(ui->changeDptButton, &QPushButton::clicked, [=](){
editDept();
// changeDptDialog = new ChangeDptDialog();
// changeDptDialog->setWindowModality(Qt::ApplicationModal);
// changeDptDialog->show();
});
refresh();
}
Expand Down Expand Up @@ -124,11 +121,19 @@ void DptManageDialog::deleteDept()
}
}
if(ableDel){
if (rowIndex!=-1)
{
ui->tableWidget->removeRow(rowIndex);
}
database->manageDelDept(delName);
// 弹窗,确认按钮后再删除
ConfirmSthDialog* confirmDeleteDialog = new ConfirmSthDialog([=](){
// 删除
if (rowIndex!=-1)
{
ui->tableWidget->removeRow(rowIndex);
}
database->manageDelDept(delName);
});
confirmDeleteDialog->show();
confirmDeleteDialog->setWindowModality(Qt::ApplicationModal);
confirmDeleteDialog->setLabelText("删除后不可恢复,您确认删除?");
confirmDeleteDialog->setWindowTitle("提示弹窗");
}
}
}
Expand All @@ -151,8 +156,6 @@ void DptManageDialog::editDept()
}

StateEditDialog* stateEditDialog = new StateEditDialog("编辑部门页面", editName, [&, rowIndex, editName](QString content) mutable{
// qDebug() << "content" << content;
// qDebug() << "content" << content << "rowIndex" << rowIndex << "editName" << editName;
ui->tableWidget->setItem(rowIndex, 0, new QTableWidgetItem(content));
ui->tableWidget->item(rowIndex,0)->setTextAlignment(Qt::AlignCenter);
ui->tableWidget->item(rowIndex, 0)->setFont(QFont("song", 18));
Expand Down
1 change: 1 addition & 0 deletions dptmanagedialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <QWidget>
#include "sqlitedatabase.h"
#include "stateeditdialog.h"
#include "confirmsthdialog.h"

namespace Ui {
class DptManageDialog;
Expand Down
Loading

0 comments on commit 49b67f3

Please sign in to comment.