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. Tabbed menubar
Forum Updated to NodeBB v4.3 + New Features

Tabbed menubar

Scheduled Pinned Locked Moved Unsolved General and Desktop
8 Posts 3 Posters 903 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.
  • B Offline
    B Offline
    burrito22
    wrote on last edited by
    #1

    Hi,
    is there any way to create menu divided into tabs like for example MS Office 2007 has?

    1 Reply Last reply
    0
    • Chris KawaC Offline
      Chris KawaC Offline
      Chris Kawa
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Do you mean the ribbon? Yes, but there's no ready made componenent like that in Qt. You'd have to build it yourself with QTabBar, QStackedWidget, QFrame etc.
      Of course people already did it, so if you don't want to write that yourself you can buy a ready solution like QtitanRibbon or find an open source implementation like qt-ribbon.

      B 1 Reply Last reply
      1
      • Chris KawaC Chris Kawa

        Do you mean the ribbon? Yes, but there's no ready made componenent like that in Qt. You'd have to build it yourself with QTabBar, QStackedWidget, QFrame etc.
        Of course people already did it, so if you don't want to write that yourself you can buy a ready solution like QtitanRibbon or find an open source implementation like qt-ribbon.

        B Offline
        B Offline
        burrito22
        wrote on last edited by
        #3

        @Chris-Kawa yeah, ribbon. I need it in Python unfortunately.

        1 Reply Last reply
        0
        • Chris KawaC Offline
          Chris KawaC Offline
          Chris Kawa
          Lifetime Qt Champion
          wrote on last edited by
          #4

          QtitanRibbon at least seems to have python bindings. I'm sure if you google for it you'll find more options. It's not exactly new or unusual concept.

          1 Reply Last reply
          0
          • B Offline
            B Offline
            burrito22
            wrote on last edited by burrito22
            #5

            I'm looking for free solution 😅 . Is there any docs/tutorials to help defining such a thing on my own? I was searching for definition of QTabWidget class but found nothing

            1 Reply Last reply
            0
            • C Offline
              C Offline
              ChrisW67
              wrote on last edited by ChrisW67
              #6

              @burrito22 said in Tabbed menubar:

              I was searching for definition of QTabWidget class but found nothing

              Really? The first link in a Google search gives you the C++ QTabWidget docs, and the second link gives you a Pythonic version.

              Is there any docs/tutorials to help defining such a thing on my own?

              You could model you own Python version on the GPLv3 qt-ribbon already referenced.

              B 1 Reply Last reply
              0
              • C ChrisW67

                @burrito22 said in Tabbed menubar:

                I was searching for definition of QTabWidget class but found nothing

                Really? The first link in a Google search gives you the C++ QTabWidget docs, and the second link gives you a Pythonic version.

                Is there any docs/tutorials to help defining such a thing on my own?

                You could model you own Python version on the GPLv3 qt-ribbon already referenced.

                B Offline
                B Offline
                burrito22
                wrote on last edited by burrito22
                #7

                @ChrisW67

                class QMenuBar(QWidget):
                    def __init__(self, parent: typing.Optional[QWidget] = ...) -> None: ...
                
                    def setNativeMenuBar(self, nativeMenuBar: bool) -> None: ...
                    def isNativeMenuBar(self) -> bool: ...
                    def timerEvent(self, a0: QtCore.QTimerEvent) -> None: ...
                    def event(self, a0: QtCore.QEvent) -> bool: ...
                    def eventFilter(self, a0: QtCore.QObject, a1: QtCore.QEvent) -> bool: ...
                    def focusInEvent(self, a0: QtGui.QFocusEvent) -> None: ...
                    def focusOutEvent(self, a0: QtGui.QFocusEvent) -> None: ...
                    def actionEvent(self, a0: QtGui.QActionEvent) -> None: ...
                    def resizeEvent(self, a0: QtGui.QResizeEvent) -> None: ...
                    def paintEvent(self, a0: QtGui.QPaintEvent) -> None: ...
                    def leaveEvent(self, a0: QtCore.QEvent) -> None: ...
                    def mouseMoveEvent(self, a0: QtGui.QMouseEvent) -> None: ...
                    def mousePressEvent(self, a0: QtGui.QMouseEvent) -> None: ...
                    def mouseReleaseEvent(self, a0: QtGui.QMouseEvent) -> None: ...
                    def keyPressEvent(self, a0: QtGui.QKeyEvent) -> None: ...
                    def changeEvent(self, a0: QtCore.QEvent) -> None: ...
                    def initStyleOption(self, option: 'QStyleOptionMenuItem', action: QAction) -> None: ...
                    def hovered(self, action: QAction) -> None: ...
                    def triggered(self, action: QAction) -> None: ...
                    def setVisible(self, visible: bool) -> None: ...
                    def cornerWidget(self, corner: QtCore.Qt.Corner = ...) -> QWidget: ...
                    def setCornerWidget(self, widget: QWidget, corner: QtCore.Qt.Corner = ...) -> None: ...
                    def actionAt(self, a0: QtCore.QPoint) -> QAction: ...
                    def actionGeometry(self, a0: QAction) -> QtCore.QRect: ...
                    def heightForWidth(self, a0: int) -> int: ...
                    def minimumSizeHint(self) -> QtCore.QSize: ...
                    def sizeHint(self) -> QtCore.QSize: ...
                    def isDefaultUp(self) -> bool: ...
                    def setDefaultUp(self, a0: bool) -> None: ...
                    def setActiveAction(self, action: QAction) -> None: ...
                    def activeAction(self) -> QAction: ...
                    def clear(self) -> None: ...
                    def insertSeparator(self, before: QAction) -> QAction: ...
                    def insertMenu(self, before: QAction, menu: QMenu) -> QAction: ...
                    def addSeparator(self) -> QAction: ...
                    @typing.overload
                    def addMenu(self, menu: QMenu) -> QAction: ...
                    @typing.overload
                    def addMenu(self, title: str) -> QMenu: ...
                    @typing.overload
                    def addMenu(self, icon: QtGui.QIcon, title: str) -> QMenu: ...
                    @typing.overload
                    def addAction(self, action: QAction) -> None: ...
                    @typing.overload
                    def addAction(self, text: str) -> QAction: ...
                    @typing.overload
                    def addAction(self, text: str, slot: PYQT_SLOT) -> QAction: ...
                

                that's in QWidgets.pyi only. In brackets are arguments, but the body is empty.....

                1 Reply Last reply
                0
                • C Offline
                  C Offline
                  ChrisW67
                  wrote on last edited by
                  #8

                  @burrito22
                  The file you have there is an interface definition (mostly of use to Python IDEs I expect). If you want to see how QMenuBar is implemented you need to look at the C++ sources. There is no Python implementation of QMenuBar, there is only binary glue that loads and uses the compiled Qt library when the Python is executed. The same is true for all the Qt classes exposed in Python:

                  Python interface <-> minimal glue code <-> Qt library.
                  

                  If you want to know how to compose standard widgets into a ribbon-like structure with a degree of flexibility then you could try a Python reimplementation of the C++ open-source example (or a usable subset).

                  Alternatively, you could build the glue that provides Python interfaces to a binary qt-ribbon. Tools like SWIG help but you need to understand both Python and C++ internals. I think this is the harder row to hoe.

                  1 Reply Last reply
                  2

                  • Login

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