def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.id = self.__class__.__name__ self.setHorizontalHeader(widgets.HeaderView("horizontal", parent=self)) self.setVerticalHeader(widgets.HeaderView("vertical", parent=self)) self.setAlternatingRowColors(True) self.setWordWrap(False)
def test_tableview(): widget = widgets.TableView() widget.set_selection_mode("extended") with pytest.raises(ValueError): widget.set_selection_mode("test") widget.set_selection_behaviour("rows") assert widget.get_selection_behaviour() == "rows" with pytest.raises(ValueError): widget.set_selection_behaviour("test") widget.set_horizontal_scrollbar_policy("always_on") widget.set_vertical_scrollbar_policy("always_on") widget.set_horizontal_scrollbar_width(12) widget.set_vertical_scrollbar_width(12) widget.set_edit_triggers("edit_key") with pytest.raises(ValueError): widget.set_edit_triggers("test") widget.selectAll() widget.current_index() widget.current_data() widget.adapt_sizes() widget.setup_list_style() widget.setup_dragdrop_move() widget.num_selected() widget.jump_to_column(0) widget.highlight_when_inactive() widget.set_table_color("black") widget.scroll_to_bottom() widget.selected_data() widget.selected_rows() widget.selected_names() assert len(widget.selected_indexes()) == 0 widget.get_edit_triggers() assert widget.h_header is not None widget.v_header = widgets.HeaderView("vertical", parent=widget) assert widget.v_header is not None
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) class_name = type(self).__name__ self.set_id(class_name) # visual settings self.setAnimated(True) self.setRootIsDecorated(False) self.setAllColumnsShowFocus(True) self.setUniformRowHeights(True) self.setAlternatingRowColors(True) self.setWordWrap(False) # misc self.h_header = widgets.HeaderView("horizontal", parent=self) self.set_selection_mode("extended")
def test_headerview(): def test(): pass table = widgets.TableView() model = widgets.FileSystemModel() table.setModel(model) header = widgets.HeaderView(parent=table) table.setHorizontalHeader(header) header.resize_mode("interactive") header.resize_mode("interactive", col=0) header.resize_sections("interactive") header.set_contextmenu_policy("custom") header.set_custom_menu(test) header.set_sizes([100]) label = header.section_labels() print(label)
def test_headerview(): widget = widgets.HeaderView(parent=None) widget.show() widget.close()