def test_listview(): widget = widgets.ListView() widget.set_selection_mode("single") widget.toggle_select_all() widget.set_selection_mode("multi") assert widget.get_selection_mode() == "multi" widget.set_view_mode("icon") with pytest.raises(ValueError): widget.set_view_mode("test") assert widget.get_view_mode() == "icon"
if whats_this: item.setWhatsThis(whats_this) if size_hint is not None: item.set_size_hint(size_hint) if checkstate is not None: item.set_checkstate(checkstate) self.appendRow([item]) return item if __name__ == "__main__": import pickle from prettyqt import widgets model = gui.StandardItemModel() model.add("test") app = widgets.app() w = widgets.ListView() w.set_model(model) model += gui.StandardItem("Item") for item in model: pass with open("data.pkl", "wb") as jar: pickle.dump(model, jar) with open("data.pkl", "rb") as jar: model = pickle.load(jar) model += gui.StandardItem("Item2") w.show() app.main_loop()
def test_listview(): widget = widgets.ListView() widget.set_selection_mode("single") widget.toggle_select_all() widget.set_selection_mode("multi") assert widget.get_selection_mode() == "multi"
def test_listview(): widget = widgets.ListView() widget.show() widget.close()