QT/QMessageBox/QTimerEvent/使用定时器制作一个闹钟

1.使用定时器制作一个闹钟

代码:

widget.cpp:

#include "widget.h"
#include "ui_widget.h"Widget::Widget(QWidget *parent): QWidget(parent), ui(new Ui::Widget), speecher(new QTextToSpeech(this))//给语音对象申请空间
{ui->setupUi(this);this->setWindowTitle("闹钟");//设置窗口标题this->setWindowIcon(QIcon(":/Logo/shangHai.jpg"));//设置窗口图标this->setWindowFlag(Qt::FramelessWindowHint);//隐藏窗口图标this->setAttribute(Qt::WA_TranslucentBackground);//去除多余空白部分}Widget::~Widget()
{delete ui;
}void Widget::timerEvent(QTimerEvent *e)
{if(e->timerId()==id){//获取系统时间,并显示QTime sys_time=QTime::currentTime();//获取当前时间QString time_str=sys_time.toString("hh:mm:ss");//将获取的时间格式转为字符串ui->sys_time->setText(time_str);//显示到标签ui->sys_time->setAlignment(Qt::AlignCenter);//居中显示}if(e->timerId()==id2){for(int i=0;i<5;i++){//设置响铃次数speecher->say(ui->labtext->text());}killTimer(id2);//关闭闹钟}}void Widget::on_pushButton_clicked()
{static int SS;QString Str=ui->lineEdit->text();//获取行编辑器内容static int flag=0;if(flag%2==0){//QString Str=ui->lineEdit->text();//获取行编辑器内容//对字符串进行处理QStringList stringList=Str.split(":");//分割QString h=stringList[0];//小时QString m=stringList[1];//分钟QString s=stringList[2];//秒//将字符串转换为整数bool ok1,ok2,ok3;int H=h.toInt(&ok1,10);int M=m.toInt(&ok2,10);int S=s.toInt(&ok3,10);if(ok1==false||ok2==false||ok3==false||H>24||M>60||S>60){QMessageBox box;box.setWindowIcon(QIcon(":/Logo/shangHai.jpg"));//自定义窗口图标box.setWindowTitle("闹钟设置不合法");box.setText("示例:小时:分钟:秒");box.addButton(QMessageBox::Ok);int retb=box.exec();//调用对话框if(retb==QMessageBox::Ok){ui->lineEdit->clear();//清空行编辑器内容}}else{//判断闹钟设置是否合法//qDebug() << H <<" " << M << " " << S;SS=H*60*60+M*60+S;//总秒数//弹出对话框,提示设置闹钟声音内容QMessageBox BOX;BOX.setWindowIcon(QIcon(":/Logo/shangHai.jpg"));//自定义窗口图标BOX.setWindowTitle("提示");BOX.setText("设置闹钟文本");BOX.addButton(QMessageBox::Ok);int ret=BOX.exec();//调用对话框if(ret==QMessageBox::Ok){ui->lineEdit->setPlaceholderText("输入闹钟文本");//设置占位ui->lineEdit->clear();//清空行编辑器内容}}}else if(flag%2==1){//将行编辑内容放入到textlab中ui->labtext->setText(Str);ui->labtext->setAlignment(Qt::AlignLeft);//左对齐显示ui->lineEdit->setPlaceholderText("设置时间x:x:x");//设置占位ui->lineEdit->clear();//清空行编辑器内容//获取当前时间QTime sys_time=QTime::currentTime();//获取当前时间QString time_str=sys_time.toString("hh:mm:ss");//将获取的时间格式转为字符串//对字符串进行处理QStringList stringList=time_str.split(":");//分割QString hh=stringList[0];//小时QString mm=stringList[1];//分钟QString ss=stringList[2];//秒//将字符串转为整数bool ok;int HH=hh.toInt(&ok,10);int MM=mm.toInt(&ok,10);int Ss=ss.toInt(&ok,10);int TSS=HH*60*60+MM*60+Ss;//设置一个闹钟id2=startTimer((SS-TSS)*1000);}flag++;
}

main.cpp:

#include "widget.h"#include <QApplication>int main(int argc, char *argv[])
{QApplication a(argc, argv);Widget w;w.id=w.startTimer(1000);//设置一个定时器w.show();return a.exec();
}

widget.h:

#ifndef WIDGET_H
#define WIDGET_H#include <QWidget>
#include <QTimerEvent>
#include <QTime>
#include <QDebug>
#include <QMessageBox>
#include <QTextToSpeech> //文本转语语音
QT_BEGIN_NAMESPACE
namespace Ui { class Widget; }
QT_END_NAMESPACEclass Widget : public QWidget
{Q_OBJECTpublic:Widget(QWidget *parent = nullptr);~Widget();void timerEvent(QTimerEvent *e);//重写定时器函数事件声明int id;//定时器idint id2;//闹钟定时器int id3;//定义闹钟响铃间隔时间
private slots:void on_pushButton_clicked();private:Ui::Widget *ui;QTextToSpeech *speecher;//定义语言成员
};
#endif // WIDGET_H

widget.ui:

<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0"><class>Widget</class><widget class="QWidget" name="Widget"><property name="geometry"><rect><x>0</x><y>0</y><width>458</width><height>600</height></rect></property><property name="font"><font><pointsize>9</pointsize></font></property><property name="windowTitle"><string>Widget</string></property><property name="styleSheet"><string notr="true">*{background-color: rgb(255, 255, 255);
}
#frame{border-image: url(:/Logo/shanChuan.jpg);
}
#frame_2{background-color: rgba(186, 186, 186, 120);border-radius:10px;
}
#sys_time{background:transparent; /*完全透明*/font: 9pt &quot;宋体&quot;;color: rgba(255, 255, 255, 120);
}
#lineEdit{background:transparent; /*完全透明*/border:none;border-bottom:2px solid rgba(255,255,255,120);color: rgba(255, 255, 255, 120);
}
#pushButton{color: rgba(255, 255, 255, 120);background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:1, stop:0 rgba(170, 255, 255, 255), stop:1 rgba(255, 255, 255, 120));font: 14pt &quot;宋体&quot;;border-radius:5px;
}
#labtext{background-color: rgba(217, 217, 217, 120);border-radius:5px;font: 12pt &quot;宋体&quot;;border-radius:5px;
}</string></property><widget class="QFrame" name="frame"><property name="geometry"><rect><x>20</x><y>20</y><width>421</width><height>561</height></rect></property><property name="frameShape"><enum>QFrame::StyledPanel</enum></property><property name="frameShadow"><enum>QFrame::Raised</enum></property><widget class="QFrame" name="frame_2"><property name="geometry"><rect><x>40</x><y>30</y><width>341</width><height>501</height></rect></property><property name="frameShape"><enum>QFrame::StyledPanel</enum></property><property name="frameShadow"><enum>QFrame::Raised</enum></property><widget class="QLineEdit" name="lineEdit"><property name="geometry"><rect><x>80</x><y>150</y><width>181</width><height>41</height></rect></property><property name="font"><font><pointsize>13</pointsize></font></property><property name="placeholderText"><string> 设置时间x:x:x</string></property></widget><widget class="QPushButton" name="pushButton"><property name="geometry"><rect><x>80</x><y>220</y><width>181</width><height>41</height></rect></property><property name="font"><font><family>宋体</family><pointsize>14</pointsize><weight>50</weight><italic>false</italic><bold>false</bold></font></property><property name="text"><string>确认</string></property></widget><widget class="QLabel" name="labtext"><property name="geometry"><rect><x>40</x><y>300</y><width>261</width><height>131</height></rect></property><property name="text"><string/></property></widget></widget><widget class="QLabel" name="sys_time"><property name="geometry"><rect><x>0</x><y>0</y><width>91</width><height>21</height></rect></property><property name="text"><string/></property></widget></widget></widget><resources/><connections/>
</ui>

2.制作对话框,点击登录对话框,如果账号和密码匹配,则弹出信息对话框,给出提示登录成功,提供一个Ok按钮,用户点击OK后,关闭登录界面,跳转到其他界面;如果账号和密码不匹配,弹出错误对话框,给出信息"账号和密码不匹配,是否重新登录";并提供两个按钮Yes/No,用户点击Yes后,清除密码框中的内容,继续让用户进行登录,如果用户点击No按钮,则弹出一个问题对话框,给出信息"您是否确定要退出登录?“,并给出两个按钮Yes/No,用户点击Yes后,关闭登录界面,用户点击No后,关闭对话框,继续执行登录功能;要求:(基于属性版、静态成员函数都使用)实现对话框的弹出

代码:
widget.cpp:

#include "widget.h"
#include "ui_widget.h"Widget::Widget(QWidget *parent): QWidget(parent), ui(new Ui::Widget)
{ui->setupUi(this);this->setWindowTitle("Shanghai");//设置窗口标题this->setWindowIcon(QIcon(":/Logo/shangHai.jpg"));//设置窗口图标this->setWindowFlag(Qt::FramelessWindowHint);//隐藏窗口图标this->setAttribute(Qt::WA_TranslucentBackground);//去除多余空白部分connect(ui->pushButton_2,&QPushButton::clicked,this,&Widget::pushButton_2);//基于QT5版本,手动连接信号与槽,关闭按钮功能实现connect(ui->pushButton_3,&QPushButton::clicked,this,&Widget::pushButton_3);//基于QT5版本,手动连接信号与槽,最小化按钮功能实现connect(ui->lineEdit_2,&QLineEdit::editingFinished,this,&Widget::lineEdit_2);//获取密码,并进行相应处理}Widget::~Widget()
{delete ui;
}void Widget::pushButton_2()
{this->close();//关闭窗口
}void Widget::pushButton_3()
{this->showMinimized();//最小化
}
void Widget::lineEdit_2()
{if(ui->lineEdit_3->text()=="admin"&&ui->lineEdit_2->text()=="123456"){//判断登录账号密码是否一致QMessageBox BOX;//BOX.setFixedSize(400,800);//大小设置不生效BOX.setWindowIcon(QIcon(":/Logo/shangHai.jpg"));//自定义窗口图标BOX.setWindowTitle("提示");BOX.setText("登录成功");BOX.addButton(QMessageBox::Ok);BOX.exec();//调用对话框// QMessageBox::information(this, "登录成功","");this->close();//关闭窗口emit widet_singnal();//激活信号函数,跳转下一个窗口}else{//对话框提示登录失败//QMessageBox::information(this, "登录失败","");QMessageBox BOX;BOX.setWindowIcon(QIcon(":/Logo/shangHai.jpg"));//自定义窗口图标BOX.setWindowTitle("账户密码不匹配");BOX.setText("是否重新登录?");BOX.addButton(QMessageBox::Yes);BOX.addButton(QMessageBox::No);int ret=BOX.exec();//调用对话框if(ret==QMessageBox::Yes){ui->lineEdit_2->clear();ui->lineEdit_3->clear();//清空行编辑器}else{QMessageBox box;box.setWindowIcon(QIcon(":/Logo/shangHai.jpg"));//自定义窗口图标box.setWindowTitle("提示");box.setText("您是否确认退出登录?");box.addButton(QMessageBox::Yes);box.addButton(QMessageBox::No);int ret1=box.exec();//调用对话框if(ret1==QMessageBox::Yes){this->close();}else{ui->lineEdit_2->clear();ui->lineEdit_3->clear();//清空行编辑器}}}
}

dialog.cpp

#include "dialog.h"
#include "ui_dialog.h"Dialog::Dialog(QWidget *parent) :QDialog(parent),ui(new Ui::Dialog)
{ui->setupUi(this);this->setWindowTitle("Shanghai");//设置窗口标题this->setWindowIcon(QIcon(":/Logo/shangHai.jpg"));//设置窗口图标this->setWindowFlag(Qt::FramelessWindowHint);//隐藏窗口图标QMovie *mv=new QMovie(":/Logo/R-C.gif");//设置一个动态图对象指针接收动态图ui->label->setMovie(mv);//将动图设置到lab1标签中mv->start();//让动图动起来ui->label->setScaledContents(true);//让图片自适应标签设置大小}Dialog::~Dialog()
{delete ui;
}void Dialog::dialog_slots()
{this->show();//打开另一个窗口
}

main.cpp

#include "widget.h"
#include "dialog.h"
#include <QApplication>
#include<QMessageBox>
#include<QLabel>int main(int argc, char *argv[])
{QApplication a(argc, argv);Widget w;//实例化一个窗口w.show();Dialog d;//实例化另一个窗口QObject::connect(&w,&Widget::widet_singnal,&d,&Dialog::dialog_slots);//两个窗口建立连接return a.exec();
}

dialog.h

#ifndef DIALOG_H
#define DIALOG_H#include <QDialog>
#include <QIcon>
#include <QMovie>
namespace Ui {
class Dialog;
}class Dialog : public QDialog
{Q_OBJECTpublic:explicit Dialog(QWidget *parent = nullptr);~Dialog();
public slots:void dialog_slots();//定义槽函数,用于两个窗口建立连接private:Ui::Dialog *ui;
};#endif // DIALOG_H

widget.h

#ifndef WIDGET_H
#define WIDGET_H#include <QWidget>
#include <QMessageBox>
#include <QDebug>
QT_BEGIN_NAMESPACE
namespace Ui { class Widget; }
QT_END_NAMESPACEclass Widget : public QWidget
{Q_OBJECTpublic:Widget(QWidget *parent = nullptr);~Widget();
public slots:void pushButton_2();//x按钮槽函数void pushButton_3();//最小化槽函数void lineEdit_2();//密码行功能槽函数
signals:void widet_singnal();//定义信号函数,用于连接两个窗口
private:Ui::Widget *ui;
};#endif // WIDGET_H

widget.ui

<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0"><class>Widget</class><widget class="QWidget" name="Widget"><property name="geometry"><rect><x>0</x><y>0</y><width>332</width><height>376</height></rect></property><property name="windowTitle"><string>Widget</string></property><property name="styleSheet"><string notr="true">*{/*&quot;*&quot;是通配符,匹配所有*/background-color: rgb(255, 255, 255);color: rgba(255, 255, 255, 120);
}
QFrame#frame{/*“#”也是通配符,匹配一个*/border-image: url(:/Logo/shanChuan.jpg);
}
#frame_2{background-color: rgba(179, 179, 179, 120);
}
#label{background-color: rgba(71, 71, 71, 120);border-radius:20px;
}
#label_2{background:transparent; /*完全透明*/
}
#lineEdit_2{background:transparent; /*完全透明*/border:none;border-bottom:1px solid rgba(255, 255, 255, 120);/*保留底部边框*/font: 10pt &quot;等线&quot;;color: rgba(255, 255, 255, 120);
}
#lineEdit_3{background:transparent; /*完全透明*/border:none;font: 10pt &quot;等线&quot;;border-bottom:1px solid rgba(255, 255, 255, 120);color: rgba(255, 255, 255, 120);font: 10pt &quot;等线&quot;;
}
#pushButton{font: 10pt &quot;等线&quot;;background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:1, stop:0 rgba(58, 130, 205, 255), stop:1 rgba(255, 255, 255, 255));color: rgba(255, 255, 255, 120);border:none;border-radius:5px;
}
#pushButton:hover{/*鼠标移动*/font: 10pt &quot;等线&quot;;background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:1, stop:0 rgba(80, 130, 205, 255), stop:1 rgba(255, 255, 255, 255));color: rgba(255, 255, 255, 120);border:none;border-radius:5px;
}
#pushButton:pressed{/*鼠标按下特效*/font: 10pt &quot;等线&quot;;background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:1, stop:0 rgba(58, 130, 205, 255), stop:1 rgba(255, 255, 255, 255));color: rgba(255, 255, 255, 120);border:none;border-radius:5px;padding-top:5px;/*顶部抖动*/padding-left:5px;
}
#pushButton_2{background:transparent; /*完全透明*/color: rgba(255, 255, 255, 120);font: 10pt &quot;等线&quot;;
}
#pushButton_2:hover{background-color: rgb(255, 0, 0);color: rgba(255, 255, 255, 120);font: 10pt &quot;等线&quot;;
}
#pushButton_3{background:transparent; /*完全透明*/color: rgba(255, 255, 255, 120);font: 10pt &quot;等线&quot;;
}
#pushButton_3:hover{background-color: rgb(60, 239, 255);color: rgba(255, 255, 255, 120);font: 10pt &quot;等线&quot;;
}
#pushButton_4{background:transparent; /*完全透明*/color: rgba(255, 255, 255, 120);font: 10pt &quot;等线&quot;;
}
#pushButton_4:hover{background-color: rgb(60, 239, 255);color: rgba(255, 255, 255, 120);font: 10pt &quot;等线&quot;;
}</string></property><widget class="QFrame" name="frame"><property name="geometry"><rect><x>50</x><y>20</y><width>221</width><height>331</height></rect></property><property name="frameShape"><enum>QFrame::StyledPanel</enum></property><property name="frameShadow"><enum>QFrame::Raised</enum></property><widget class="QFrame" name="frame_2"><property name="geometry"><rect><x>-1</x><y>-1</y><width>231</width><height>341</height></rect></property><property name="frameShape"><enum>QFrame::StyledPanel</enum></property><property name="frameShadow"><enum>QFrame::Raised</enum></property><widget class="QLabel" name="label"><property name="geometry"><rect><x>30</x><y>40</y><width>161</width><height>271</height></rect></property><property name="text"><string/></property></widget><widget class="QLabel" name="label_2"><property name="geometry"><rect><x>70</x><y>60</y><width>81</width><height>41</height></rect></property><property name="font"><font><pointsize>15</pointsize></font></property><property name="text"><string>Log In</string></property></widget><widget class="QLineEdit" name="lineEdit_2"><property name="geometry"><rect><x>50</x><y>180</y><width>121</width><height>23</height></rect></property><property name="echoMode"><enum>QLineEdit::Password</enum></property><property name="placeholderText"><string> Passwd</string></property></widget><widget class="QLineEdit" name="lineEdit_3"><property name="geometry"><rect><x>50</x><y>140</y><width>121</width><height>23</height></rect></property><property name="placeholderText"><string>Username</string></property></widget><widget class="QPushButton" name="pushButton"><property name="geometry"><rect><x>60</x><y>240</y><width>101</width><height>24</height></rect></property><property name="text"><string>Log In</string></property></widget><widget class="QPushButton" name="pushButton_2"><property name="geometry"><rect><x>200</x><y>0</y><width>24</width><height>24</height></rect></property><property name="text"><string>X</string></property></widget><widget class="QPushButton" name="pushButton_3"><property name="geometry"><rect><x>170</x><y>0</y><width>24</width><height>24</height></rect></property><property name="text"><string>-</string></property></widget><widget class="QPushButton" name="pushButton_4"><property name="geometry"><rect><x>140</x><y>0</y><width>24</width><height>24</height></rect></property><property name="text"><string>?</string></property></widget></widget></widget></widget><resources/><connections/>
</ui>

dialog.ui

<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0"><class>Dialog</class><widget class="QDialog" name="Dialog"><property name="geometry"><rect><x>0</x><y>0</y><width>390</width><height>303</height></rect></property><property name="windowTitle"><string>Dialog</string></property><widget class="QDialogButtonBox" name="buttonBox"><property name="geometry"><rect><x>230</x><y>270</y><width>161</width><height>32</height></rect></property><property name="orientation"><enum>Qt::Horizontal</enum></property><property name="standardButtons"><set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set></property></widget><widget class="QLabel" name="label"><property name="geometry"><rect><x>0</x><y>0</y><width>391</width><height>271</height></rect></property><property name="text"><string/></property></widget><widget class="QLabel" name="label_2"><property name="geometry"><rect><x>10</x><y>280</y><width>211</width><height>16</height></rect></property><property name="text"><string>想欣赏妾身的舞姿吗</string></property></widget></widget><resources/><connections><connection><sender>buttonBox</sender><signal>accepted()</signal><receiver>Dialog</receiver><slot>accept()</slot><hints><hint type="sourcelabel"><x>248</x><y>254</y></hint><hint type="destinationlabel"><x>157</x><y>274</y></hint></hints></connection><connection><sender>buttonBox</sender><signal>rejected()</signal><receiver>Dialog</receiver><slot>reject()</slot><hints><hint type="sourcelabel"><x>316</x><y>260</y></hint><hint type="destinationlabel"><x>286</x><y>274</y></hint></hints></connection></connections>
</ui>

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/858355.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

SQL找出所有员工当前薪水salary情况

系列文章目录 文章目录 系列文章目录前言 前言 前些天发现了一个巨牛的人工智能学习网站&#xff0c;通俗易懂&#xff0c;风趣幽默&#xff0c;忍不住分享一下给大家。点击跳转到网站&#xff0c;这篇文章男女通用&#xff0c;看懂了就去分享给你的码吧。 描述 有一个薪水表…

Debian Linux安装minikubekubectl

minikube&kubectl minkube用于在本地开发环境中快速搭建一个单节点的Kubernetes集群,还有k3s&#xff0c;k3d&#xff0c;kind都是轻量级的k8skubectl是使用K8s API 与K8s集群的控制面进行通信的命令行工具 这里使用Debian Linux演示&#xff0c;其他系统安装见官网,首先…

红队内网攻防渗透:内网渗透之内网对抗:横向移动篇Kerberos委派安全RBCD资源Operators组成员HTLMRelay结合

基于资源的约束委派(RBCD)是在Windows Server 2012中新加入的功能,与传统的约束委派相比,它不再需要域管理员权限去设置相关属性。RBCD把设置委派的权限赋予了机器自身,既机器自己可以决定谁可以被委派来控制我。也就是说机器自身可以直接在自己账户上配置msDS-AllowedToAct…

使用SpringCache实现Redis缓存

目录 一 什么是Spring Cache 二 Spring Cache 各注解作用 ①EnableCaching ②Cacheable ③CachePut ④CacheEvict 三实现步骤 ①导入spring cache依赖和Redis依赖 ②配置Redis连接信息 ③在启动类上加上开启spring cache的注解 ④ 在对应的方法上加上需要的注解 一 什么…

green bamboo snake

green bamboo snake 【竹叶青蛇】 为什么写这个呢&#xff0c;因为回县城听说邻居有人被蛇咬伤&#xff0c;虽然不足以危及生命&#xff0c;严重的送去市里了。 1&#xff09;这种经常都是一动不动&#xff0c;会躲在草地、菜地的菜叶里面、果树上、有时候会到民房大厅休息&a…

什么是网络安全

标题&#xff1a;《网络安全&#xff1a;守护我们的数字世界》 在这个数字时代&#xff0c;网络已经成为了我们生活中不可或缺的一部分。我们用网络进行社交、购物、学习、工作等各种活动。然而&#xff0c;网络世界并非完全安全&#xff0c;网络安全威胁日益增加&#xff0c;…

Qt——系统

目录 概述 事件 鼠标事件 进入、离开事件 按下事件 释放事件 双击事件 移动事件 滚轮事件 按键事件 单个按键 组合按键 定时器 QTimerEvent QTimer 窗口事件 文件 输入输出设备 文件读写类 文件和目录信息类 多线程 常用API 线程安全 互斥锁 条件变量…

python列表常见去重方法

列表去重在python实际运用中&#xff0c;十分常见&#xff0c;也是最基础的重点知识。 1. 使用for循环实现列表去重 此方法去重后&#xff0c;原顺序保持不变。 # for循环实现列表去重 list1 [a, 4, 6, 4, b, hello, hello, world, 9, 9, 4, a] list2 [] for l1 in list1:…

光纤传感器十大品牌

十大光纤传感器品牌-光纤光栅传感器厂家哪家好-Maigoo品牌榜

Blazor js和c#互操作

c# 操作js 定义js变量 <img id"blazor_logo" />await js.InvokeVoidAsync("eval", "myimage document.getElementById(blazor_logo)"); js 操作c#

【chatgpt】train_split_test的random_state

在使用train_test_split函数划分数据集时&#xff0c;random_state参数用于控制随机数生成器的种子&#xff0c;以确保划分结果的可重复性。这样&#xff0c;无论你运行多少次代码&#xff0c;只要使用相同的random_state值&#xff0c;得到的训练集和测试集划分就会是一样的。…

导入别人的net文件报红问题sdk

1. 使用cmd命令 dotnet --info 查看自己使用的SDK版本 2.直接找到项目中的 global.json 文件&#xff0c;右键打开&#xff0c;直接修改版本为本机的SDK版本&#xff0c;就可以用了

使用Flink CDC实时监控MySQL数据库变更

在现代数据架构中&#xff0c;实时数据处理变得越来越重要。Flink CDC&#xff08;Change Data Capture&#xff09;是一种强大的工具&#xff0c;可以帮助我们实时捕获数据库的变更&#xff0c;并进行处理。本文将介绍如何使用Flink CDC从MySQL数据库中读取变更数据&#xff0…

在Qt、QtCreator和QMake中配置GCC编译开关

背景介绍 近期,我尝试使用Qt Creator 1.3.2、Qt 4.6.2和GCC 4.4.0(32位版本)在Windows 7(64位)上编译一个使用一些实验性的C++0x扩展的应用程序,结果遇到了以下致命错误: This file requires compiler and library support for the upcoming ISO C++ standard, C++0x.…

mysql 如何分配root账号创建数据库的权限

1.mysql 如何分配root账号创建数据库的权限 在 MySQL 中&#xff0c;root 用户通常具有所有的权限&#xff0c;包括创建数据库的权限。但是&#xff0c;如果我们想要为另一个用户分配创建数据库的权限&#xff0c;或者想要限制 root 用户对某个特定数据库或服务器的权限&#…

端到端自动驾驶的基础概念

欢迎大家关注我的B站&#xff1a; 偷吃薯片的Zheng同学的个人空间-偷吃薯片的Zheng同学个人主页-哔哩哔哩视频 (bilibili.com) 目录 1.端到端自动驾驶的定义 1.1特斯拉FSD 1.2端到端架构演进 1.3大模型 1.4世界模型 1.5纯视觉传感器 2.落地的挑战 1.端到端自动驾驶的定…

网络安全的重要性

网络安全的重要性 网络安全是指保护网络系统免受未授权的访问、攻击、破坏或未经授权的数据泄露的能力。随着互联网的普及和数字化进程的加速&#xff0c;网络安全问题日益凸显&#xff0c;成为个人、企业和国家必须面对的重要挑战。 网络安全的威胁 网络安全威胁包括黑客攻…

MySQL----利用Mycat配置读写分离

首先确保主从复制是正常的&#xff0c;具体步骤在MySQL----配置主从复制。MySQL----配置主从复制 环境 master(CtenOS7)&#xff1a;192.168.200.131 ----ifconfig查看->ens33->inetslave(win10)&#xff1a;192.168.207.52 ----ipconfig查看->无线局域网适配器 WLA…

whiteboard - 笔记

1 drawio draw.io GitHub - jgraph/drawio: draw.io is a JavaScript, client-side editor for general diagramming. 2 demo 可以将XML数据保存到服务器上的data目录。需要在服务器端创建一个接收和处理POST请求的脚本,该脚本将接收到的SVG数据保存到指定的文件中。下面是…

C语言封装获取本机IP地址的程序

文章目录 0.概要1. 设计2. 完整的代码ip_address.hip_address.cmain.c编译命令执行结果 0.概要 本文介绍用C语言编写一个函数来获取本机的IP地址。 1. 设计 将获取IP地址的逻辑封装到一个独立的函数中&#xff0c;并定义一个结构体来存储IP地址和接口名称。 将获取IP地址的逻…