File tree Expand file tree Collapse file tree 1 file changed +71
-0
lines changed
Expand file tree Collapse file tree 1 file changed +71
-0
lines changed Original file line number Diff line number Diff line change 1+ import sys
2+
3+ from faslr .grid_header import (
4+ GridTableView ,
5+ )
6+
7+ from PyQt6 .QtCore import Qt
8+
9+ from PyQt6 .QtGui import (
10+ QStandardItem ,
11+ QStandardItemModel
12+ )
13+
14+
15+ from PyQt6 .QtWidgets import (
16+ QApplication ,
17+ QVBoxLayout ,
18+ QWidget
19+ )
20+
21+
22+ app = QApplication (sys .argv )
23+
24+ main_widget = QWidget ()
25+ layout = QVBoxLayout ()
26+ main_widget .setLayout (layout )
27+
28+ # Generate dummy data
29+
30+ model = QStandardItemModel ()
31+ view = GridTableView (corner_button_label = "Accident\n Year" )
32+ view .setModel (model )
33+
34+ for row in range (9 ):
35+ items = []
36+ for col in range (2 ):
37+ items .append (QStandardItem ('item(' + str (row ) + ',' + str (col ) + ')' ))
38+ model .appendRow (items )
39+
40+ layout .addWidget (view )
41+
42+ view .setGridHeaderView (
43+ orientation = Qt .Orientation .Horizontal ,
44+ levels = 2
45+ )
46+
47+ view .hheader .setSpan (
48+ row = 0 ,
49+ column = 0 ,
50+ row_span_count = 1 ,
51+ column_span_count = 2
52+ )
53+
54+ # view.hheader.setSpan(
55+ # row=0,
56+ # column=2,
57+ # row_span_count=2,
58+ # column_span_count=1
59+ # )
60+
61+
62+ view .hheader .setCellLabel (0 , 0 , "header1" )
63+ view .hheader .setCellLabel (1 , 0 , "header2" )
64+ view .hheader .setCellLabel (1 , 1 , "header3" )
65+
66+ main_widget .resize (view .hheader .sizeHint ().width (), 315 )
67+ main_widget .resize (937 , 315 )
68+ main_widget .show ()
69+
70+
71+ app .exec ()
You can’t perform that action at this time.
0 commit comments