Hi, I'm trying to make a simplest program people have ever seen...
Here it is main.cpp:
#include <QApplication>
#include <QDialog>
#include "chala.h"
int main(int argc, char *argv[])
{
Ui::chala ui;
ui.setupUi(dialog);
dialog->show();
return app.exec();
}
#include <QApplication>
#include <QDialog>
#include "chala.h"
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
Ui::chala ui;
QDialog *dialog = new QDialog;
ui.setupUi(dialog);
dialog->show();
return app.exec();
}
To copy to clipboard, switch view to plain text mode
chala.h:
#ifndef CHALA_H
#define CHALA_H
#include <QDialog>
#include "ui_chala.h"
class chala
: public QDialog,
public Ui
::chala{
Q_OBJECT
public:
public slots:
void srutututu();
void majtki();
};
#endif
#ifndef CHALA_H
#define CHALA_H
#include <QDialog>
#include "ui_chala.h"
class chala : public QDialog, public Ui::chala
{
Q_OBJECT
public:
chala(QWidget *parent = 0);
public slots:
void srutututu();
void majtki();
};
#endif
To copy to clipboard, switch view to plain text mode
and chala.cpp :
#include <QtGui>
#include "chala.h"
{
setupUi(this);
connect(pushButton, SIGNAL(clicked()), this, SLOT(srutututu()));
connect(pushButton_2, SIGNAL(clicked()), this, SLOT(majtki()));
}
void chala::srutututu()
{
qDebug() << "slot 1";
lineEdit->setText("new content");
}
void chala::majtki()
{
label_2->setText("elo 6700");
}
#include <QtGui>
#include "chala.h"
chala::chala(QWidget *parent)
: QDialog(parent)
{
setupUi(this);
connect(pushButton, SIGNAL(clicked()), this, SLOT(srutututu()));
connect(pushButton_2, SIGNAL(clicked()), this, SLOT(majtki()));
}
void chala::srutututu()
{
qDebug() << "slot 1";
lineEdit->setText("new content");
}
void chala::majtki()
{
label_2->setText("elo 6700");
}
To copy to clipboard, switch view to plain text mode
and 'ive done a simpliest window in designer with 4 pushbuttons lineEdit and label.... :
piece of ui_chala.cpp
QObject::connect(pushButton,
SIGNAL(clicked
()), lineEdit,
SLOT(hide
()));
QObject::connect(pushButton_2,
SIGNAL(clicked
()), lineEdit,
SLOT(show
()));
QObject::connect(pushButton, SIGNAL(clicked()), lineEdit, SLOT(hide()));
QObject::connect(pushButton_2, SIGNAL(clicked()), lineEdit, SLOT(show()));
To copy to clipboard, switch view to plain text mode
When i'm creating signal slot show/hide in designer everything works fine!
But when i'm trying to use my own slot(srutututu() and majtki()) actually nothing happens..
in my opinion signal is even not emited. So what am i doing wrong ?
Bookmarks