Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Double clicking tab to rename and set window title to new name
adam0982 last edited by
I am working on a program where I have a class MainWindow that is derived from QMainWindow. In that class, I initialize mTabWidget = new QTabWidget, then I set this as my central widget (setCentralWidget(mTabWidget). Then to add a tab I use mTabWidget->addTab(scrollArea, fileName), where scrollArea is a QScrollArea pointer and fileName is a QString. Then I set the title of the main window using setWindowTitle(fileName).
Now my goal is to be able to double click on a tab to rename it. I've read that I need to subclass the QTabBar class as well as the QTabWidget to do this. I have this working, but can anyone give me an example on how they would do this or an alternate idea.
The second part of my problem is that when I double click the tab to rename, I can get it to rename the tab but not set the window title to the new tab name. In my subclass I used the setWindowTitle() method again, but it does nothing.
I am stumped on this issue and any help would be extremely appreciated.
Hi and welcome to devnet,
Please don't post the same thread in multiple sub forums one is enough
Closing this one