diff --git a/day12/qtdemo3/main.cpp b/day12/qtdemo3/main.cpp deleted file mode 100755 index c3efeb4..0000000 --- a/day12/qtdemo3/main.cpp +++ /dev/null @@ -1,11 +0,0 @@ -#include "widget.h" - -#include - -int main(int argc, char *argv[]) -{ - QApplication a(argc, argv); - Widget w; - w.show(); - return a.exec(); -} diff --git a/day12/qtdemo3/qtdemo3.pro b/day12/qtdemo3/qtdemo3.pro deleted file mode 100755 index 632f97a..0000000 --- a/day12/qtdemo3/qtdemo3.pro +++ /dev/null @@ -1,34 +0,0 @@ -QT += core gui - -greaterThan(QT_MAJOR_VERSION, 4): QT += widgets - -CONFIG += c++11 - -# The following define makes your compiler emit warnings if you use -# any Qt feature that has been marked deprecated (the exact warnings -# depend on your compiler). Please consult the documentation of the -# deprecated API in order to know how to port your code away from it. -DEFINES += QT_DEPRECATED_WARNINGS - -# You can also make your code fail to compile if it uses deprecated APIs. -# In order to do so, uncomment the following line. -# You can also select to disable deprecated APIs only up to a certain version of Qt. -#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 - -SOURCES += \ - main.cpp \ - widget.cpp - -HEADERS += \ - widget.h - -FORMS += \ - widget.ui - -# Default rules for deployment. -qnx: target.path = /tmp/$${TARGET}/bin -else: unix:!android: target.path = /opt/$${TARGET}/bin -!isEmpty(target.path): INSTALLS += target - -RESOURCES += \ - res.qrc diff --git a/day12/qtdemo3/res.qrc b/day12/qtdemo3/res.qrc deleted file mode 100755 index 744a169..0000000 --- a/day12/qtdemo3/res.qrc +++ /dev/null @@ -1,10 +0,0 @@ - - - resources/add.png - resources/mario.gif - resources/open.png - resources/save.png - resources/Sunny.jpg - - - diff --git a/day12/qtdemo3/resources/Sunny.jpg b/day12/qtdemo3/resources/Sunny.jpg deleted file mode 100755 index 1eea0c4..0000000 Binary files a/day12/qtdemo3/resources/Sunny.jpg and /dev/null differ diff --git a/day12/qtdemo3/resources/add.png b/day12/qtdemo3/resources/add.png deleted file mode 100755 index 8c41538..0000000 Binary files a/day12/qtdemo3/resources/add.png and /dev/null differ diff --git a/day12/qtdemo3/resources/mario.gif b/day12/qtdemo3/resources/mario.gif deleted file mode 100755 index c38a831..0000000 Binary files a/day12/qtdemo3/resources/mario.gif and /dev/null differ diff --git a/day12/qtdemo3/resources/open.png b/day12/qtdemo3/resources/open.png deleted file mode 100755 index 1282b1e..0000000 Binary files a/day12/qtdemo3/resources/open.png and /dev/null differ diff --git a/day12/qtdemo3/resources/save.png b/day12/qtdemo3/resources/save.png deleted file mode 100755 index 4e33bd4..0000000 Binary files a/day12/qtdemo3/resources/save.png and /dev/null differ diff --git a/day12/qtdemo3/widget.cpp b/day12/qtdemo3/widget.cpp deleted file mode 100755 index 37c8612..0000000 --- a/day12/qtdemo3/widget.cpp +++ /dev/null @@ -1,99 +0,0 @@ -#include "widget.h" -#include "ui_widget.h" -#include - - -Widget::Widget(QWidget *parent) - : QWidget(parent) - , ui(new Ui::Widget) -{ - n=0; - ui->setupUi(this); - - // 设置 imageLable 的图片资源 - QPixmap pixmap; - // : 开头表示引用 Qt 的资源文件 - pixmap.load(":/images/mario"); // 加载像素图 - ui->imageLable->resize(200,200); - ui->imageLable->setPixmap(pixmap); // 设置 QLable 显示图片 - - marioGif = new QMovie(":/images/mario"); - ui->imageLable->setMovie(marioGif); - -} - -Widget::~Widget() -{ - delete ui; -} - - -void Widget::on_hotBtn_clicked() -{ - ui->whatLable->setText("巧乐兹"); -} - -void Widget::on_coldBtn_clicked() -{ - ui->whatLable->setText("厚棉被"); -} - -void Widget::on_coldBtn_2_clicked() -{ - -} - -void Widget::on_setTitleIconBtn_clicked() -{ - n++; - if(n%2==0){ - - this->setWindowIcon(QIcon(":/images/save")); - this->setWindowTitle("标题被修改了"); - showMaximized(); - } else{ - this->setWindowIcon(QIcon("")); - this->setWindowTitle(""); - showNormal(); - } -} - -void Widget::on_showImg_pressed() -{ - //ui->imageLable->hide(); - marioGif->start(); -} - -void Widget::on_showImg_released() -{ - marioGif->stop(); - //ui->imageLable->show(); -} - -void Widget::on_setImgBtn_pressed() -{ - QPixmap pixmap2; - pixmap2.load(":/images/sunny"); - - ui->showImg->setText(""); - ui->showImg->setIconSize(QSize(200,200)); - ui->showImg->setIcon(pixmap2); -} - -void Widget::on_setImgBtn_released() -{ - ui->showImg->setText("图片运输中"); - ui->showImg->setIcon(QPixmap()); -} - -void Widget::on_setbgBtn_clicked() -{ -// setStyleSheet("background-color: red; color: white; font-size: 16px;"); - //setStyleSheet("background: qlineargradient(x1:0, y1:0, x2:1, y2:0, stop:0 #FF0000, stop:0.17 #FF7F00, stop:0.33 #FFFF00, stop:0.5 #00FF00, stop:0.67 #0000FF, stop:0.83 #4B0082, stop:1 #8B00FF);"); - //QString styleSheet = "background: qlineargradient(x1:0, y1:0, x2:1, y2:0, stop:0.5 #000000, stop:0 #FF00F0,stop:1 #0F0F0F);"; - //setStyleSheet(styleSheet); - showFullScreen(); - - -} - diff --git a/day12/qtdemo3/widget.h b/day12/qtdemo3/widget.h deleted file mode 100755 index c036e5e..0000000 --- a/day12/qtdemo3/widget.h +++ /dev/null @@ -1,49 +0,0 @@ -#ifndef WIDGET_H -#define WIDGET_H - -#include -#include - -QT_BEGIN_NAMESPACE -namespace Ui { class Widget; } -QT_END_NAMESPACE - -class Widget : public QWidget -{ - Q_OBJECT - -private: - int n; - -public: - Widget(QWidget *parent = nullptr); - ~Widget(); - -private slots: - void on_hotBtn_clicked(); - - void on_coldBtn_clicked(); - - void on_coldBtn_2_clicked(); - - void on_setTitleIconBtn_clicked(); - - void on_setImgBtn_clicked(); - - void on_showImg_pressed(); - - void on_showImg_released(); - - void on_setImgBtn_pressed(); - - void on_setImgBtn_released(); - - void on_setbgBtn_clicked(bool checked); - - void on_setbgBtn_clicked(); - -private: - Ui::Widget *ui; - QMovie *marioGif; -}; -#endif // WIDGET_H diff --git a/day12/qtdemo3/widget.ui b/day12/qtdemo3/widget.ui deleted file mode 100755 index e3c6563..0000000 --- a/day12/qtdemo3/widget.ui +++ /dev/null @@ -1,216 +0,0 @@ - - - Widget - - - - 0 - 0 - 654 - 476 - - - - OpenHandCursor - - - Widget - - - - :/images/open:/images/open - - - - - 170 - 8 - 201 - 81 - - - - ClosedHandCursor - - - font: 36pt "华文隶书"; -alternate-background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 rgba(9, 41, 4, 255), stop:0.085 rgba(2, 79, 0, 255), stop:0.19 rgba(50, 147, 22, 255), stop:0.275 rgba(236, 191, 49, 255), stop:0.39 rgba(243, 61, 34, 255), stop:0.555 rgba(135, 81, 60, 255), stop:0.667 rgba(121, 75, 255, 255), stop:0.825 rgba(164, 255, 244, 255), stop:0.885 rgba(104, 222, 71, 255), stop:1 rgba(93, 128, 0, 255)); -color: rgb(255, 85, 255); - - - 热了 - - - - 37 - 55 - - - - - - - 10 - 110 - 191 - 69 - - - - WhatsThisCursor - - - background-color: rgb(0, 170, 255); -font: 18pt "华文琥珀"; - - - 出门买啥? - - - - - - 230 - 120 - 361 - 141 - - - - SizeBDiagCursor - - - Qt::RightToLeft - - - background-color: rgb(255, 85, 0); -color: rgb(255, 255, 255); -background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 rgba(255, 0, 0, 255), stop:0.166 rgba(255, 255, 0, 255), stop:0.333 rgba(0, 255, 0, 255), stop:0.5 rgba(0, 255, 255, 255), stop:0.666 rgba(0, 0, 255, 255), stop:0.833 rgba(255, 0, 255, 255), stop:1 rgba(255, 0, 0, 255)); -font: 72pt "华文彩云"; - - - - - - - - - 410 - 10 - 201 - 81 - - - - CrossCursor - - - font: 36pt "华文隶书"; -selection-background-color: rgb(255, 170, 127); -color: rgb(170, 255, 255); - - - 冻着了 - - - - - true - - - - 20 - 260 - 121 - 121 - - - - WaitCursor - - - - - - - - - 240 - 300 - 191 - 49 - - - - SizeHorCursor - - - font: 28pt "华文隶书"; - - - - 设置图片 - - - - - - 240 - 400 - 191 - 49 - - - - UpArrowCursor - - - font: 18pt "华文隶书"; - - - - 标题Icon修改 - - - - - - 440 - 280 - 201 - 181 - - - - ForbiddenCursor - - - 图片正在派送中 - - - - - - 20 - 40 - 141 - 49 - - - - UpArrowCursor - - - font: 18pt "华文隶书"; - - - - 背景修改 - - - - - - - - diff --git a/day12/qtdemo4/main.cpp b/day12/qtdemo4/main.cpp deleted file mode 100755 index c3efeb4..0000000 --- a/day12/qtdemo4/main.cpp +++ /dev/null @@ -1,11 +0,0 @@ -#include "widget.h" - -#include - -int main(int argc, char *argv[]) -{ - QApplication a(argc, argv); - Widget w; - w.show(); - return a.exec(); -} diff --git a/day12/qtdemo4/qtdemo4 b/day12/qtdemo4/qtdemo4 deleted file mode 100755 index 87e8cde..0000000 Binary files a/day12/qtdemo4/qtdemo4 and /dev/null differ diff --git a/day12/qtdemo4/qtdemo4.pro b/day12/qtdemo4/qtdemo4.pro deleted file mode 100755 index 632f97a..0000000 --- a/day12/qtdemo4/qtdemo4.pro +++ /dev/null @@ -1,34 +0,0 @@ -QT += core gui - -greaterThan(QT_MAJOR_VERSION, 4): QT += widgets - -CONFIG += c++11 - -# The following define makes your compiler emit warnings if you use -# any Qt feature that has been marked deprecated (the exact warnings -# depend on your compiler). Please consult the documentation of the -# deprecated API in order to know how to port your code away from it. -DEFINES += QT_DEPRECATED_WARNINGS - -# You can also make your code fail to compile if it uses deprecated APIs. -# In order to do so, uncomment the following line. -# You can also select to disable deprecated APIs only up to a certain version of Qt. -#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 - -SOURCES += \ - main.cpp \ - widget.cpp - -HEADERS += \ - widget.h - -FORMS += \ - widget.ui - -# Default rules for deployment. -qnx: target.path = /tmp/$${TARGET}/bin -else: unix:!android: target.path = /opt/$${TARGET}/bin -!isEmpty(target.path): INSTALLS += target - -RESOURCES += \ - res.qrc diff --git a/day12/qtdemo4/res.qrc b/day12/qtdemo4/res.qrc deleted file mode 100755 index 44fa5b0..0000000 --- a/day12/qtdemo4/res.qrc +++ /dev/null @@ -1,5 +0,0 @@ - - - resources/yanhua1.gif - - diff --git a/day12/qtdemo4/resources/yanhua1.gif b/day12/qtdemo4/resources/yanhua1.gif deleted file mode 100755 index e9b4bf5..0000000 Binary files a/day12/qtdemo4/resources/yanhua1.gif and /dev/null differ diff --git a/day12/qtdemo4/widget.cpp b/day12/qtdemo4/widget.cpp deleted file mode 100755 index 0a141d1..0000000 --- a/day12/qtdemo4/widget.cpp +++ /dev/null @@ -1,45 +0,0 @@ -#include "widget.h" -#include "ui_widget.h" - - -Widget::Widget(QWidget *parent) - : QWidget(parent) - , ui(new Ui::Widget) -{ - ui->setupUi(this); - - // 加载动画资源 - yanhuagif = new QMovie(":/movies/yanhua"); - - srand(time(NULL)); - randNum = rand() % 10; // 0-9的数 - - // 开启定时器, 用于定时换随机数 - timer = new QTimer(); - connect(timer,&QTimer::timeout,[&](){ - randNum = rand() % 10; - }); - timer->start(5*1000); // 5秒 - - -} - -Widget::~Widget() -{ - delete ui; -} - - -void Widget::on_pushButton_clicked() -{ - guessNum = ui->numEdit->text().toInt(); - qDebug() << "随机数:" << randNum << "输入的数" << guessNum << endl; - if(guessNum == randNum){ - ui->resaultShowLabel->setMovie(yanhuagif); - yanhuagif->start(); - } else { - if(yanhuagif->state() == QMovie::Running) - yanhuagif->stop(); - ui->resaultShowLabel->setText("你猜错了, 正确的结果是:"+ QString::number(randNum)); - } -} diff --git a/day12/qtdemo4/widget.h b/day12/qtdemo4/widget.h deleted file mode 100755 index 066de23..0000000 --- a/day12/qtdemo4/widget.h +++ /dev/null @@ -1,32 +0,0 @@ -#ifndef WIDGET_H -#define WIDGET_H - -#include -#include -#include -#include -#include - -QT_BEGIN_NAMESPACE -namespace Ui { class Widget; } -QT_END_NAMESPACE - -class Widget : public QWidget -{ - Q_OBJECT - -public: - Widget(QWidget *parent = nullptr); - ~Widget(); - -private slots: - void on_pushButton_clicked(); - -private: - Ui::Widget *ui; - int guessNum = 0; - int randNum = 0; - QMovie *yanhuagif; - QTimer *timer; -}; -#endif // WIDGET_H diff --git a/day12/qtdemo4/widget.ui b/day12/qtdemo4/widget.ui deleted file mode 100755 index a005c35..0000000 --- a/day12/qtdemo4/widget.ui +++ /dev/null @@ -1,103 +0,0 @@ - - - Widget - - - - 0 - 0 - 500 - 400 - - - - Widget - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - padding:5px; -font: 18pt "Agency FB"; - - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - font: 18pt "Agency FB"; - - - 猜一猜 - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - Qt::Horizontal - - - - - - - - - TextLabel - - - - - - - - - -