程序示例精选
Qt+C++桌面计算器源码
如需安装运行环境或远程调试,见文章底部个人QQ名片,由专业技术人员远程协助!
这篇博客针对<
代码如下(示例):
#include
#include
#include
#include
#include
#include
代码如下(示例):
void MainWindow::Calc_Suffix()
{
for(int i=0;ilineEdit->text();//获取表达式
getChar();
getSuffix();
Calc_Suffix();
ui->lineEdit->clear();//清空文本编辑框
ui->lineEdit->setText(QString("%1%2").arg('=').arg(result));//显示结果
m_init();
}
void MainWindow::on_pushButton_2_clicked()
{
QString str=ui->lineEdit->text();
ui->lineEdit->setText(QString("%1%2").arg(str).arg(0));
}
void MainWindow::on_pushButton_3_clicked()
{
QString str=ui->lineEdit->text();
ui->lineEdit->setText(QString("%1%2").arg(str).arg(1));
}
void MainWindow::on_pushButton_4_clicked()
{
QString str=ui->lineEdit->text();
ui->lineEdit->setText(QString("%1%2").arg(str).arg(2));
}
void MainWindow::on_pushButton_5_clicked()
{
QString str=ui->lineEdit->text();
ui->lineEdit->setText(QString("%1%2").arg(str).arg(3));
}
void MainWindow::on_pushButton_6_clicked()
{
QString str=ui->lineEdit->text();
ui->lineEdit->setText(QString("%1%2").arg(str).arg(4));
}
void MainWindow::on_pushButton_7_clicked()
{
QString str=ui->lineEdit->text();
ui->lineEdit->setText(QString("%1%2").arg(str).arg(5));
}
void MainWindow::on_pushButton_8_clicked()
{
QString str=ui->lineEdit->text();
ui->lineEdit->setText(QString("%1%2").arg(str).arg(6));
}
void MainWindow::on_pushButton_9_clicked()
{
QString str=ui->lineEdit->text();
ui->lineEdit->setText(QString("%1%2").arg(str).arg(7));
}
void MainWindow::on_pushButton_10_clicked()
{
QString str=ui->lineEdit->text();
ui->lineEdit->setText(QString("%1%2").arg(str).arg(8));
}
void MainWindow::on_pushButton_11_clicked()
{
QString str=ui->lineEdit->text();
ui->lineEdit->setText(QString("%1%2").arg(str).arg(9));
}
void MainWindow::on_pushButton_12_clicked()
{
QString str=ui->lineEdit->text();
ui->lineEdit->setText(QString("%1%2").arg(str).arg("+"));
}
void MainWindow::on_pushButton_13_clicked()
{
QString str=ui->lineEdit->text();
ui->lineEdit->setText(QString("%1%2").arg(str).arg("-"));
}
void MainWindow::on_pushButton_14_clicked()
{
QString str=ui->lineEdit->text();
ui->lineEdit->setText(QString("%1%2").arg(str).arg("*"));
}
void MainWindow::on_pushButton_15_clicked()
{
QString str=ui->lineEdit->text();
ui->lineEdit->setText(QString("%1%2").arg(str).arg("/"));
}
void MainWindow::on_pushButton_20_clicked()
{
QString str=ui->lineEdit->text();
ui->lineEdit->setText(QString("%1%2").arg(str).arg("."));
}
void MainWindow::on_pushButton_18_clicked()
{
QString str=ui->lineEdit->text();
ui->lineEdit->setText(QString("%1%2").arg(str).arg("("));
}
void MainWindow::on_pushButton_19_clicked()
{
QString str=ui->lineEdit->text();
ui->lineEdit->setText(QString("%1%2").arg(str).arg(")"));
}
void MainWindow::on_pushButton_16_clicked()
{
//清空所有内容,并初始化
ui->lineEdit->clear();
m_init();
}
void MainWindow::on_pushButton_17_clicked()
{
//退格删除一个字符
ui->lineEdit->backspace();
}
void MainWindow::on_pushButton_21_clicked()
{
QString str=ui->lineEdit->text();
ui->lineEdit->setText(QString("%1%2").arg(str).arg("sin"));
}
void MainWindow::on_pushButton_22_clicked()
{
QString str=ui->lineEdit->text();
ui->lineEdit->setText(QString("%1%2").arg(str).arg("cos"));
}
void MainWindow::on_pushButton_23_clicked()
{
QString str=ui->lineEdit->text();
ui->lineEdit->setText(QString("%1%2").arg(str).arg("tan"));
}
void MainWindow::on_pushButton_24_clicked()//最小公倍数,c_mul
{
QString str=ui->lineEdit->text();
QString l1="0",l2="0";
QByteArray yue = str.toLatin1();
bool hasSpace = false;
QString c_div="1";
int max_yue;
for(int i=0;is2)
max=s1;
else
max=s2;
for(int j=2;jlineEdit->setText(c_mul);
}
void MainWindow::on_pushButton_25_clicked()//公约数,两个数以小数点分格
{
QString str=ui->lineEdit->text();
QString l1="0",l2="0";
QByteArray yue = str.toLatin1();
bool hasSpace = false;
QString c_div="1";
for(int i=0;is2)
max=s1;
else
max=s2;
for(int j=2;jlineEdit->setText(c_div);
}
void MainWindow::on_pushButton_26_clicked()
{
QString str=ui->lineEdit->text();
ui->lineEdit->setText(QString("%1%2").arg(str).arg("^"));
}
void MainWindow::on_pushButton_27_clicked()
{
QString str=ui->lineEdit->text();
ui->lineEdit->setText(QString("%1%2").arg(str).arg("log"));
}
代码如下(示例):
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('--weights', nargs='+', type=str, default='yolov5_best_road_crack_recog.pt', help='model.pt path(s)')
parser.add_argument('--img-size', type=int, default=640, help='inference size (pixels)')
parser.add_argument('--conf-thres', type=float, default=0.25, help='object confidence threshold')
parser.add_argument('--iou-thres', type=float, default=0.45, help='IOU threshold for NMS')
parser.add_argument('--view-img', action='store_true', help='display results')
parser.add_argument('--save-txt', action='store_true', help='save results to *.txt')
parser.add_argument('--classes', nargs='+', type=int, default='0', help='filter by class: --class 0, or --class 0 2 3')
parser.add_argument('--agnostic-nms', action='store_true', help='class-agnostic NMS')
parser.add_argument('--augment', action='store_true', help='augmented inference')
parser.add_argument('--update', action='store_true', help='update all models')
parser.add_argument('--project', default='runs/detect', help='save results to project/name')
parser.add_argument('--name', default='exp', help='save results to project/name')
parser.add_argument('--exist-ok', action='store_true', help='existing project/name ok, do not increment')
opt = parser.parse_args()
如需安装运行环境或远程调试,见文章底部个人 QQ 名片,由专业技术人员远程协助!
1)远程安装运行环境,代码调试
2)Qt, C++, Python入门指导
3)界面美化
4)软件制作
当前文章连接:https://blog.csdn.net/alicema1111/article/details/132608892
博主推荐文章:python人脸识别统计人数qt窗体-CSDN博客
博主推荐文章:Python Yolov5火焰烟雾识别源码分享-CSDN博客
Python OpenCV识别行人入口进出人数统计_python识别人数-CSDN博客
个人博客主页:alicema1111的博客_CSDN博客-Python,C++,网页领域博主
博主所有文章点这里:alicema1111的博客_CSDN博客-Python,C++,网页领域博主