Is there a way to align or manipulate the position

2019-08-18 05:05发布

问题:

Intro: I am using PySide and the Qt Framework to build a GUI app

I am dynamically adding edit and delete icons in a QTableWidgetItem and I am trying to align them in the center of the cell. I have tried setTextAlign and setStyleSheet on various parts of the QTableWidget.

If anyone knows a workaround that would be awesome.

I am also wanting these to be clickable so that if the user clicks the edit they will be able to edit the corresponding object that row applies to. If someone could help me out with this as well that would be even more awesome.

thanks

回答1:

I would probably end up using QTableWidget::setCellWidget()

You'd be able to create your own custom widget, in this case you might try creating a QToolButton centered inside of a QFrame in designer and then set that as the widget for the cells in your table that you want it to appear in.



标签: python qt pyside