From 56463aa6a357d9a958977a8d3ae35e5163ec61d6 Mon Sep 17 00:00:00 2001 From: ToSuperGod <42511736+ToSuperGod@users.noreply.github.com> Date: Wed, 12 Feb 2020 14:45:57 +0800 Subject: [PATCH 1/2] Add files via upload --- 2_Sing08.pro | 39 ++++++ 2_Sing08.pro.user | 328 ++++++++++++++++++++++++++++++++++++++++++++++ main.cpp | 11 ++ mainwidget.cpp | 53 ++++++++ mainwidget.h | 22 ++++ subwidget.cpp | 15 +++ subwidget.h | 23 ++++ 7 files changed, 491 insertions(+) create mode 100644 2_Sing08.pro create mode 100644 2_Sing08.pro.user create mode 100644 main.cpp create mode 100644 mainwidget.cpp create mode 100644 mainwidget.h create mode 100644 subwidget.cpp create mode 100644 subwidget.h diff --git a/2_Sing08.pro b/2_Sing08.pro new file mode 100644 index 0000000..341ceac --- /dev/null +++ b/2_Sing08.pro @@ -0,0 +1,39 @@ +#------------------------------------------------- +# +# Project created by QtCreator 2020-02-08T18:10:09 +# +#------------------------------------------------- + +QT += core gui + +greaterThan(QT_MAJOR_VERSION, 4): QT += widgets + +TARGET = 2_Sing08 +TEMPLATE = app + +# The following define makes your compiler emit warnings if you use +# any feature of Qt which has been marked as 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 you use 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 + +CONFIG += c++11 + +SOURCES += \ + main.cpp \ + mainwidget.cpp \ + subwidget.cpp + +HEADERS += \ + mainwidget.h \ + subwidget.h +CONFIG += C++11 +# Default rules for deployment. +qnx: target.path = /tmp/$${TARGET}/bin +else: unix:!android: target.path = /opt/$${TARGET}/bin +!isEmpty(target.path): INSTALLS += target diff --git a/2_Sing08.pro.user b/2_Sing08.pro.user new file mode 100644 index 0000000..8fe5938 --- /dev/null +++ b/2_Sing08.pro.user @@ -0,0 +1,328 @@ + + + + + + EnvironmentId + {a0c7aee2-8184-470e-a80d-feec8231cabf} + + + ProjectExplorer.Project.ActiveTarget + 0 + + + ProjectExplorer.Project.EditorSettings + + true + false + true + + Cpp + + CppGlobal + + + + QmlJS + + QmlJSGlobal + + + 2 + UTF-8 + false + 4 + false + 80 + true + true + 1 + true + false + 0 + true + true + 0 + 8 + true + 1 + true + true + true + false + + + + ProjectExplorer.Project.PluginSettings + + + -fno-delayed-template-parsing + + true + + + + ProjectExplorer.Project.Target.0 + + Desktop Qt 5.12.0 MinGW 64-bit + Desktop Qt 5.12.0 MinGW 64-bit + qt.qt5.5120.win64_mingw73_kit + 0 + 0 + 0 + + D:/PROGRAMS/Qt/build-2_Sing08-Desktop_Qt_5_12_0_MinGW_64_bit-Debug + + + true + qmake + + QtProjectManager.QMakeBuildStep + true + + false + false + false + + + true + Make + + Qt4ProjectManager.MakeStep + + false + + + false + + 2 + Build + + ProjectExplorer.BuildSteps.Build + + + + true + Make + + Qt4ProjectManager.MakeStep + + true + clean + + false + + 1 + Clean + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Debug + Debug + Qt4ProjectManager.Qt4BuildConfiguration + 2 + true + + + D:/PROGRAMS/Qt/build-2_Sing08-Desktop_Qt_5_12_0_MinGW_64_bit-Release + + + true + qmake + + QtProjectManager.QMakeBuildStep + false + + false + false + true + + + true + Make + + Qt4ProjectManager.MakeStep + + false + + + false + + 2 + Build + + ProjectExplorer.BuildSteps.Build + + + + true + Make + + Qt4ProjectManager.MakeStep + + true + clean + + false + + 1 + Clean + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Release + Release + Qt4ProjectManager.Qt4BuildConfiguration + 0 + true + + + D:/PROGRAMS/Qt/build-2_Sing08-Desktop_Qt_5_12_0_MinGW_64_bit-Profile + + + true + qmake + + QtProjectManager.QMakeBuildStep + true + + false + true + true + + + true + Make + + Qt4ProjectManager.MakeStep + + false + + + false + + 2 + Build + + ProjectExplorer.BuildSteps.Build + + + + true + Make + + Qt4ProjectManager.MakeStep + + true + clean + + false + + 1 + Clean + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Profile + Profile + Qt4ProjectManager.Qt4BuildConfiguration + 0 + true + + 3 + + + 0 + 部署 + + ProjectExplorer.BuildSteps.Deploy + + 1 + Deploy Configuration + + ProjectExplorer.DefaultDeployConfiguration + + 1 + + + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + 2_Sing08 + + Qt4ProjectManager.Qt4RunConfiguration:D:/PROGRAMS/Qt/2_Sing08/2_Sing08.pro + 2_Sing08.pro + + 3768 + false + true + true + false + false + true + + D:/PROGRAMS/Qt/build-2_Sing08-Desktop_Qt_5_12_0_MinGW_64_bit-Debug + + 1 + + + + ProjectExplorer.Project.TargetCount + 1 + + + ProjectExplorer.Project.Updater.FileVersion + 20 + + + Version + 20 + + diff --git a/main.cpp b/main.cpp new file mode 100644 index 0000000..6f07b28 --- /dev/null +++ b/main.cpp @@ -0,0 +1,11 @@ +#include "mainwidget.h" +#include + +int main(int argc, char *argv[]) +{ + QApplication a(argc, argv); + MainWidget w; + w.show(); + + return a.exec(); +} diff --git a/mainwidget.cpp b/mainwidget.cpp new file mode 100644 index 0000000..f013ed3 --- /dev/null +++ b/mainwidget.cpp @@ -0,0 +1,53 @@ +#include "mainwidget.h" +#include +MainWidget::MainWidget(QWidget *parent) + : QWidget(parent) +{ + + b1.setParent(this); + b1.setText("close"); + b1.move(100,100); + + b2 = new QPushButton(this); + b2->setText("lalala"); + + connect(&b1, &QPushButton::pressed,this,&MainWidget::close); + + connect(b2,&QPushButton::released,this,&MainWidget::mySlot); + connect(b2,&QPushButton::released,&b1,&QPushButton::hide); + + + setWindowTitle("老大"); + b3.setParent(this); + b3.setText("切换到子窗口"); + b3.move(50,50); + + //w.show(); + + //处理子窗口信号 + connect() + + QPushButton *b5 = new QPushButton(this); + b5->setText("Lambbda"); + int a=1,b=2; + connect(b5,&QPushButton::released(), + //= 把外部所有局部变量,类中所有成员一值传递 传进变量只读 修改加mutable + //& 外部所有局部变量 + //this 类中所有 + // ()中可以传参 + [=]() mutable + { + b5->setText("fa"); + qDebug() << "111"; + }) + +} + +void MainWidget::mySlot() +{ + b2->setText("123"); +} +MainWidget::~MainWidget() +{ + +} diff --git a/mainwidget.h b/mainwidget.h new file mode 100644 index 0000000..cf95815 --- /dev/null +++ b/mainwidget.h @@ -0,0 +1,22 @@ +#ifndef MAINWIDGET_H +#define MAINWIDGET_H + +#include +#include +#include "subwidget.h" +class MainWidget : public QWidget +{ + Q_OBJECT + +public: + MainWidget(QWidget *parent = 0); + ~MainWidget(); + void mySlot(); +private: + QPushButton b1; + QPushButton *b2; + QPushButton b3; + subWidget w; +}; + +#endif // MAINWIDGET_H diff --git a/subwidget.cpp b/subwidget.cpp new file mode 100644 index 0000000..0197c10 --- /dev/null +++ b/subwidget.cpp @@ -0,0 +1,15 @@ +#include "subwidget.h" + +subWidge::subWidge(QWidget *parent) : QWidget(parent) +{ + this->setWindowTitle("xiaodi"); + b4,setParent(this); + b4.setText("切换到主窗口"); + + connect(&b4,&QPushButton::clicked,this,&subWidge::sendSlot); +} + +void subWidge::sendSlot() +{ + emit mySignal(); +} diff --git a/subwidget.h b/subwidget.h new file mode 100644 index 0000000..c46f8de --- /dev/null +++ b/subwidget.h @@ -0,0 +1,23 @@ +#ifndef SUBWIDGE_H +#define SUBWIDGE_H + +#include +#include +class subWidge : public QWidget +{ + Q_OBJECT +public: + explicit subWidge(QWidget *parent = nullptr); + void sendSlot(); + +signals: + /*信号就是函数的声明,只需声明,无需定义*/ + void mySignal(); + +public slots: + +private: + QPushButton b4; +}; + +#endif // SUBWIDGE_H From 499cb82fc2e10792d270c6522481060e3f843089 Mon Sep 17 00:00:00 2001 From: ZiLong <42511736+ToSuperGod@users.noreply.github.com> Date: Fri, 16 Oct 2020 19:04:18 +0800 Subject: [PATCH 2/2] Update README.md --- README.md | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/README.md b/README.md index 903ccfa..4b5e0fe 100644 --- a/README.md +++ b/README.md @@ -1,19 +1 @@ -# practice -平时练习的代码 -import numpy as np -import matplotlib.pyplot as plt -import math -def draw_heart(): - t=np.linspace(0,math.pi,1000) - x=np.sin(t) - y=np.cos(t)+np.power(x,2.0/3) - plt.plot(x,y,color='red',linewidth=2,label='h') - plt.plot(-x,y,color='red',linewidth=2,label='h') - plt.fill_between(x, y, where=(2.310)) - plt.xlabel('t') - plt.ylabel('h') - plt.ylim(-2,2) - plt.xlim(-2,2) - plt.legend() - plt.show() -draw_heart() +为每日提高自己的练习代码