Ready to connect to the API

This commit is contained in:
Pierre HUBERT 2020-06-12 15:58:23 +02:00
parent 224069b43b
commit 9ad4255207
3 changed files with 38 additions and 10 deletions

View File

@ -1,6 +1,8 @@
#include "loginwindow.h"
#include "ui_loginwindow.h"
#include <QMessageBox>
LoginWindow::LoginWindow(QWidget *parent)
: QDialog(parent)
, ui(new Ui::LoginWindow)
@ -30,10 +32,24 @@ void LoginWindow::mousePressEvent(QMouseEvent *evt)
void LoginWindow::mouseMoveEvent(QMouseEvent *evt)
{
const QPoint delta = evt->globalPos() - mOldPos;
if (false)
// if locked, ignore delta on y axis, stay at the top
move(x()+delta.x(), y());
else
move(x()+delta.x(), y()+delta.y());
mOldPos = evt->globalPos();
}
void LoginWindow::submitForm()
{
if(ui->emailEdit->text().isEmpty()) {
QMessageBox::warning(this, tr("Error"), tr("Please specify an email address!"));
return;
}
if(ui->passwordEdit->text().isEmpty()) {
QMessageBox::warning(this, tr("Error"), tr("Please specify your password!"));
return;
}
}
void LoginWindow::on_submitButton_clicked()
{
submitForm();
}

View File

@ -26,8 +26,15 @@ protected:
void mouseMoveEvent(QMouseEvent *evt);
private slots:
/**
* Submit login form
*/
void submitForm();
void on_closeButton_clicked();
void on_submitButton_clicked();
private:
Ui::LoginWindow *ui;
QPoint mOldPos;

View File

@ -34,6 +34,7 @@ QLineEdit {
border: 1px solid grey;
border-radius: 0px;
background-color: white;
color: black;
}
QPushButton {
@ -128,7 +129,7 @@ QToolButton:hover:!pressed {
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEdit"/>
<widget class="QLineEdit" name="emailEdit"/>
</item>
<item>
<widget class="QLabel" name="label_3">
@ -138,10 +139,14 @@ QToolButton:hover:!pressed {
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEdit_2"/>
<widget class="QLineEdit" name="passwordEdit">
<property name="echoMode">
<enum>QLineEdit::Password</enum>
</property>
</widget>
</item>
<item alignment="Qt::AlignHCenter">
<widget class="QPushButton" name="pushButton">
<widget class="QPushButton" name="submitButton">
<property name="text">
<string>Login</string>
</property>