mainwindow.cpp
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QInputDialog>
{
setupUi(this);
//connect(pnt,SIGNAL(triggered()),this,SLOT(pnts()));
connect(lineEdit,SIGNAL(textChanged()),this,SLOT(checkTextLength()));
//if(lineeditl[0] == '7') { label_2->setText("Plus ?"); }
connect(lineEdit,
SIGNAL(textChanged
(QString)),
this,
SLOT(setTextInQString
(QString)));
//,,,SLOT(setTextInQString)
}
MainWindow::~MainWindow()
{
}
void MainWindow::checkTextLength(){
//lineeditl = lineEdit->text();
if(lineeditl.length()==9) {
label_2->setText("Correct.");
}
}
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QInputDialog>
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent)
{
setupUi(this);
//connect(pnt,SIGNAL(triggered()),this,SLOT(pnts()));
connect(lineEdit,SIGNAL(textChanged()),this,SLOT(checkTextLength()));
//if(lineeditl[0] == '7') { label_2->setText("Plus ?"); }
connect(lineEdit,SIGNAL(textChanged(QString)),this,SLOT(setTextInQString(QString)));
//,,,SLOT(setTextInQString)
}
MainWindow::~MainWindow()
{
}
void MainWindow::checkTextLength(){
//lineeditl = lineEdit->text();
if(lineeditl.length()==9) {
label_2->setText("Correct.");
}
}
To copy to clipboard, switch view to plain text mode
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include "ui_mainwindow.h"
class MainWindow
: public QMainWindow, Ui
::MainWindow { Q_OBJECT
public:
~MainWindow();
public slots:
void setTextInQString
(QString inString
) { lineeditl = inString;
}
protected slots:
/*void pnts();*/
void checkTextLength();
};
#endif // MAINWINDOW_H
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include "ui_mainwindow.h"
class MainWindow : public QMainWindow, Ui::MainWindow {
Q_OBJECT
public:
MainWindow(QWidget *parent = 0);
~MainWindow();
public slots:
void setTextInQString (QString inString) {
lineeditl = inString;
}
protected slots:
/*void pnts();*/
void checkTextLength();
};
#endif // MAINWINDOW_H
To copy to clipboard, switch view to plain text mode
Problem:
QString lineeditl;
To copy to clipboard, switch view to plain text mode
Where should i define it ? There are errors with multiple definition of this var, wherever I'll put that line.
Bookmarks