From b57b29e2899a81c5723074bca9fd47810ec76d18 Mon Sep 17 00:00:00 2001 From: feiyangqingyun Date: Mon, 28 Oct 2019 13:50:59 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=96=87=E6=9C=AC=E6=A1=86?= =?UTF-8?q?=E5=9B=9E=E8=BD=A6=E7=84=A6=E7=82=B9=E4=B8=8B=E7=A7=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 3 +- lineeditnext/lineeditnext.pro | 31 ++++++++ lineeditnext/main.cpp | 11 +++ lineeditnext/widget.cpp | 30 ++++++++ lineeditnext/widget.h | 25 +++++++ lineeditnext/widget.ui | 50 +++++++++++++ styledemo/readme.txt | 134 ---------------------------------- 7 files changed, 149 insertions(+), 135 deletions(-) create mode 100644 lineeditnext/lineeditnext.pro create mode 100644 lineeditnext/main.cpp create mode 100644 lineeditnext/widget.cpp create mode 100644 lineeditnext/widget.h create mode 100644 lineeditnext/widget.ui delete mode 100644 styledemo/readme.txt diff --git a/README.md b/README.md index f65922b..aa569c8 100644 --- a/README.md +++ b/README.md @@ -21,4 +21,5 @@ | 18 | saveruntime | 运行时间记录类 | | 19 | colorwidget | 颜色拾取器 | | 20 | maskwidget | 遮罩层窗体 | -| 21 | battery | 电池电量控件 | \ No newline at end of file +| 21 | battery | 电池电量控件 | +| 22 | lineeditnext | 文本框回车焦点下移 | \ No newline at end of file diff --git a/lineeditnext/lineeditnext.pro b/lineeditnext/lineeditnext.pro new file mode 100644 index 0000000..3511465 --- /dev/null +++ b/lineeditnext/lineeditnext.pro @@ -0,0 +1,31 @@ +#------------------------------------------------- +# +# Project created by QtCreator 2019-10-28T13:44:49 +# +#------------------------------------------------- + +QT += core gui + +greaterThan(QT_MAJOR_VERSION, 4): QT += widgets + +TARGET = lineeditnext +TEMPLATE = app + +# The following define makes your compiler emit warnings if you use +# any feature of Qt which as 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 + + +SOURCES += main.cpp\ + widget.cpp + +HEADERS += widget.h + +FORMS += widget.ui diff --git a/lineeditnext/main.cpp b/lineeditnext/main.cpp new file mode 100644 index 0000000..90b6d53 --- /dev/null +++ b/lineeditnext/main.cpp @@ -0,0 +1,11 @@ +#include "widget.h" +#include + +int main(int argc, char *argv[]) +{ + QApplication a(argc, argv); + Widget w; + w.show(); + + return a.exec(); +} diff --git a/lineeditnext/widget.cpp b/lineeditnext/widget.cpp new file mode 100644 index 0000000..b31e132 --- /dev/null +++ b/lineeditnext/widget.cpp @@ -0,0 +1,30 @@ +#include "widget.h" +#include "ui_widget.h" +#include "qlineedit.h" + +Widget::Widget(QWidget *parent) : + QWidget(parent), + ui(new Ui::Widget) +{ + ui->setupUi(this); + connect(ui->lineEdit1, SIGNAL(returnPressed()), this, SLOT(next())); + connect(ui->lineEdit2, SIGNAL(returnPressed()), this, SLOT(next())); + connect(ui->lineEdit3, SIGNAL(returnPressed()), this, SLOT(next())); +} + +Widget::~Widget() +{ + delete ui; +} + +void Widget::next() +{ + QLineEdit *lineEdit = (QLineEdit *)sender(); + if (lineEdit == ui->lineEdit1) { + ui->lineEdit2->setFocus(); + } else if (lineEdit == ui->lineEdit2) { + ui->lineEdit3->setFocus(); + } else if (lineEdit == ui->lineEdit3) { + ui->lineEdit1->setFocus(); + } +} diff --git a/lineeditnext/widget.h b/lineeditnext/widget.h new file mode 100644 index 0000000..c8e961f --- /dev/null +++ b/lineeditnext/widget.h @@ -0,0 +1,25 @@ +#ifndef WIDGET_H +#define WIDGET_H + +#include + +namespace Ui { +class Widget; +} + +class Widget : public QWidget +{ + Q_OBJECT + +public: + explicit Widget(QWidget *parent = 0); + ~Widget(); + +private: + Ui::Widget *ui; + +private slots: + void next(); +}; + +#endif // WIDGET_H diff --git a/lineeditnext/widget.ui b/lineeditnext/widget.ui new file mode 100644 index 0000000..66ff09d --- /dev/null +++ b/lineeditnext/widget.ui @@ -0,0 +1,50 @@ + + + Widget + + + + 0 + 0 + 400 + 300 + + + + Widget + + + + + 10 + 10 + 113 + 20 + + + + + + + 10 + 40 + 113 + 20 + + + + + + + 10 + 70 + 113 + 20 + + + + + + + + diff --git a/styledemo/readme.txt b/styledemo/readme.txt deleted file mode 100644 index ee25995..0000000 --- a/styledemo/readme.txt +++ /dev/null @@ -1,134 +0,0 @@ -PS:本样式demo完全开源。 - -V20170219首版开发计划 -1:所有其他窗体都是其布居中的widget。 -2:左上角图标、标题、标题居中、右上角最小化最大化关闭都可设置,包括设置样式+图标+图形字体(默认图形字体)。 -3:左上角图标及右上角三个按钮可视化控制。同时提供外部访问权限。 -4:无边框窗体可拉伸控制。 -5:提供换肤接口,内置8套样式选择,也可自定义样式路径。 -6:做成设计师插件,可以直接拖曳使用,所见即所得。 -7:后期增加内置信息框、颜色框等弹出窗体的支持。 - -8:重新设计QSS样式,去掉单选框图片、滚动条图片,增加主菜单样式。 -样式表格式 -(1):第一行为特殊自定义部分,可以通过读取文本文件识别到特殊的颜色值。用于特殊处理。 -(2):第二行为全局样式设置,例如无虚线,全局字体大小,文字颜色,禁用控件颜色。 -(3):其他部分 -(3):标签控件 -(4):按钮控件 - -用Qt写项目写多了,为了满足不同客户的需求,需要定制不同样式的界面,QUI皮肤生成器应运而生。思考这个工具的架构花了一年时间,如何从复杂的配色方案中提取出共性,然后将共性转为具体的QSS文件。思考架构花了一年时间,编写大概花了一天时间完成。 -demo演示版:http://pan.baidu.com/s/1jIkbVKU - -QUI皮肤生成器介绍: -1:极简设计,傻瓜式操作步骤:,只需简单几步即可设计出漂亮的皮肤。 -2:所见即所得,想要什么好的皮肤,分分钟搞定。 -3:自动生成样式中所需要的对应颜色的图片资源文件,比如单选框、复选框指示器图片。 -4:集成自定义无边框标题栏样式、左边导航切换样式、顶部导航切换样式、设备面板样式。 - - - - -银色风格 -字体颜色:#000000 -面板背景:#F5F5F5 -边框颜色:#B2B6B9 -普通渐变:#E1E4E6 #CCD3D9 -加深渐变:#F2F3F4 #E7E9EB -高亮颜色:#00BB9E - -蓝色风格 -字体颜色:#324C6C -面板背景:#CFDDEE -边框颜色:#7F9AB8 -普通渐变:#C0D3EB #BCCFE7 -加深渐变:#D2E3F5 #CADDF3 -高亮颜色:#00BB9E - -淡蓝色风格 -字体颜色:#386487 -面板背景:#EAF7FF -边框颜色:#C0DCF2 -普通渐变:#DEF0FE #C0DEF6 -加深渐变:#F2F9FF #DAEFFF -高亮颜色:#00BB9E - -深蓝色风格 -字体颜色:#7AAFE3 -面板背景:#0E1A32 -边框颜色:#132743 -普通渐变:#133050 #133050 -加深渐变:#033967 #033967 -高亮颜色:#00BB9E - -灰色风格 -字体颜色:#000000 -面板背景:#F0F0F0 -边框颜色:#A9A9A9 -普通渐变:#E4E4E4 #A2A2A2 -加深渐变:#DBDBDB #C1C1C1 -高亮颜色:#00BB9E - -浅灰色风格: -字体颜色:#6F6F6F -面板背景:#F0F0F0 -边框颜色:#D4D0C8 -普通渐变:#EEEEEE #E5E5E5 -加深渐变:#FCFCFC #F7F7F7 -高亮颜色:#00BB9E - -深灰色风格 -字体颜色:#5D5C6C -面板背景:#EBECF0 -边框颜色:#A9ACB5 -普通渐变:#D8D9DE #C8C8D0 -加深渐变:#EFF0F4 #DDE0E7 -高亮颜色:#00BB9E - -黑色风格 -字体颜色:#F0F0F0 -面板背景:#464646 -边框颜色:#353535 -普通渐变:#4D4D4D #292929 -加深渐变:#636363 #575757 -高亮颜色:#00BB9E - -浅黑色风格 -字体颜色:#E7ECF0 -面板背景:#616F76 -边框颜色:#738393 -普通渐变:#667481 #566373 -加深渐变:#778899 #708090 -高亮颜色:#00BB9E - -深黑色风格 -字体颜色:#D7E2E9 -面板背景:#1F2026 -边框颜色:#111214 -普通渐变:#242629 #141518 -加深渐变:#007DC4 #0074BF -高亮颜色:#00BB9E - -PS黑色风格 -字体颜色:#DCDCDC -面板背景:#444444 -边框颜色:#242424 -普通渐变:#484848 #383838 -加深渐变:#646464 #525252 -高亮颜色:#00BB9E - -黑色扁平 -字体颜色:#BEC0C2 -面板背景:#2E2F30 -边框颜色:#67696B -普通渐变:#404244 #404244 -加深渐变:#262829 #262829 -高亮颜色:#00BB9E - -白色扁平 -字体颜色:#57595B -面板背景:#FFFFFF -边框颜色:#B6B6B6 -普通渐变:#E4E4E4 #E4E4E4 -加深渐变:#F6F6F6 #F6F6F6 -高亮颜色:#00BB9E \ No newline at end of file