Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct

    Unsolved How to creat a layout with BOTH a menubar and a tablewidget

    General and Desktop
    3
    3
    85
    Loading More Posts
    • 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.
    • S
      Saru4 last edited by

      Hi there,
      I've been trying for a while now: (pyqt5 + pycharm + python 3.5)
      I can create a layout with a menubar up the top (File,Edit,Help) and a simple layout.
      I can also create a layout with a tablewidget no problems.
      BUT I cannot get both to work on the same layout.
      Could someone please show me a simple example of both on a page at the same time?

      thanks in advance
      regards
      saru4

      jsulm D 2 Replies Last reply Reply Quote 0
      • jsulm
        jsulm Lifetime Qt Champion @Saru4 last edited by

        @Saru4 Can you show how you're trying to create this layout?

        https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply Reply Quote 0
        • D
          DJaq @Saru4 last edited by

          @Saru4
          Are you using setMenuBar() to set the menu bar to your main window?
          This way, you would use:

          • setMenuBar(/menu bar goes here/) to set the menubar to your window;
          • setLayout(/layout goes here/) to set the main layout in your window.

          Then, you can call layout() to get the pointer on the main window's layout, to which you can call addWidget() to add any widget you like.

          If you want to, I can give you a quick example, but it will be a C++ example as I do not master Python very much. But only the syntax changes a bit, the process should be identical. ^^

          1 Reply Last reply Reply Quote 0
          • First post
            Last post