Unsolved How to disable a qlistview item once it has been clicked
-
I need the clicked item on my
QListView
disabled when ever it is clicked once. Please I need help with this, thanks in advanceQFileSystemModel *listModel = new QFileSystemModel(this); QString directory = GLBclusterPath; ui->clusterList->setModel(listModel); ui->clusterList->setRootIndex(listModel->setRootPath(directory)); connect(ui->clusterList, &QAbstractItemView::clicked, this, &displayTable::nodeClicked);
-
Hi and welcome to devnet,
Do you mean make it "unclickable"/read-only ?
-
@SGaist Yes exactly
-
Then you are going to have to either subclass QFileSystemModel or create a custom proxy model that will modify the flags as necessary.
Note that this requirements sounds a bit strange. Why do you need that ?
-
Thank you @SGaist
-
@SGaist Basically, I have a list of files in a folder, the list view lists each of the files, on click of each of the file, a function
nodeClicked()
is activated which carries out a process using information contained in each file, however, after each item is selected it needs a wait time of about 20 seconds to finish the background process and display the information, the user might not know this and tried to click severally, this only increases the wait time. this is why I need the item "unclickable" after it has been clicked once -
Then you should consider giving more feedback to your users otherwise they are going to think that your application is broken. Something like changing the color of the cell they clicked. Have an additional column giving status information about what is happening with that file, etc.
-
What about a QProgressBar? So the User can see the Progress.