Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Special Interest Groups
  3. C++ Gurus
  4. Double clicking tab to rename and set window title to new name
Qt 6.11 is out! See what's new in the release blog

Double clicking tab to rename and set window title to new name

Scheduled Pinned Locked Moved C++ Gurus
2 Posts 2 Posters 2.1k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by
    #1

    Hey everyone,

    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.

    Thanks!

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      Please don't post the same thread in multiple sub forums one is enough

      "Duplicate":http://qt-project.org/forums/viewthread/41336/

      Closing this one

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved