Skip to content

What We Know About Abstract Table Models

russ_hensel edited this page Jul 18, 2026 · 1 revision
Table of Contents

Introduction

THIS IS A STUB, WE WILL OVER TIME WRITE THIS A table widget displays data in a tabluar form, is is derived from QAbstractTableModel an is used with a QTableView, unlike a QTableWidget which has a self contained view. A TableModel offers more flexibility than a QTableWidget at the cost of complexity. We make this even more complex by including a QSortFilterProxyModel which can be a gotcha.

Features

Some related to appearance. For example:

Others are related to user actions the widget can detect and act on

The code for the tab is: pyqt_by_example/tabs/sql_widgets/tab_table_model.py at main · russ-hensel/pyqt_by_example https://github.com/russ-hensel/pyqt_by_example/blob/main/tabs/sql_widgets/tab_table_model.py but is better viewed in your own IDE. The code depends on the framework code, which typically you do not need to view, some documentation for it is in Tab Framework Code

Interactions

Interaction to try on this tab:

  • poke around -- do not forget to look at the whole GUI for responses.

To see and change the state use the mutate/examine button and read the code in the mutate_x methods.
more documentation is in the code. Coverage is not complete, work continues.

You can use the wat-inspect to find out more or dive into the documentation which is all over the web.

AASI

Ask A Simulated Intelligence ( AI ) Sites like ChatGPT do a pretty good job on QT. Here is a prompt that we have found useful:

Suppose you are an experienced Python QT developer. I need help with a QT widget, QAbstractTableModel. I would like to modify the widget so that ..( the background color is red )... Can you give me the code that will do that, please include a version that makes the change at create time, and another that makes the modification after the widget is created. Please include error checking code, if applicable.

Screenshot

Run the app for a screenshot, that way it will be accurate and up to date

Clone this wiki locally