[PYTHON] Set the specified column of QTableWidget to ReadOnly StyledItemDelegate

I would like to post a memorandum and correction. I wrote a Styled Item Delegate that rewrote the C ++ example. ReadOnlyStyledItemDelegate.

ReadOnlyStyledItemDelegate.py


from PySide2.QtWidgets import QStyledItemDelegate

class ReadOnlyStyledItemDelegate(QStyledItemDelegate):
    def __init__(self, parent=None):
        super().__init__(parent)

    def createEditor(self, parent, option, index):
        return None

I think that the non-updatable of specific columns is a necessary function in practice. Since the C ++ example returns null, isn't it okay to use None? I wrote it with an understanding of that. Since it is not possible to create, the function after delegate should be implemented can be left to the parent, so only createEditor.

Recommended Posts

Set the specified column of QTableWidget to ReadOnly StyledItemDelegate
Set the range of active strips to the preview range
Extract the index of the original set list that corresponds to the list of subsets.
How to set up the development environment of ev3dev [Windows version]
Supplement to the explanation of vscode
The story of trying to reconnect the client
[pyqtgraph] Set the size ratio of the graph
Script to change the description of fasta
10 methods to improve the accuracy of BERT
How to check the version of Django
Set the time zone to Japan Standard Time
The story of adding MeCab to ubuntu 16.04
How to set the server time to Japanese time
Get the column list & data list of CASTable
Arbitrarily rearrange the column order of Pandas.DataFrame
[linux] Split files to the specified size
Get the last day of the specified month
Set the process name of the Python program
The story of pep8 changing to pycodestyle
Set the number of elements in a NumPy one-dimensional array to a power of 2 (0 padded)
[Bash] While read, pass the contents of the file to variables for each column
How to access the contents of a Linux disk on a Mac (but read-only)
I want to set a life cycle in the task definition of ECS
How to make a Raspberry Pi that speaks the tweets of the specified user
Python C / C ++ Extensions: Pass some of the data as np.array to Python (set stride)
How to calculate the volatility of a brand
How to find the area of the Voronoi diagram
Combinatorial optimization to find the hand of "Millijan"
Setting to output the log of cron execution
The inaccuracy of Tensorflow was due to log (0)
Divide the string into the specified number of characters
I tried to touch the API of ebay
I tried to correct the keystone of the image
Change the decimal point of logging from, to.
Recursively search the specified directory to see the file
To get the path of the currently running python.exe
Djnago Memo Set Japanese to filename of Content-Disposition
I want to customize the appearance of zabbix
From the introduction of pyethapp to the execution of contract
Try to simulate the movement of the solar system
Procedure to set hydrogen of atom (virtual environment)
The story of moving from Pipenv to Poetry
I tried to predict the price of ETF
I tried to vectorize the lyrics of Hinatazaka46!
Use Pandas to write only the specified lines of the data frame to an excel file
Set the output destination of the execution result to Vim started as a modeless window
I tried to sort out the objects from the image of the steak set meal-④ Clustering
Find a guideline for the number of processes / threads to set in the application server
Output the specified table of Oracle database in Python to Excel for each file
It's time to seriously think about the definition and skill set of data scientists