Results 1 to 5 of 5

Thread: Showing different pages

  1. #1
    Join Date
    Feb 2016
    Posts
    2
    Qt products
    Qt5
    Platforms
    Windows

    Question Showing different pages

    Hi,
    I am lerning python and SQL by programming a small football manager game. The purpose is to learn code and not the game. Now I thought to make the GUI for the game first. However, the start is harder than expected although using the QT Designer 4.8.7.
    Now to my problem. I made a new windows and put my desired menu points. Now I would like to design for every Menu point such as "Team" and for each sub menu like "Main Team" a page. And the overal goal is that if one menu point is clicked the assigned page with the content is shown. Can I do this with the menu point, or do I have to create a Tab Widget inside the Main Windows?

    Kind Regards
    Popolik
    Attached Images Attached Images

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Showing different pages

    You don't really need a different "page" for each team. What you probably need to think about is having one page, but changing the contents to reflect whichever team is currently selected. If you make a unique page for each team, then it makes it very hard for you to add new teams without rebuilding your program with new page widgets, new menus, etc.

    If you want to be able to load and display the information for all of the teams at the same time, then using a QTabWidget as the "central widget" for your QMainWindow class would work, but each tab should still contain an instance of the same page widget that you fill with that team's information.

    If you only want the information for a single team at a time, then don't use the tab widget, simply make the page widget the central widget for the main window. Use the slots connected to the menu items to change the content of this page according to which team was selected.

  3. #3
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Showing different pages

    You can also use a QStackedWidget as the main window's central widget and then show the respective page on demand.

    It is a bit like tab widget, just without visible tabs.

    Cheers,
    _

  4. #4
    Join Date
    Feb 2016
    Posts
    2
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Showing different pages

    Thank you both for the suggestions. Maybe I described the problem from different point of view. I thought about static webpages where contents can be reached on different pages. I do actually want one page that can be used for every team, like d_stranz proposed. I know loocked up more detail on QStackedWidgetand I think this is what I am looking for. So if I design first page of the Stacked Widget than I can assign that this page is shown if "Team" is clicked, right ? And if I click "Transfer Market" than my second page will be shown with is design and contens. So if I design let's say 20 pages (for each menu and sub menu point), is this okay to do or will this make problems later when python programming will be applied?

  5. #5
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Showing different pages

    That should be ok.

    Cheers,
    _

Similar Threads

  1. print several pages
    By beirrascan in forum Newbie
    Replies: 1
    Last Post: 8th November 2010, 23:26
  2. QTableView with pages
    By sysmaniac in forum Newbie
    Replies: 1
    Last Post: 4th November 2010, 19:11
  3. QWebView showing blank pages.
    By gontham in forum Qt Programming
    Replies: 1
    Last Post: 26th May 2010, 11:02
  4. Showing QMainWindow without showing a child QWidget
    By discostu in forum Qt Programming
    Replies: 3
    Last Post: 4th March 2007, 10:03
  5. switching between pages
    By Kapil in forum Newbie
    Replies: 9
    Last Post: 6th March 2006, 11:57

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.