Hi,

Firslty I'm very new to QT (as well as GUI programming) but quickly falling in love with it

Having said that however, I have hit my first wall which is probably a lack of understanding something. I am useing eclipse with QT integration (V4.6).

As a test I have crated a form using the designer with a simple text entry widget and a button

I then created a slot for the buttons clicked signal

In the routine processing the signal I read the text from the entry and set the text for the button label to reflect that.

Copiled and ran fine. I can enter text in the entry box and when I click on the button it's label changes to what I entered.

However the text in the entry box does not get cleared so I issued the clear method on it following the set text method on the button.

Now when I click on th button the text in the entry box gets cleared which is fine, but so does the label of the button which I don't get.

Below is the implementation of the slot function:

Qt Code:
  1. void qt_test::on_enterButton_clicked()
  2. {
  3. QString buttonName = ui.lineInput->displayText();
  4. ui.enterButton->setText(buttonName);
  5. ui.lineInput->clear();
  6. }
To copy to clipboard, switch view to plain text mode 

ui.lineIput is of class QLineEdit
ui.enterButton is of class QPushButton

inially the push button has the text "Push" on it then when I push it it get cleared irrespective of what has been entered in the lineInput

The itneresting thing is that if I do this:

Qt Code:
  1. void qt_test::on_enterButton_clicked()
  2. {
  3. QString buttonName = ui.lineInput->displayText();
  4. buttonName += "ABC";
  5. ui.enterButton->setText(buttonName);
  6. ui.lineInput->clear();
  7. }
To copy to clipboard, switch view to plain text mode 

The push button text gets set to "ABC" again irrespective of what is entered in lineInput.

Any one able to tell me why this is so?

Thanks!