[quote author="sierdzio" date="1419321382"]All you need to do to create a separate window in Qt is to create a QWidget (like QPushButton, QLabel, etc.) without a parent (meaning: parent == 0).
Or, alternatively, you can use QDialog.[/quote]
I personally do not know how to approach this?
Here is the source code i have so far, were can i insert a QDialog:
login_window.h
@
#ifndef LOGIN_WINDOW_H
#define LOGIN_WINDOW_H
#include <QWidget>
#include <vector>
namespace Ui {
class LoginWindow;
}
class LoginWindow : public QWidget
{
Q_OBJECT
public:
explicit LoginWindow(QWidget *parent = 0);
~LoginWindow();
bool checkStudentElement(int &refString, std::vector<int> &refVector);
private slots:
void on_loginButton_clicked();
private:
Ui::LoginWindow *ui;
std::vector<int> *studentIDList;
};
#endif // LOGIN_WINDOW_H
@
login_window.cpp
@
#include "login_window.h"
#include "ui_loginwindow.h"
LoginWindow::LoginWindow(QWidget *parent) : QWidget(parent), ui(new Ui::LoginWindow)
{
ui->setupUi(this);
}
LoginWindow::~LoginWindow()
{
delete ui;
}
void LoginWindow::on_loginButton_clicked()
{
std::string student_ID = (ui->le_studentID->text()).toStdString(); //convert to string
//Must then check if it is already in the system
if(checkStudentElement(student_ID, studentIDList) == true) //need to run function for check
{
ui->loginStatus->setText("Login Successful");
break;
}else{
ui->loginStatus->setText("Login Failed");
studentIDList->push_back(student_ID); //push the ID into the vector
}
}
bool LoginWindow::checkStudentElement(int &refString, std::vector<int> &refVector)
{
int counter = refString.Length();
if(counter > refString)
{
}
for(int i = 0; i <= refVector.size(); i++)
{
//Will loop thru the elements to check for similar vector
if(/*refVector.()begin == refVector*/)
{
//if it contain it
break;
}else{
return false;
} //else make sure to return that value
}
}
@