当前位置: 首页 > news >正文

宁波seo怎么做推广渠道中国seo关键词优化工具

宁波seo怎么做推广渠道,中国seo关键词优化工具,网站建设职位有什么,wordpress login 图标文章目录 完成效果图ui界面ui样图 main函数窗口文件头文件cpp文件 引言 一般定时关机采用命令行模式&#xff0c;还需要我们计算在多久后关机&#xff0c;我们可以做一个小程序来定时关机 完成效果图 ui界面 <?xml version"1.0" encoding"UTF-8"?>…

文章目录

  • 完成效果图
  • ui界面
    • ui样图
  • main函数
  • 窗口文件
    • 头文件
    • cpp文件

引言

一般定时关机采用命令行模式,还需要我们计算在多久后关机,我们可以做一个小程序来定时关机

在这里插入图片描述

完成效果图

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

ui界面

<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0"><class>MainWindow</class><widget class="QMainWindow" name="MainWindow"><property name="geometry"><rect><x>0</x><y>0</y><width>330</width><height>240</height></rect></property><property name="minimumSize"><size><width>330</width><height>240</height></size></property><property name="maximumSize"><size><width>330</width><height>240</height></size></property><property name="font"><font><pointsize>10</pointsize></font></property><widget class="QWidget" name="centralwidget"><layout class="QGridLayout" name="gridLayout_2"><item row="3" column="1"><widget class="QWidget" name="widget" native="true"><layout class="QGridLayout" name="gridLayout"><item row="2" column="0"><layout class="QHBoxLayout" name="horizontalLayout_2"><item><widget class="QPushButton" name="shutdownButton"><property name="text"><string>关机</string></property></widget></item><item><widget class="QPushButton" name="cancelShutdownButton"><property name="text"><string>取消</string></property></widget></item></layout></item><item row="0" column="0"><layout class="QHBoxLayout" name="horizontalLayout"><item><widget class="QComboBox" name="hourComboBox"><property name="minimumSize"><size><width>62</width><height>22</height></size></property><property name="maximumSize"><size><width>62</width><height>22</height></size></property><property name="editable"><bool>false</bool></property></widget></item><item><widget class="QLabel" name="hourLabel"><property name="minimumSize"><size><width>0</width><height>0</height></size></property><property name="text"><string>时</string></property></widget></item><item><spacer name="horizontalSpacer_3"><property name="orientation"><enum>Qt::Horizontal</enum></property><property name="sizeHint" stdset="0"><size><width>40</width><height>20</height></size></property></spacer></item><item><widget class="QComboBox" name="minuteComboBox"><property name="minimumSize"><size><width>62</width><height>22</height></size></property><property name="maximumSize"><size><width>62</width><height>22</height></size></property><property name="editable"><bool>false</bool></property></widget></item><item><widget class="QLabel" name="minuteLabel"><property name="text"><string>分</string></property></widget></item></layout></item><item row="1" column="0"><spacer name="verticalSpacer_4"><property name="orientation"><enum>Qt::Vertical</enum></property><property name="sizeHint" stdset="0"><size><width>20</width><height>30</height></size></property></spacer></item></layout></widget></item><item row="3" column="0"><spacer name="horizontalSpacer"><property name="orientation"><enum>Qt::Horizontal</enum></property><property name="sizeHint" stdset="0"><size><width>40</width><height>20</height></size></property></spacer></item><item row="0" column="1"><spacer name="verticalSpacer_2"><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 row="4" column="1"><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 row="3" column="2"><spacer name="horizontalSpacer_2"><property name="orientation"><enum>Qt::Horizontal</enum></property><property name="sizeHint" stdset="0"><size><width>40</width><height>20</height></size></property></spacer></item><item row="1" column="1"><widget class="QLabel" name="label"><property name="minimumSize"><size><width>186</width><height>30</height></size></property><property name="maximumSize"><size><width>186</width><height>30</height></size></property><property name="text"><string>                   设置关机时间</string></property></widget></item><item row="2" column="1"><spacer name="verticalSpacer_3"><property name="orientation"><enum>Qt::Vertical</enum></property><property name="sizeHint" stdset="0"><size><width>20</width><height>30</height></size></property></spacer></item></layout></widget></widget><resources/><connections/>
</ui>

ui样图

在这里插入图片描述

main函数

#include "mainwindow.h"#include <QApplication>int main(int argc, char *argv[])
{QApplication a(argc, argv);MainWindow w;w.show();return a.exec();
}

窗口文件

核心逻辑
采用信号和槽,完成事件链接

 QProcess::startDetached("shutdown", QStringList() << "/s" << "/t" << QString::number(timeSeconds));
 QProcess::execute("shutdown", QStringList() << "/a");

头文件

// mainwindow.h
#ifndef MAINWINDOW_H
#define MAINWINDOW_H#include <QMainWindow>
#include <QTimer>
#include <QDateTime>
#include <QProcess>
#include <QMessageBox>
#include <QString>
#include <QDebug>namespace Ui {
class MainWindow;
}class MainWindow : public QMainWindow
{Q_OBJECTpublic:explicit MainWindow(QWidget *parent = nullptr);~MainWindow();
private slots:void onShutdownButtonClicked();void onCancelShutdownButtonClicked();private:Ui::MainWindow *ui;QTimer *shutdownTimer;};#endif // MAINWINDOW_H

cpp文件

// mainwindow.cpp#include "mainwindow.h"
#include "ui_mainwindow.h"MainWindow::MainWindow(QWidget *parent) :QMainWindow(parent),ui(new Ui::MainWindow)
{ui->setupUi(this);// 获取当前时间QTime currentTime = QTime::currentTime();// 设置小时下拉框ui->hourComboBox->setEditable(false);for (int i = 0; i < 24; ++i) {// 比较当前时间与选项时间if (currentTime.hour() <= i) {ui->hourComboBox->addItem(QString::number(i));}}// 选择当前小时作为已选中项ui->hourComboBox->setCurrentIndex(ui->hourComboBox->findText(QString::number(currentTime.hour())));// 设置分钟下拉框ui->minuteComboBox->setEditable(false);for (int i = 0; i < 60; ++i) {// 比较当前时间与选项时间if (currentTime.minute() <= i) {ui->minuteComboBox->addItem(QString::number(i));}}// 选择当前分钟作为已选中项ui->minuteComboBox->setCurrentIndex(ui->minuteComboBox->findText(QString::number(currentTime.minute())));// 连接按钮点击事件到槽函数connect(ui->shutdownButton, &QPushButton::clicked, this, &MainWindow::onShutdownButtonClicked);connect(ui->cancelShutdownButton, &QPushButton::clicked, this, &MainWindow::onCancelShutdownButtonClicked);
}MainWindow::~MainWindow()
{delete ui;
}void MainWindow::onShutdownButtonClicked()
{// 获取用户选择的小时和分钟int selectedHour = ui->hourComboBox->currentText().toInt();int selectedMinute = ui->minuteComboBox->currentText().toInt();// 获取当前时间QDateTime currentTime = QDateTime::currentDateTime();// 获取用户选择的时间QDateTime shutdownTime = QDateTime(currentTime.date(), QTime(selectedHour, selectedMinute));// 计算时间差qint64 timeDifference = currentTime.msecsTo(shutdownTime);int timeSeconds=int(timeDifference/1000);// 设置定时器的超时时间//shutdownTimer->start(timeDifference);QProcess::startDetached("shutdown", QStringList() << "/s" << "/t" << QString::number(timeSeconds));// 提示用户关机已设置QMessageBox::information(this, "关机设置", "关机已设置,将在选择的时间执行!");
}void MainWindow::onCancelShutdownButtonClicked()
{// 取消关机QProcess::execute("shutdown", QStringList() << "/a");QMessageBox::information(this, "取消关机", "已取消关机操作!");
}
http://www.ritt.cn/news/12459.html

相关文章:

  • 国内做网站比较好的公司有哪些好123上网主页
  • 建个小型网站虚拟主机 vps自动点击器
  • 快站优惠券app百度排名优化软件
  • 国内 设计网站的公司网站广告推广
  • 开封市住房和城乡建设网站网络推广 网站制作
  • 学编程哪家培训机构好企业seo整站优化方案
  • 做设计什么网站兼职站长工具是做什么的
  • 佛山网站建设机构如何优化网络环境
  • 高效网站建设咨询咸阳网站建设公司
  • wordpress添加文字alt深圳优化公司排名
  • 电销如何介绍网站建设岳阳seo
  • 美容院门户网站开发枸橼酸西地那非片是什么
  • 一个网站 多个域名网站是怎么做出来的
  • 手机显示的网站该怎样设计2000元代理微信朋友圈广告
  • 对方把我的网站他网站内页友情链接 站长工具检测到是无反链常州百度推广公司
  • 做耳机套的网站谷歌三件套一键安装
  • 品牌网站建设解决方案乔拓云网站注册
  • 盐城做网站的公司地址今日头条热点新闻
  • 天津做网站多少钱免费做网站怎么做网站链接
  • 绵阳网站建设优化百度账号购买1元40个
  • 加强网站建设和维护工作网络营销的定义是什么
  • 成都沐塔通讯5g网站建设项目一个新产品怎么推广
  • 滨州网站建设报价关键词优化排名费用
  • 有域名怎么建设网站正规营销培训
  • 采购平台排名网站seo推广方案
  • wordpress如何自建站郑州官网网站优化公司
  • 网站建设|免费seo公司
  • html好看的个人主页建站网站关键词优化
  • 轻松网站建设数据分析一般用什么软件
  • html网页设计作业成品免费石家庄网站seo外包