新增文本框回车焦点下移

master
feiyangqingyun 2019-10-28 13:50:59 +08:00
parent edcad1f34b
commit b57b29e289
7 changed files with 149 additions and 135 deletions

View File

@ -21,4 +21,5 @@
| 18 | saveruntime | 运行时间记录类 |
| 19 | colorwidget | 颜色拾取器 |
| 20 | maskwidget | 遮罩层窗体 |
| 21 | battery | 电池电量控件 |
| 21 | battery | 电池电量控件 |
| 22 | lineeditnext | 文本框回车焦点下移 |

View File

@ -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

11
lineeditnext/main.cpp Normal file
View File

@ -0,0 +1,11 @@
#include "widget.h"
#include <QApplication>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
Widget w;
w.show();
return a.exec();
}

30
lineeditnext/widget.cpp Normal file
View File

@ -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();
}
}

25
lineeditnext/widget.h Normal file
View File

@ -0,0 +1,25 @@
#ifndef WIDGET_H
#define WIDGET_H
#include <QWidget>
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

50
lineeditnext/widget.ui Normal file
View File

@ -0,0 +1,50 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Widget</class>
<widget class="QWidget" name="Widget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>Widget</string>
</property>
<widget class="QLineEdit" name="lineEdit1">
<property name="geometry">
<rect>
<x>10</x>
<y>10</y>
<width>113</width>
<height>20</height>
</rect>
</property>
</widget>
<widget class="QLineEdit" name="lineEdit2">
<property name="geometry">
<rect>
<x>10</x>
<y>40</y>
<width>113</width>
<height>20</height>
</rect>
</property>
</widget>
<widget class="QLineEdit" name="lineEdit3">
<property name="geometry">
<rect>
<x>10</x>
<y>70</y>
<width>113</width>
<height>20</height>
</rect>
</property>
</widget>
</widget>
<layoutdefault spacing="6" margin="11"/>
<resources/>
<connections/>
</ui>

View File

@ -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