How to read values from QDateEdit placed in QTableWidget
I am using QDateEdit & QComboBox in QTableWidget in few columns and trying to read it from QComboBox using
cmb_tlnm = self.leaves_app_table.cellWidget(i,8)
a = self.cmb_tlnm.currentText()
its working fine but if i try to use same process for QDateEdit
date_applfrm = self.leaves_app_table.cellWidget(i,0)
b = self.date_applfrm.date()
i am getting error -
b = self.date_applfrm.date()
AttributeError: date_aaplfrm
can someone tell me how can i read values from this QDateEdit which i have used in QTableWidget
THANX IN ADVANCE
Re: How to read values from QDateEdit placed in QTableWidget
DateEdit Widget is based on QDateTime class which has a toString method (it returns a QString)
Re: How to read values from QDateEdit placed in QTableWidget
i am a totally new to python could you plz tell me what modifications i need to do in above syntax of my piece of code
Re: How to read values from QDateEdit placed in QTableWidget
I don't know python at all:
But i guess (no guarantee) the code should look something like:
Code:
//assuming that date_applfrm is the QDateEdit object
b = self.date_applfrm.dateTime().toString("dd MMM YYYY hh:mm")
I'm telling this to try to help you if my python hack doesn't work (since i don't know python)
In C++ (i assume i python code too) you need to access the dateTime() to return a QDateTime object which has a toString method you need to call with a string parameter (of the format you want see the link to documentation in my previous post)
This is C++ code:
Code:
QString time = dateEditObject
->dateTime
().
toString("dd MMM YYYY hh:mm");
Re: How to read values from QDateEdit placed in QTableWidget
i tried this but its not working its giving same error AttributeError : date_applfrm
Re: How to read values from QDateEdit placed in QTableWidget
I don't know python and i'm not sure about what that error means, but it looks like a typo:
b = self.date_applfrm.date()
AttributeError: date_aaplfrm