Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Language Bindings
  4. 'Large' program structure - basic concepts
Forum Updated to NodeBB v4.3 + New Features

'Large' program structure - basic concepts

Scheduled Pinned Locked Moved Language Bindings
2 Posts 2 Posters 1.7k 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.
  • S Offline
    S Offline
    SDrake
    wrote on last edited by
    #1

    I am fairly new to both Python and Pyside. I've written a few single page scripts and some which call objects or functions in modules and things generally work as planned after the usual troubleshooting.

    Now, I am trying to write what for me is a large application. Currently it has a main window with menu, tool bar and widgets in the central widget. These widgets (QTabWidgets) have their own seperate modules. The tabs inside these widgets have their own modules. Inside some tabs are QTreeViews and their respective Models... and of course, are written in their own modules. The net result is a heirachical chain of modules calling one another from the top down.

    This was done with the intent to keep the program organized and avoid clutter. So far this has worked.

    The problem I'm now running into is getting objects at one end of the heirarchy to see objects at the other end and interact if needed. Similar problems between objects at the bottoms of different heirarchy chains.

    The immediate small picture problem is working between these scopes / namespaces.

    The bigger picture now has me wondering whether the program has been structured in a workable fashion. If not, how does one structure larger applications? Are there different ways to structure larger applications? Any recommended reading / examples / tutorials?

    Thank You

    1 Reply Last reply
    0
    • B Offline
      B Offline
      bootchk
      wrote on last edited by
      #2

      First, are you talking about instances or classes?

      If instances: Although the general rule is: don't use global variables... sometime you do. (After all, if instances 'know' about other instances, they do, you can't pretend they don't, but you could pass them around in parameters.) Commonly, in a config.py module at the top. For example, mainWindow=None in that module. The module creating the main window would:

      @import config
      ...
      config.mainWindow = QMainWindow()@

      If classes, search for 'circular import problem.' Best to avoid, generally by rearranging your classes, but sometimes you solve by doing imports at the bottom of a module.

      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