Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
How can exclude the file extension when i rename the item in QTreeView
WhichOneCanIDo last edited by WhichOneCanIDo
Now the action to rename will choose all the text i wanted to change ,but i want to keep the file extension used to be. I don't want the user change the extension when they don't want to that.
The result i wanted is that the blue bar will not contain the extension name, just like the file renaming in the Windows.
now i used the code
which just the api of QT.
So how can i solve the problem. thanks.
i found that i can use the delgate to replace the default editor with qlineedit .
but it still cant solve the problem because it selectAll when i edit ,i cant change selection by setSelection.
what can i do next.
i cant change selection by setSelection
Sure, you can.
First search for the file extension. See the indexOf() methods in QString.. Then you know where the file extension starts and you can set the selection as needed.
WhichOneCanIDo last edited by