From c66ea918b0a45eec41de54c11118bda613e5a32c Mon Sep 17 00:00:00 2001 From: "touwoyimuli@gmail.com" Date: Thu, 22 Aug 2019 23:21:49 +0800 Subject: [PATCH] update --- QtQSliderEx/ExQSlider.cpp | 1 + QtQStringFunEx/ExQStringFun.cpp | 2 + QtQdialQLCDEx/ExQdialQLCD.cpp | 44 ++++++++++++++++++ QtQdialQLCDEx/ExQdialQLCD.h | 34 ++++++++++++++ QtQdialQLCDEx/ExQdialQLCD.ui | 79 ++++++++++++++++++++++++++++++++ QtQdialQLCDEx/QT_win_32x32.ico | Bin 0 -> 4286 bytes QtQdialQLCDEx/QtQdialQLCDEx.pro | 42 +++++++++++++++++ QtQdialQLCDEx/main.cpp | 11 +++++ 8 files changed, 213 insertions(+) create mode 100644 QtQdialQLCDEx/ExQdialQLCD.cpp create mode 100644 QtQdialQLCDEx/ExQdialQLCD.h create mode 100644 QtQdialQLCDEx/ExQdialQLCD.ui create mode 100644 QtQdialQLCDEx/QT_win_32x32.ico create mode 100644 QtQdialQLCDEx/QtQdialQLCDEx.pro create mode 100644 QtQdialQLCDEx/main.cpp diff --git a/QtQSliderEx/ExQSlider.cpp b/QtQSliderEx/ExQSlider.cpp index 38ff05d..989e487 100644 --- a/QtQSliderEx/ExQSlider.cpp +++ b/QtQSliderEx/ExQSlider.cpp @@ -7,6 +7,7 @@ ExQSlider::ExQSlider(QWidget *parent) : ui(new Ui::ExQSlider) { ui->setupUi(this); + setWindowTitle(QObject::tr("QSlider的用法")); //设置QSlider的最大值为255 (默认范围为0~100) ui->sliderRed->setMaximum(255); diff --git a/QtQStringFunEx/ExQStringFun.cpp b/QtQStringFunEx/ExQStringFun.cpp index 184a722..2689a46 100644 --- a/QtQStringFunEx/ExQStringFun.cpp +++ b/QtQStringFunEx/ExQStringFun.cpp @@ -6,6 +6,8 @@ ExQStringFun::ExQStringFun(QWidget* parent) : ui(new Ui::ExQStringFun) { ui->setupUi(this); + + setWindowTitle(QObject::tr("QString类的一些常用函数")); } ExQStringFun::~ExQStringFun() diff --git a/QtQdialQLCDEx/ExQdialQLCD.cpp b/QtQdialQLCDEx/ExQdialQLCD.cpp new file mode 100644 index 0000000..05742ec --- /dev/null +++ b/QtQdialQLCDEx/ExQdialQLCD.cpp @@ -0,0 +1,44 @@ +#include "ExQdialQLCD.h" +#include "ui_ExQdialQLCD.h" + +ExQdialQLCD::ExQdialQLCD(QWidget *parent) : + QWidget(parent), + ui(new Ui::ExQdialQLCD) +{ + ui->setupUi(this); + + //notchesVisible:表盘的小刻度是否可见 + //notchTarget:表盘刻度间间隔的像素值 + connect(ui->dial, SIGNAL(valueChanged(int)), this, SLOT(onDisplayLCD(int))); + setWindowTitle(QObject::tr("QDial表盘输入,在LCD以多种进制显示")); +} + +ExQdialQLCD::~ExQdialQLCD() +{ + delete ui; +} + +void ExQdialQLCD::onDisplayLCD(int val) +{ + ui->lcdNumber->display(val); +} + +void ExQdialQLCD::on_raidBtn2_clicked() //设置LCD显示二进制数 +{ + ui->lcdNumber->setBinMode(); +} + +void ExQdialQLCD::on_raidBtn8_clicked() //设置LCD显示八进制数 +{ + ui->lcdNumber->setOctMode(); +} + +void ExQdialQLCD::on_raidBtn10_clicked() //设置LCD显示十进制数 +{ + ui->lcdNumber->setDecMode(); +} + +void ExQdialQLCD::on_raidBtn16_clicked() //设置LCD显示十六进制数 +{ + ui->lcdNumber->setHexMode(); +} diff --git a/QtQdialQLCDEx/ExQdialQLCD.h b/QtQdialQLCDEx/ExQdialQLCD.h new file mode 100644 index 0000000..6a582e8 --- /dev/null +++ b/QtQdialQLCDEx/ExQdialQLCD.h @@ -0,0 +1,34 @@ +#ifndef EXQDIALQLCD_H +#define EXQDIALQLCD_H + +#include + +namespace Ui { +class ExQdialQLCD; +} + +class ExQdialQLCD : public QWidget +{ + Q_OBJECT + +public: + explicit ExQdialQLCD(QWidget *parent = nullptr); + ~ExQdialQLCD(); + +public slots: + void onDisplayLCD(int val); + +private slots: + void on_raidBtn2_clicked(); + + void on_raidBtn8_clicked(); + + void on_raidBtn10_clicked(); + + void on_raidBtn16_clicked(); + +private: + Ui::ExQdialQLCD *ui; +}; + +#endif // EXQDIALQLCD_H diff --git a/QtQdialQLCDEx/ExQdialQLCD.ui b/QtQdialQLCDEx/ExQdialQLCD.ui new file mode 100644 index 0000000..3663fa1 --- /dev/null +++ b/QtQdialQLCDEx/ExQdialQLCD.ui @@ -0,0 +1,79 @@ + + + ExQdialQLCD + + + + 0 + 0 + 537 + 149 + + + + ExQdialQLCD + + + + + + + + false + + + true + + + + + + + + + + + + LCD进制显示 + + + + + + 二进制 + + + + + + + 八进制 + + + + + + + 十进制 + + + true + + + + + + + 十六进制 + + + + + + + + + + + + diff --git a/QtQdialQLCDEx/QT_win_32x32.ico b/QtQdialQLCDEx/QT_win_32x32.ico new file mode 100644 index 0000000000000000000000000000000000000000..0ee0568945377c30d5d973d89afcc31770cd8818 GIT binary patch literal 4286 zcmeHKdr(y86+io87ZyYwA_hySrjx{)Njo~7w3D=Go0O&*)2xbtP|_lTj{v^F6l<|4 z!TRE16coi*F_>DPiHV~$YSL&Lgk=|&m4~p)V}S)!47%0a{(A22URjA+|FAR3OzzI_ zp6@&7JHKBO?Lu5#%-ZBiRg$@WRi6TzUI$u#k!Uz4@+6%sBmDt|-5nU_e| z7fHeg@p7SVjknOZZ=`Vjy7MivgQDE}G#O0Oe_VLG8&NBA&`P!TV~z&n1pb#e?G?}cIT z&=`F2_fRJW4~F8#u}5(8_!tb9kHklFz0kAS7lZplFi;kZfgNhJq$t6h5IOG!{VQ~X z2S8Ikg_Bh8jEmPp%hXZkq`TBPS!M-yb_T3X;-}6Hkc0Gxn(s1;a2I2DF zQMg(b%I!v@XIn5j-}YnqC>qnhiyATZjC(_j`NC+@{_Pi}tBIyBD_$a)m&h4GCPW}OX$I{VzbSW->umrt_;?Pqz6}FObux$xM$Ce*qcgVDYBr!b^G2IH$T7-M9pWr$KL5339F zo}z&LQ50A4GT};|0`{%`=qwIL&%P)$WlzGtbj%TV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5SUH(7$yHwU9E_`fj_S-voQd_h?I-zHrnpw?2gij z-{EgC0{=xY#Za*^hECprSzMPO*`&Ise3j1C#?pU`vAp+V`TP@Qj9B)BThF@M7+NdF zeV9*ulDwM1catZ?yUJY`?;tLlljN7h{yxmuB3Da>s;D`G&#eD}mJH?ThaFqwtIZ;> z_H5PDEm^7`+z-vm$p8Nl|69&)<_KWevy%75gMfQ0?xEpe)zGt&?Wg%a9&lRi!mwam F{Vzx7jH3Vm literal 0 HcmV?d00001 diff --git a/QtQdialQLCDEx/QtQdialQLCDEx.pro b/QtQdialQLCDEx/QtQdialQLCDEx.pro new file mode 100644 index 0000000..e81ce58 --- /dev/null +++ b/QtQdialQLCDEx/QtQdialQLCDEx.pro @@ -0,0 +1,42 @@ +#------------------------------------------------- +# +# Project created by QtCreator 2019-08-22T21:45:53 +# +#------------------------------------------------- + +QT += core gui + +greaterThan(QT_MAJOR_VERSION, 4): QT += widgets + +TARGET = QtQdialQLCDEx +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 \ + ExQdialQLCD.cpp + +HEADERS += \ + ExQdialQLCD.h + +FORMS += \ + ExQdialQLCD.ui + +RC_ICONS += QT_win_32x32.ico + +# 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/QtQdialQLCDEx/main.cpp b/QtQdialQLCDEx/main.cpp new file mode 100644 index 0000000..2da6046 --- /dev/null +++ b/QtQdialQLCDEx/main.cpp @@ -0,0 +1,11 @@ +#include "ExQdialQLCD.h" +#include + +int main(int argc, char *argv[]) +{ + QApplication a(argc, argv); + ExQdialQLCD w; + w.show(); + + return a.exec(); +}