diff options
Diffstat (limited to 'experimental/tqtinterface/qt4/tools/designer/examples/sizeaware/sizeaware.cpp')
-rw-r--r-- | experimental/tqtinterface/qt4/tools/designer/examples/sizeaware/sizeaware.cpp | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/experimental/tqtinterface/qt4/tools/designer/examples/sizeaware/sizeaware.cpp b/experimental/tqtinterface/qt4/tools/designer/examples/sizeaware/sizeaware.cpp new file mode 100644 index 000000000..45c568e09 --- /dev/null +++ b/experimental/tqtinterface/qt4/tools/designer/examples/sizeaware/sizeaware.cpp @@ -0,0 +1,38 @@ +#include "sizeaware.h" +#include <tqsettings.h> + + +SizeAware::SizeAware( TQDialog *tqparent, const char *name, bool modal ) + : TQDialog( tqparent, name, modal ) +{ + if ( company().isEmpty() ) + setCompany( "UnknownCompany" ); + if ( settingsFile().isEmpty() ) + setSettingsFile( "UnknownFile" ); + + TQSettings settings; + settings.insertSearchPath( TQSettings::Windows, "/" + company() ); + settings.insertSearchPath( TQSettings::Unix, "/Opt/" + company() + "/share" ); + int width = settings.readNumEntry( "/" + settingsFile() + "/width", 640 ); + int height = settings.readNumEntry( "/" + settingsFile() + "/height", 480 ); + resize( width, height ); +} + + +SizeAware::~SizeAware() +{ + // NOOP +} + +void SizeAware::destroy() +{ + TQSettings settings; + settings.insertSearchPath( TQSettings::Windows, "/" + company() ); + settings.insertSearchPath( TQSettings::Unix, "/Opt/" + company() + "/share" ); + settings.writeEntry( "/" + settingsFile() + "/width", width() ); + settings.writeEntry( "/" + settingsFile() + "/height", height() ); + close( TRUE ); +} + + + |