@@ -55,6 +55,9 @@ def __init__(self, *args, **kwargs):
5555 QtCore .Qt .DropAction .IgnoreAction ) # no drop by default
5656 self .tableWidget .horizontalHeader ().setSectionResizeMode (
5757 0 , QtWidgets .QHeaderView .ResizeMode .Stretch )
58+ self .tableWidget .horizontalHeader ().setSectionResizeMode (
59+ 1 , QtWidgets .QHeaderView .ResizeMode .ResizeToContents )
60+
5861
5962 def get_entry_actions (self , row , entry ):
6063 """This is defined in the subclasses (Circle, Collection, etc)"""
@@ -98,8 +101,10 @@ def set_entry(self, row, entry):
98101 # tool buttons (2nd column)
99102 widact = QtWidgets .QWidget (self )
100103 horz_layout = QtWidgets .QHBoxLayout (widact )
101- horz_layout .setContentsMargins (2 , 0 , 2 , 0 )
104+ horz_layout .setContentsMargins (0 , 0 , 5 , 0 )
105+ horz_layout .setAlignment (QtCore .Qt .AlignmentFlag .AlignRight )
102106
107+ col_width = 0
103108 for action in self .get_entry_actions (row , entry ):
104109 if action ["name" ] in self .active_actions :
105110 tbact = QtWidgets .QToolButton (widact )
@@ -108,8 +113,13 @@ def set_entry(self, row, entry):
108113 tbact .setToolTip (action ["tooltip" ])
109114 tbact .clicked .connect (action ["function" ])
110115 horz_layout .addWidget (tbact )
111- horz_layout .setAlignment (QtCore .Qt .AlignmentFlag .AlignRight )
116+ row_height = tbact .geometry ().height ()
117+ col_width += row_height
118+ tbact .setFixedWidth (row_height )
119+
120+ self .tableWidget .setColumnWidth (1 , col_width )
112121 self .tableWidget .setCellWidget (row , 1 , widact )
122+
113123 return widact
114124
115125 def set_entry_label (self , row , entry ):
0 commit comments