mainform class need to use that structGL and widgetGL too; I wonder if an instance of structGL as member of mainform class is likely...you just said avoid global variabiles.....