forked from feiyangqingyun/QWidgetDemo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
62a789c
commit b73fa9e
Showing
7 changed files
with
149 additions
and
135 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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> |
This file was deleted.
Oops, something went wrong.