I want to build an interface and I need to link a pushbutton in a mainwindow with a dialog. Both were made in Qt Designer. I tried some answers that I saw in others thread but I think it doesn't help me. So, here it goes my codes:
Mainwindow: telainicial (.h/.cpp)
Dialog: simples (.h/.cpp)
telainicial.h
#ifndef TELAINICIAL_H
#define TELAINICIAL_H
#include <QMainWindow>
#include "ui_telainicial.h"
class telainicial
: public QMainWindow,
public Ui
::telainicial { Q_OBJECT
public:
private slots:
void telasimples();
};
#endif // TELAINICIAL_H
#ifndef TELAINICIAL_H
#define TELAINICIAL_H
#include <QMainWindow>
#include "ui_telainicial.h"
class telainicial : public QMainWindow, public Ui::telainicial {
Q_OBJECT
public:
telainicial(QWidget *parent = 0);
private slots:
void telasimples();
};
#endif // TELAINICIAL_H
To copy to clipboard, switch view to plain text mode
telainicial.cpp
#include <QtGui>
#include "telainicial.h"
#include "simples.h"
telainicial
::telainicial(QWidget *parent
) :
{
setupUi(this);
connect(lentesimplesButton, SIGNAL(clicked()), this, SLOT(telasimples()));
}
void telainicial::telasimples(){
//code goes here
};
#include <QtGui>
#include "telainicial.h"
#include "simples.h"
telainicial::telainicial(QWidget *parent) :
QMainWindow(parent)
{
setupUi(this);
connect(lentesimplesButton, SIGNAL(clicked()), this, SLOT(telasimples()));
}
void telainicial::telasimples(){
//code goes here
};
To copy to clipboard, switch view to plain text mode
simples.h
#ifndef SIMPLES_H
#define SIMPLES_H
#include <QDialog>
#include "ui_simples.h"
class simples
: public QDialog,
public Ui
::simples { Q_OBJECT
public:
};
#endif
#ifndef SIMPLES_H
#define SIMPLES_H
#include <QDialog>
#include "ui_simples.h"
class simples : public QDialog, public Ui::simples {
Q_OBJECT
public:
simples(QWidget *parent = 0);
};
#endif
To copy to clipboard, switch view to plain text mode
simples.cpp
#include "simples.h"
#include <QtGui>
simples
::simples(QWidget *parent
) :
{
setupUi(this);
}
#include "simples.h"
#include <QtGui>
simples::simples(QWidget *parent) :
QDialog(parent)
{
setupUi(this);
}
To copy to clipboard, switch view to plain text mode
The mains files are similiar like this:
#include <QtGui/QApplication>
#include "telainicial.h"
int main(int argc, char *argv[])
{
telainicial mainwindow;
mainwindow.show();
return app.exec();
}
#include <QtGui/QApplication>
#include "telainicial.h"
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
telainicial mainwindow;
mainwindow.show();
return app.exec();
}
To copy to clipboard, switch view to plain text mode
Can somebody help me?
Bookmarks