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. Movable tabs with my own QTabBar class
Forum Updated to NodeBB v4.3 + New Features

Movable tabs with my own QTabBar class

Scheduled Pinned Locked Moved General and Desktop
5 Posts 3 Posters 1.4k Views 2 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.
  • A Offline
    A Offline
    Anna234
    wrote on last edited by
    #1

    I'm trying to create movable tabs in my QT 4.8 application. I have created my own class of QTabBar so I can set my own style, and in that I call setMovable( true ); directly inside the constructor. But tabs are not movable. What else do I have to implement to make the tabs movable? Do I need to implement any of the events for movable tabs to work? I cannot find any documentation on this.

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

      Hi and welcome to devnet,

      How are you using that QTabBar ?

      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
      • A Offline
        A Offline
        Anna234
        wrote on last edited by
        #3

        I have created my own class inhering from QTabBar. In that class I overwrite tabSizeHint, paintEvent, mouseMoveEvent, and leaveEvent.

        The QTabBar is then attached to my own instantiation of a QTabWidget class. In there, I do

        setTabBar( new MyTabBar( this ) );
        setMovable( true );

        That QTabWidget is then instantiated on my QMainWindow.

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

          Since you overwrote mouseMouveEvent, did you forget to call the base class implementation ?

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

          U 1 Reply Last reply
          1
          • SGaistS SGaist

            Since you overwrote mouseMouveEvent, did you forget to call the base class implementation ?

            U Offline
            U Offline
            Unknown-T
            wrote on last edited by
            #5

            @SGaist a year has passed after your message but now you helped me very much. Thank you!

            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