Good morning,
Working on graphic user interfaces I try to add the European norms tolerance table and the fit property. But I can't print the table Item in the tolerance line-edit. Anyone has an idea I will be thankful.
Print a selected item from a table to a lineEdit
Forum rules
Be nice to others! Read the FreeCAD code of conduct!
Be nice to others! Read the FreeCAD code of conduct!
Re: Print a selected item from a table to a lineEdit
Does this overlap with the information included in the PartDesign hole feature? If that's the case, I think (at the moment) the information used there is hardcoded. It got improved / corrected / completed a while ago. Please have a look: https://forum.freecadweb.org/viewtopic.php?f=19&t=51491
Regards / Viele Grüße
Max
Max
Re: Print a selected item from a table to a lineEdit
I need just to add a property to an object in the property table. The value in the table, I need to print it in the line edit just all.
I need a connection between the selected item and the line edit but I don't know how it will be done.
I need a connection between the selected item and the line edit but I don't know how it will be done.
-
- Veteran
- Posts: 5513
- Joined: Thu Apr 05, 2018 1:53 am
Re: Print a selected item from a table to a lineEdit
If you want to add a new property to an object, right click in the property view and select "show all". Right click again for a new context menu with add property one of the options.
- ebrahim raeyat
- Posts: 621
- Joined: Sun Sep 09, 2018 7:00 pm
- Location: Iran
- Contact:
Re: Print a selected item from a table to a lineEdit
what is your table? it is QTableView? then you can use this signal:
is this your answer?
Code: Select all
tableview.clicked.connect(func)
def func(index):
row = index.row()
column = index.column()
DO MORE
Re: Print a selected item from a table to a lineEdit
it is a tableWidget.
Code: Select all
self.tableWidget = QtWidgets.QTableWidget(self.centralwidget)
self.tableWidget.setGeometry(QtCore.QRect(650, 20,700, 750))
self.tableWidget.setRowCount(113)
self.tableWidget.setColumnCount(14)
self.tableWidget.setObjectName("tableWidget")
item = QtWidgets.QTableWidgetItem()
self.tableWidget.setItem(0, 0, item)
item = QtWidgets.QTableWidgetItem()
self.tableWidget.setItem(0, 1, item)
......
self.tableWidget.selectionModel().selectionChanged.connect(self.on_selectionChanged) #connection
self.tableWidget.itemClicked['QTableWidgetItem*'].connect(self.lineEdit.paste)
Code: Select all
def on_itemClicked():
for ix in selected.indexes():
for i in range(113):
for j in range(14):
item = self.tableWidget.item()
print(ix.tableWidget.item(""))
print(item)
def on_selectionChanged (self, selected):
for ix in selected.indexes():
print ('Selected Cell Location : {0}, {1}'. format(ix.row() , ix.column()))
And the "on_selectionChanged" print just the cell location and I want to print the cell content.
- ebrahim raeyat
- Posts: 621
- Joined: Sun Sep 09, 2018 7:00 pm
- Location: Iran
- Contact:
Re: Print a selected item from a table to a lineEdit
I think the problem is that you did not pass any argument to on_itemClicked method:
Code: Select all
def on_itemClicked(self, selected):