[Qt-interest] Using more than one .ui files in a project
jaff at student.dei.uc.pt
jaff at student.dei.uc.pt
Thu Jul 15 00:34:20 CEST 2010
Hi all,
I made a simple login dialog and the app is running just fine, but now
I'm facing a new problem: I want to add another .ui file to the project
and I don't know how to use it. I'll be more specific: I want to use a
.ui file that is already created. I imported it to my project
(File->Open File Or Project...) and I thought it was mandatory to
create a new class (both .h and .cpp file) to instantiate it, but the
little code I did just brought confusion and errors to the project, so
I deleted both files (header and source).
The real question here is, now that I have 2 .ui files in my project,
how can I use the second one (I don't know if this is useful but I
already have a login window and the new one is the main window, so I
want to go from the login to the main window)?
I don't know if I'm being confusing explaining my issue, but I'm new to
this. I send the files in attachment (is little and simple).
If anyone knows what I'm looking for please say something, it will be
much appreciated :]
Thanks in advance,
João
----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Backoffice.pro
Type: application/octet-stream
Size: 344 bytes
Desc: not available
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100714/6d0b42b6/attachment.obj
-------------- next part --------------
#include "logindialog.h"
#include "ui_logindialog.h"
LoginDialog::LoginDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::LoginDialog)
{
ui->setupUi(this);
ui->lineEdit_2->setEchoMode(QLineEdit::Password);
}
LoginDialog::~LoginDialog()
{
delete ui;
}
void LoginDialog::clearButtonClickedHandler()
{
ui->lineEdit->clear();
ui->lineEdit_2->clear();
ui->lineEdit_3->clear();
}
void LoginDialog::connectToServer()
{
QString server = ui->label_3->text();
if(server=="")
tcpSocket.connectToHost(QHostAddress::LocalHost, 6178);
else
tcpSocket.connectToHost(server, 6178);
}
//void LoginDialog::showMainWindow()
//{
//}
-------------- next part --------------
#ifndef LOGINDIALOG_H
#define LOGINDIALOG_H
#include <QDialog>
#include <QtNetwork/QTcpSocket>
#include <QtNetwork/QHostAddress>
#include <QString>
namespace Ui
{
class LoginDialog;
}
class LoginDialog : public QDialog
{
Q_OBJECT
public:
explicit LoginDialog(QWidget *parent = 0);
~LoginDialog();
public slots:
void clearButtonClickedHandler();
void connectToServer();
//void showMainWindow();
private:
Ui::LoginDialog *ui;
QTcpSocket tcpSocket;
};
#endif // LOGINDIALOG_H
-------------- next part --------------
A non-text attachment was scrubbed...
Name: logindialog.ui
Type: application/x-designer
Size: 3261 bytes
Desc: not available
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100714/6d0b42b6/attachment.bin
-------------- next part --------------
#include <QtGui/QApplication>
#include "logindialog.h"
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
LoginDialog w;
w.show();
return a.exec();
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mainwindow.ui
Type: application/x-designer
Size: 12075 bytes
Desc: not available
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100714/6d0b42b6/attachment-0001.bin
More information about the Qt-interest-old
mailing list