Me gusta la idea, me apunto yo tambien
Seria buena idea detallar lo maximo posible el objetivo del programa, con todos los detalles
Seria buena idea detallar lo maximo posible el objetivo del programa, con todos los detalles
Esta sección te permite ver todos los mensajes escritos por este usuario. Ten en cuenta que sólo puedes ver los mensajes escritos en zonas a las que tienes acceso en este momento.
Mostrar Mensajes MenúCitar
||=== Temporal, Debug ===|
obj/Debug/dialogo.o||In function `Dialogo':|
/home/java/Workspace code::blocks/Temporal/dialogo.cpp|4|undefined reference to `vtable for Dialogo'|
/home/java/Workspace code::blocks/Temporal/dialogo.cpp|4|undefined reference to `vtable for Dialogo'|
/home/java/Workspace code::blocks/Temporal/dialogo.cpp|4|undefined reference to `vtable for Dialogo'|
/home/java/Workspace code::blocks/Temporal/dialogo.cpp|4|undefined reference to `vtable for Dialogo'|
obj/Debug/dialogo.o||In function `~Dialogo':|
/home/java/Workspace code::blocks/Temporal/dialogo.cpp|48|undefined reference to `vtable for Dialogo'|
obj/Debug/dialogo.o:/home/java/Workspace code::blocks/Temporal/dialogo.cpp|48|more undefined references to `vtable for Dialogo' follow|
obj/Debug/dialogo.o||In function `Dialogo::findClicked()':|
/home/java/Workspace code::blocks/Temporal/dialogo.cpp|58|undefined reference to `Dialogo::findPrevious(QString const&, Qt::CaseSensitivity)'|
/home/java/Workspace code::blocks/Temporal/dialogo.cpp|61|undefined reference to `Dialogo::findNext(QString const&, Qt::CaseSensitivity)'|
obj/Debug/dialogo.o||In function `Dialogo::tr(char const*, char const*)':|
/home/java/Workspace code::blocks/Temporal/dialogo.h|12|undefined reference to `Dialogo::staticMetaObject'|
||=== Build finished: 9 errors, 0 warnings ===|
#ifndef DIALOGO_H
#define DIALOGO_H
#include <QDialog>
class QCheckBox;
class QLabel;
class QLineEdit;
class QPushButton;
class Dialogo : public QDialog{
Q_OBJECT //Siempre necesario para declarar SIGNALS AND SLOTS
public:
Dialogo(QWidget *parent = 0);
~Dialogo();
signals:
void findNext(const QString &str, Qt::CaseSensitivity cs);
void findPrevious(const QString &str, Qt::CaseSensitivity cs);
private slots:
void findClicked();
void enableFindButton(const QString &text);
private:
QLabel *label;
QLineEdit *lineEdit;
QCheckBox *caseCheckBox;
QCheckBox *backwardCheckBox;
QPushButton *findButton;
QPushButton *closeButton;
};
#endif // DIALOGO_H
#include <QtGui>
#include "dialogo.h"
Dialogo::Dialogo(QWidget *parent) : QDialog(parent){
label = new QLabel(tr("Find &what:"));
lineEdit = new QLineEdit;
label->setBuddy(lineEdit);
caseCheckBox = new QCheckBox(tr("Match &case"));
backwardCheckBox = new QCheckBox(tr("Search &backward"));
findButton = new QPushButton(tr("&Find"));
findButton->setDefault(true);
findButton->setEnabled(false);
closeButton = new QPushButton(tr("Close"));
connect(lineEdit, SIGNAL(textChanged(const QString &)),
this, SLOT(enableFindButton(const QString &)));
connect(findButton, SIGNAL(clicked()),
this, SLOT(findClicked()));
connect(closeButton, SIGNAL(clicked()),
this, SLOT(close()));
QHBoxLayout *topLeftLayout = new QHBoxLayout;
topLeftLayout->addWidget(label);
topLeftLayout->addWidget(lineEdit);
QVBoxLayout *leftLayout = new QVBoxLayout;
leftLayout->addLayout(topLeftLayout);
leftLayout->addWidget(caseCheckBox);
leftLayout->addWidget(backwardCheckBox);
QVBoxLayout *rightLayout = new QVBoxLayout;
rightLayout->addWidget(findButton);
rightLayout->addWidget(closeButton);
rightLayout->addStretch();
QHBoxLayout *mainLayout = new QHBoxLayout;
mainLayout->addLayout(leftLayout);
mainLayout->addLayout(rightLayout);
setLayout(mainLayout);
setWindowTitle(tr("Find"));
setFixedHeight(sizeHint().height());
}
Dialogo::~Dialogo(){
delete this;
}
void Dialogo::findClicked(){
QString text = lineEdit->text();
Qt::CaseSensitivity cs =
caseCheckBox->isChecked() ? Qt::CaseSensitive
: Qt::CaseInsensitive;
if (backwardCheckBox->isChecked()){
emit findPrevious(text,cs);
}
else {
emit findNext(text, cs);
}
}
void Dialogo::enableFindButton(const QString &text){
findButton->setEnabled(!text.isEmpty());
}
#include <QApplication>
#include "dialogo.h"
#include "dialogo.cpp" /*Este paso no aparece en el ejemplo del tutorial, pero crei que solucionaria el error */
int main(int argc, char *argv[]){
QApplication app(argc, argv);
Dialogo *dialogo = new Dialogo;
dialogo->show();
return app.exec();
}