Transfer the values entered in one line edit to another present in different window
The mainwindow header looks like:
Code:
{
Q_OBJECT
public:
explicit MainWindow
(QWidget *parent
= 0);
~MainWindow();
private:
Ui::MainWindow *ui;
connection *con;
};
Mainwindow source looks like:
Code:
MainWindow
::MainWindow(QWidget *parent
) : ui(new Ui::MainWindow)
{
ui->setupUi(this);
ui->lineEdit->installEventFilter(this);
QObjectList o_list = ui->lineEdit->children();
for(int i = 0; i < o_list.length(); i++)
{
QLineEdit *cast
= qobject_cast<QLineEdit
*>
(o_list
[i
]);
if(cast)
cast->installEventFilter(this);
}
}
{
if(event
->type
() == QEvent::MouseButtonPress) {
con->show();
}
return false;
}
MainWindow::~MainWindow()
{
delete ui;
}
the Ui window contains a lineedit each.the connection window contains a textbox and the mainwindow contains another.The objective is to transfer the string/data from the widget window to main window using connect or any other method.
Re: Transfer the values entered in one line edit to another present in different wind
So, are you giving us assignments or what?
What is the problem you have, what help do you need?
Re: Transfer the values entered in one line edit to another present in different wind
thank you for suggesting about S.O.L.I.D. I'm just a beginner and haven't used Qt much.I just want to know that if we want to transfer values written in lineedit present in a widget opened from mainwindow, to a lineedit present in mainwindow.
Re: Transfer the values entered in one line edit to another present in different wind
The S.O.L.I.D principles information is part of my signature, not the post :-)
The way you write, and your code suggests you don't really understand basic C++.
The answer to your question would be that the information of your UI should be held separately from the UI, thus available to any UI part in your application.
In your code, you have a member variable 'connection' which is not initialized (so it will probably crash in your eventFilter() and its not visible where you destroy it either.
Before you start working with a tool kit like Qt, better start with basic C++ on basic concepts of OOP.