tbscope , i checked that but i didn't initialise any of the UI items manually.i left what uic generated . Is that necessary to initialise them ?
here's the code ....they're simple .
mainwindow.h
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <QMessageBox>
#include "ui_mainwindow.h"
namespace Ui {
class MainWindow;
class Ui_MainWindow;
}
class MainWindow
: public QMainWindow ,
public Ui_MainWindow
{
Q_OBJECT
public:
explicit MainWindow
(QWidget *parent
= 0);
~MainWindow();
private:
Ui::MainWindow *ui;
private slots:
void on_login_clicked();
};
#endif // MAINWINDOW_H
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <QMessageBox>
#include "ui_mainwindow.h"
namespace Ui {
class MainWindow;
class Ui_MainWindow;
}
class MainWindow : public QMainWindow ,public Ui_MainWindow
{
Q_OBJECT
public:
QString user;
QString pass;
QMessageBox msg;
explicit MainWindow(QWidget *parent = 0);
~MainWindow();
private:
Ui::MainWindow *ui;
private slots:
void on_login_clicked();
};
#endif // MAINWINDOW_H
To copy to clipboard, switch view to plain text mode
mainwindow.cpp
#include "mainwindow.h"
#include "ui_mainwindow.h"
MainWindow
::MainWindow(QWidget *parent
) : ui(new Ui::MainWindow)
{
ui->setupUi(this);
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::on_login_clicked()
{
user=usernameip->displayText();
pass=passwordip->displayText();
if(user.compare("user")&&pass.compare("pass"))
{
//msg.setText("The username is correct");
//msg.exec();
}
}
#include "mainwindow.h"
#include "ui_mainwindow.h"
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::on_login_clicked()
{
user=usernameip->displayText();
pass=passwordip->displayText();
if(user.compare("user")&&pass.compare("pass"))
{
//msg.setText("The username is correct");
//msg.exec();
}
}
To copy to clipboard, switch view to plain text mode
And the uic generated file ui_mainwindow.h file
Does anyone has idea wat's wrong ?
Bookmarks