How can I make the Table not be in the corner or the window? And how can I put 2 buttons in a single entry of a table?
Frank•Wed, 22 Jul 2015
Hi, I recommend QTCreator for this. It will generate the code for you
Chen•Sun, 23 Aug 2015
hello!I want to read the items selected,how to define the signal and slot?Thank you
Frank•Sun, 23 Aug 2015
Use itemSelectionChanged.connect() to receive the selections. I have created an example of selection with a QTableWidget below. I've changed the code slightly to be object oriented, but the other method should work too.
from PyQt4.QtGui import * from PyQt4.QtCore import * import sys
class QTable(QTableWidget): @pyqtSlot() def on_click(self): print("\n") for currentQTableWidgetItem in self.selectedItems(): print currentQTableWidgetItem.row(), currentQTableWidgetItem.column(), currentQTableWidgetItem.text()
I am trying track double click on a table cell and get value of the cell? I am using python 2.7 and pyQt how do i do that?
Frank•Thu, 17 Sep 2015
Change to self.doubleClicked.connect. Here is a working example:
from PyQt4.QtGui import * from PyQt4.QtCore import * import sys
class QTable(QTableWidget): @pyqtSlot() def on_click(self): print("\n") for currentQTableWidgetItem in self.selectedItems(): print currentQTableWidgetItem.row(), currentQTableWidgetItem.column(), currentQTableWidgetItem.text()
How I can make variable number of column entries in table. I want user to have "add column" choice that will add a new column and allow changing number of entries. How I make this?
Create an onbutton event. In the event of a button click, resize the table and call the show table method.
Ayoub•Mon, 30 May 2016
Thank so mush .... The PyQt Tutorials are limited out there... comparing it the monster of Oracl(Javafx) ... You saved for me a 2+ hours of searching on web ... thank you ... Keep up the good work.
Eli•Mon, 20 Jun 2016
Hallo,
thank you for this helpful post. I am trying to get the values entered by the user and put them in a list but I get this error: NoneType' object has no attribute 'text Any idea? thanx!
This is my code: [python] mytable = self.dlg.tableWidget lista = [] listb = [] # i is always in range 4 in my code for i in range(4): # j is always the length of the unique values list of a field of a qgis layer, # selected by the user on a previous step for j in range(un_values_len): a_item = mytable.item(i, j) a_name = str(a_item.text()) lista.append(a_item) listb.append(a_name)
Leave a Reply:
How can I make the Table not be in the corner or the window? And how can I put 2 buttons in a single entry of a table?
Hi, I recommend QTCreator for this. It will generate the code for you
hello!I want to read the items selected,how to define the signal and slot?Thank you
Use itemSelectionChanged.connect() to receive the selections. I have created an example of selection with a QTableWidget below. I've changed the code slightly to be object oriented, but the other method should work too.
I am trying track double click on a table cell and get value of the cell? I am using python 2.7 and pyQt how do i do that?
Change to self.doubleClicked.connect. Here is a working example:
very useful
Thanks
How I can make variable number of column entries in table. I want user to have "add column" choice that will add a new column and allow changing number of entries. How I make this?
Hi, how can I make a table that can collapse?
People recommend a QTreeView for this, haven't tried it myself. http://stackoverflow.com/qu...
Create an onbutton event. In the event of a button click, resize the table and call the show table method.
Thank so mush ....
The PyQt Tutorials are limited out there... comparing it the monster of Oracl(Javafx) ...
You saved for me a 2+ hours of searching on web ... thank you ... Keep up the good work.
Hallo,
thank you for this helpful post. I am trying to get the values entered by the user and put them in a list but
I get this error: NoneType' object has no attribute 'text
Any idea?
thanx!
This is my code:
[python]
mytable = self.dlg.tableWidget
lista = []
listb = []
# i is always in range 4 in my code
for i in range(4):
# j is always the length of the unique values list of a field of a qgis layer,
# selected by the user on a previous step
for j in range(un_values_len):
a_item = mytable.item(i, j)
a_name = str(a_item.text())
lista.append(a_item)
listb.append(a_name)
print lista, listb
[/python]