Hello Marcus,
Thank you for your reply I have changed my signals and have set up a
function that tests for current data vs old data only when the table has
been populated.
Thank you for the help. For anyone who has a similar issue I have left my
test function below. Test cases seem to be working so far
self.uiMainWindow.uiUnitExtensionTable.itemDoubleClicked.connect(self.testData)
self.uiMainWindow.uiUnitExtensionTable.itemChanged.connect(self.testPrint)
def testPrint(self):
try:
self.newData =
self.uiMainWindow.uiUnitExtensionTable.currentItem().text()
row = self.uiMainWindow.uiUnitExtensionTable.currentItem().row()
print
self.uiMainWindow.uiUnitExtensionTable.verticalHeaderItem(row).text()
print "Item changed"
if self.newData != self.currentData:
print "Old data", self.currentData
print "New data", self.newData
else:
print "No new data", self.currentData
except:
pass
def testData(self):
try:
print "cell entered"
self.currentData =
self.uiMainWindow.uiUnitExtensionTable.currentItem().text()
except:
pass
On 14 April 2015 at 11:04, Marcus Ottosson <[email protected]> wrote:
> Spontaneously, I’d adjust the old-style signal connection with the
> new-style method of connecting, maybe that will make things a little more
> clear what’s going on.
>
> self.uiMainWindow.uiUnitExtensionTable.itemChanged.connect(self.testPrint)
>
> Wasn’t sure about how to convert the other arguments, but this
> self.uiMainWindow.uiUnitExtensionTable.itemChanged is a signal that you
> are attempting to call directly, and is why you’re getting the error. If
> you’re looking to emit the arguments with it, you’ll need to pass them to
> .emit() instead.
>
> self.uiMainWindow.uiUnitExtensionTable.itemChanged.emit(self.uiMainWindow.uiUnitExtensionTable.currentItem)
>
> See here about old-style versus new-style.
>
> - http://pyqt.sourceforge.net/Docs/PyQt4/new_style_signals_slots.html
>
>
>
> On 14 April 2015 at 01:39, Benjam901 <[email protected]> wrote:
>
>> Hello all,
>>
>> I am having a bit of trouble with my QTableWidget. When you double click
>> and edit a text field inside the QTableWidget I need a signal to be emitted
>> when enter is pressed/when the data in the table has actually changed.
>>
>> My test case is self.uiMainWindow.uiExtensionTable
>>
>> I have tried testcase.cellChanged, testcase.dataChanged and also
>> something like this:
>>
>> self.connect(self.uiMainWindow.uiUnitExtensionTable, QtCore.SIGNAL(self
>> .uiMainWindow.uiUnitExtensionTable.itemChanged(self.uiMainWindow.uiUnitExtensionTable.currentItem)),
>> self.testPrint) # Gives me native Qt signal is not callable Error
>>
>> But I have have had no luck so far
>>
>> cellChanged seems to be the closest I have gotten so far but it activates
>> when I double click the item rather than when I have finished editing the
>> text field.
>>
>> Any help would be much appreciated :)
>>
>> Cheers,
>>
>> Ben
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Python Programming for Autodesk Maya" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/python_inside_maya/e92615c3-c92f-464b-acde-487d50976d10%40googlegroups.com
>> <https://groups.google.com/d/msgid/python_inside_maya/e92615c3-c92f-464b-acde-487d50976d10%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> --
> *Marcus Ottosson*
> [email protected]
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Python Programming for Autodesk Maya" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/python_inside_maya/yXV-Dg66jiU/unsubscribe
> .
> To unsubscribe from this group and all its topics, send an email to
> [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/python_inside_maya/CAFRtmODTWiZV%3D8EEcpPmaRwQcaSnqsFrRGYrgg_yen%2Bn%3DM853A%40mail.gmail.com
> <https://groups.google.com/d/msgid/python_inside_maya/CAFRtmODTWiZV%3D8EEcpPmaRwQcaSnqsFrRGYrgg_yen%2Bn%3DM853A%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>
--
Tel - +46 76245 92 90 (Sweden)
LinkedIn: http://www.linkedin.com/pub/ben-hearn/50/a64/33b
--
You received this message because you are subscribed to the Google Groups
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/python_inside_maya/CAM2ybkX7CVVGNMOtf%3DCUJDhPRO3x-ToLbw6fP0_0RaZtMnZ87g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.