Skip to content

Commit f6bc0bf

Browse files
committed
merged new tables
1 parent ec216f4 commit f6bc0bf

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

Widgets/Table.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,22 @@ def __init__(self, x, y, w, h, rows, cols):
1111
# Hide the horizontal and vertical headers
1212
self.table.horizontalHeader().setVisible(False)
1313
self.table.verticalHeader().setVisible(False)
14+
15+
# Get the default table border color from the palette
16+
table_border_color = self.palette().color(QPalette.Window)
17+
18+
# Add a custom border on the top of the widget
19+
self.table.setStyleSheet(f"QTableView {{border: 1px solid {table_border_color.name()};}}")
20+
21+
# Make the cells resizable
22+
self.table.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
23+
self.table.horizontalHeader().setSectionResizeMode(QHeaderView.Stretch)
24+
1425
self.setGeometry(x, y, w, h)
1526
self.table.setGeometry(0, 0, w, h)
1627
self.resize(w, h)
1728
self.persistantGeometry = self.geometry()
1829
self.setAttribute(Qt.WA_TransparentForMouseEvents, True) # If extending a qwidget to insert something else, dont receive mouse events
19-
self.setStyleSheet('background-color: rgba(0, 0, 0, 0);')
2030

2131
# Child widget not concerned with pos but is with w, h
2232
def newGeometryEvent(self, newGeometry: QRect):

0 commit comments

Comments
 (0)