mirror of
https://github.com/QuasarApp/QMLLoginView.git
synced 2025-04-27 02:04:38 +00:00
QMLLoginView
test work for Logic Way Solutions
Introdaction
This is a simple login window library for qml projects. The project is built with the help of the сmake build system and is very easily includet to existing projects.
Main features
- cmake support
- support all qt qml styles
- support login users
- support register new users
- support custom country list
- support cqtdeployer deploy system
Screenshots
Login View
Register View
Incuding into exits project
- cd yourRepo
- git submodule add https://github.com/EndrII/QMLLoginView # add the repository of QMLLoginView into your repo like submodule
- git submodule update --init --recursive
- Include in your CMakeLists.txt file the main CMakeLists.txt file of QMLLoginView library
include(QMLLoginView)
- Rebuild yuor project
Using
#include <lvmainmodel.h>
LoginView::LVMainModel loginModel("exampleLogin"); // create nodel for login dialog
loginModel.init(&QMLEngine) // init login dialog. QMLEngine - this is object of QQmlApplicationEngine.
loginModel.setCounrySource("path/to/countries.xml") // set country list/ Example of counrys xml see example/example.xml
LoginView {
lognViewModel: exampleLogin // exampleLogin - this is inited model in main.cpp
anchors.fill: parent
}
<?xml version="1.0" encoding="UTF-8"?>
<countries>
<country>
<code>375</code>
<name>Belarus</name>
</country>
<country>
<code>33</code>
<name>France</name>
</country>
</countries>
LoginView::LVMainModel Methods
/**
* @brief setCounrySource - sets path to xml source file and extract list of countrys
* @param path
* @return true if the function finished successful
*/
Q_INVOKABLE bool setCounrySource(const QString &path);
/**
* @brief init - prepare all items for use on qml.
* @param engine - current qml engine of application
* @return true if the function finished successful
*/
bool init(QQmlApplicationEngine *engine);
LoginView::LVMainModel Signals
/**
* @brief sigLoginRequest
* emited when user try login
*/
void sigLoginRequest(UserData);
/**
* @brief sigRegisterRequest
* emited when user try create new accaunt
*/
void sigRegisterRequest(UserData);
/**
* @brief sigForgotPasswordRequest
* emited when user forgot own password
*/
void sigForgotPasswordRequest(UserData);
/**
* @brief sigShowTermOfUseRequest
* emited when user click on "Show term of use" button
*/
void sigShowTermOfUseRequest();
UserData properties
Q_PROPERTY(int country READ country WRITE setCountry)
Q_PROPERTY(QString firstName READ firstName WRITE setFirstName)
Q_PROPERTY(QString lastName READ lastName WRITE setLastName)
Q_PROPERTY(QString rawPassword READ rawPassword WRITE setRawPassword)
Q_PROPERTY(QString email READ email WRITE setEmail)
Languages
C++
58.9%
QML
34.2%
CMake
6%
Objective-C
0.8%