PDA

View Full Version : Help on using QTableWidget with LineEdit.



narendra
30th December 2009, 08:56
Hi,
i have a lineEdit widget set to QTableWidget cell. With validator added to lineEdit.
Can i get any signal from QTableWidget, if the lineEdit set of the tableWidget is changed ?
like cellChanged(int,int) when we use QTableWidget Item

high_flyer
30th December 2009, 10:16
The first thing that comes to my mind if you don't want to use your QLineEdit pointer, is that you can connect to the cell widget signals by using:


connect(pTableWidget->cellWidget(row,col),SIGNAL(someSignal()),pObj,SLOT (someSlot()));


but you can also just use the pointer to your QLineEdit.

narendra
31st December 2009, 16:29
Ya true, but i can't use validator with QTableWidgetItem so by using that method i have to wait for the user to finish entering the value for validating.

I want to validate as user keys in the data for ex: i don't want the user to enter the alphabet in cell where i am expecting integer.

narendra
31st December 2009, 16:30
Any way i have solved by connecting the signals of the lineEdit to slot almost the same way as you said. But i want to know is there a better solution ?