개정판 f81fb80b
issue #000 Stream 데이터와 그래픽 연계 수정.
HYTOS/HYTOS/FreezeTableWidget.py | ||
---|---|---|
11 | 11 |
QTableView.__init__(self, parent, *args) |
12 | 12 |
|
13 | 13 |
self._fixed_col_count = fixed_col_count |
14 |
|
|
14 |
self._selected_item = None |
|
15 | 15 |
self.frozenTableView = QTableView(self) |
16 | 16 |
|
17 | 17 |
self.frozenTableView.verticalHeader().hide() |
... | ... | |
58 | 58 |
def fixed_col_count(self, value): |
59 | 59 |
self._fixed_col_count = value |
60 | 60 |
|
61 |
@property |
|
62 |
def selected_item(self): |
|
63 |
return self._selected_item |
|
64 |
|
|
65 |
@selected_item.setter |
|
66 |
def selected_item(self, value): |
|
67 |
self._selected_item = value |
|
68 |
|
|
61 | 69 |
def selectionModel_selectionChanged(self, selected, deselected): # real signature unknown; restored from __doc__ |
62 | 70 |
from EngineeringStreamlineItem import QEngineeringStreamlineItem |
63 | 71 |
from App import App |
... | ... | |
66 | 74 |
column_name_stream_no = self.model().headerData(selected.column(), self.horizontalHeader().orientation()) # 열 이름 가져오기 |
67 | 75 |
mainWnd = App.mainWnd() |
68 | 76 |
viewer = mainWnd.graphicsView |
77 |
|
|
69 | 78 |
for item in [con for con in viewer.scene.items() if type(con) is QEngineeringStreamlineItem]: |
70 | 79 |
if item.stream_no_text == column_name_stream_no or item.stream_no == column_name_stream_no: |
80 |
if self.selected_item == item: |
|
81 |
break |
|
71 | 82 |
rect = item.sceneBoundingRect() |
72 | 83 |
margins = [rect.width(), rect.height()] |
73 | 84 |
viewer.zoom_rect(rect.adjusted(-margins[0], -margins[1], margins[0], margins[1])) |
74 | 85 |
item.setSelected(True) |
75 |
#if deselected: |
|
76 |
# deselected_index = deselected.indexes()[0] |
|
77 |
# deselected_item = self.model().item(deselected_index.row(), deselected_index.column()) |
|
78 |
# deselected_item.setSelected(False) |
|
79 |
# deselected_item.update() |
|
80 |
item.update() |
|
81 |
else: |
|
82 |
item.setSelected(False) |
|
83 | 86 |
item.update() |
84 |
""" selectionChanged(self, QItemSelection, QItemSelection) """ |
|
85 |
super(FreezeTableWidget, self).selectionChanged(selected, deselected) |
|
87 |
if self.selected_item: |
|
88 |
self.selected_item.setSelected(False) |
|
89 |
self.selected_item.update() |
|
90 |
self.selected_item = item |
|
91 |
break |
|
86 | 92 |
|
87 | 93 |
def setModel(self, model: QAbstractTableModel): |
88 | 94 |
QTableView.setModel(self, model) |
내보내기 Unified diff