MCPcopy Create free account
hub / github.com/cvut/qtrvsim / adjust_scroll_pos_process

Method adjust_scroll_pos_process

src/gui/windows/program/programtableview.cpp:87–122  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

85}
86
87void ProgramTableView::adjust_scroll_pos_process() {
88 adjust_scroll_pos_in_progress = false;
89 machine::Address address;
90 auto *m = dynamic_cast<ProgramModel *>(model());
91 if (m == nullptr) { return; }
92
93 QModelIndex prev_index = currentIndex();
94 auto row_bytes = machine::Address(ProgramModel::cellSizeBytes());
95 machine::Address index0_offset = m->getIndex0Offset();
96
97 do {
98 int row = rowAt(0);
99 int prev_row = row;
100 if (row < m->rowCount() / 8) {
101 if ((row == 0) && (index0_offset < row_bytes) && (!index0_offset.is_null())) {
102 m->adjustRowAndOffset(row, machine::Address::null());
103 } else if (index0_offset >= row_bytes) {
104 m->get_row_address(address, row);
105 m->adjustRowAndOffset(row, address);
106 } else {
107 break;
108 }
109 } else if (row > m->rowCount() - m->rowCount() / 8) {
110 m->get_row_address(address, row);
111 m->adjustRowAndOffset(row, address);
112 } else {
113 break;
114 }
115 scrollTo(m->index(row, 0), QAbstractItemView::PositionAtTop);
116 setCurrentIndex(m->index(prev_index.row() + row - prev_row, prev_index.column()));
117 emit m->update_all();
118 } while (false);
119 m->get_row_address(address, rowAt(0));
120 if (need_addr0_save) { addr0_save_change(address); }
121 emit address_changed(address.get_raw());
122}
123
124void ProgramTableView::resizeEvent(QResizeEvent *event) {
125 auto *m = dynamic_cast<ProgramModel *>(model());

Callers

nothing calls this directly

Calls 7

is_nullMethod · 0.80
get_rawMethod · 0.80
AddressClass · 0.50
getIndex0OffsetMethod · 0.45
rowCountMethod · 0.45
adjustRowAndOffsetMethod · 0.45
get_row_addressMethod · 0.45

Tested by

no test coverage detected