hi all
I have a lil'bit of a problem) which i don't understand...
i have a class, it;s something like this:
{
Q_OBJECT
public:
public slots:
void loginClicked(char* uname = "test", char* pass = "pass")
{
//QString text = inU->text();
//qDebug() << text
char* query;
query = (char*)calloc(strlen("SELECT * FROM admin WHERE adm_username='") + strlen(uname) + strlen("' AND adm_password='") + strlen(pass) + strlen("';") + 1, sizeof(char));
strcat (query, "SELECT * FROM admin WHERE adm_username='");
strcat (query, uname);
strcat (query, "' AND adm_password='");
strcat (query, pass);
strcat (query, "';");
};
private:
PGconn* conn;
PGresult* result;
};
class LoginDialog : public QDialog
{
Q_OBJECT
public:
LoginDialog(QWidget *parent = 0);
public slots:
void loginClicked(char* uname = "test", char* pass = "pass")
{
//QString text = inU->text();
//qDebug() << text
char* query;
query = (char*)calloc(strlen("SELECT * FROM admin WHERE adm_username='") + strlen(uname) + strlen("' AND adm_password='") + strlen(pass) + strlen("';") + 1, sizeof(char));
strcat (query, "SELECT * FROM admin WHERE adm_username='");
strcat (query, uname);
strcat (query, "' AND adm_password='");
strcat (query, pass);
strcat (query, "';");
};
private:
PGconn* conn;
PGresult* result;
QPushButton *okButton;
QPushButton *resetButton;
QLineEdit* inU;
QLineEdit* inP;
QString* uText;
};
To copy to clipboard, switch view to plain text mode
I have a constructor of this class, smth like this:
LoginDialog
::LoginDialog(QWidget *parent
){
...
inU->setText("test text");
//*uText = inU->text();
...
this->show();
};
LoginDialog::LoginDialog(QWidget *parent)
: QDialog(parent)
{
...
inU = new QLineEdit;
inP = new QLineEdit;
inU->setText("test text");
//*uText = inU->text();
...
this->show();
};
To copy to clipboard, switch view to plain text mode
as you see, I can set the text of the inU, or inP QLineEdits and extract it without problems (extract: inU->text(); and insert: inU->setText("test text")
in the constructor, but I cannot access it from other methods (like loginClicked...)... Am I doing something wrong? please someone help... how it can be done?
Bookmarks