Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QTabWidget: how to implement MRU Ctrl+Tab switching ?

QTabWidget: how to implement MRU Ctrl+Tab switching ?

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 2 Posters 91 Views
  • 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.
  • A Offline
    A Offline
    AndrzejB
    wrote 21 days ago last edited by
    #1

    I am using a QTabWidget in my application, and while the default Ctrl+Tab cycles through tabs linearly, I would like to implement a "most recently used" (MRU) switching behavior, similar to what users experience in browsers like Firefox or IDEs like CLion / IntelliJ IDEA.

    My desired functionality for Ctrl+Tab is as follows:

    • quick Press/Release: A standard, quick press and release of Ctrl+Tab should switch focus directly to the immediately preceding (most recently used) tab.
    • hold Ctrl, Press Tab Repeatedly: When Ctrl is held down and Tab is pressed:
      • A popup should appear, listing the tabs ordered by most recently used.
      • Subsequent presses of Tab (while Ctrl is held) should cycle forward through this MRU list.
      • Shift+Ctrl+Tab should cycle backward through the MRU list.
      • Releasing the Ctrl key should activate the tab currently selected in the popup list.
    1 Reply Last reply
    0
    • K Offline
      K Offline
      Kent-Dorfman
      wrote 21 days ago last edited by
      #2

      FWIW, if there is no Qt direct solution then you should be able to work out the logic and build it manually, by catching the relevant framework events to determine last/next tab and manage a queue of them.

      1 Reply Last reply
      2
      • A Offline
        A Offline
        AndrzejB
        wrote 21 days ago last edited by
        #3

        Need new class sub-classing QTabWidget

        MruTabWidget::MruTabWidget(QWidget *parent)  : QTabWidget(parent)
        

        and

        installEventFilter
        
        1 Reply Last reply
        2

        1/3

        24 Apr 2025, 15:45

        • Login

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