summaryrefslogtreecommitdiffstats
path: root/tools/designer/examples/sizeaware
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2011-11-08 12:31:36 -0600
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2011-11-08 12:31:36 -0600
commitd796c9dd933ab96ec83b9a634feedd5d32e1ba3f (patch)
tree6e3dcca4f77e20ec8966c666aac7c35bd4704053 /tools/designer/examples/sizeaware
downloadtqt3-d796c9dd933ab96ec83b9a634feedd5d32e1ba3f.tar.gz
tqt3-d796c9dd933ab96ec83b9a634feedd5d32e1ba3f.zip
Test conversion to TQt3 from Qt3 8c6fc1f8e35fd264dd01c582ca5e7549b32ab731
Diffstat (limited to 'tools/designer/examples/sizeaware')
-rw-r--r--tools/designer/examples/sizeaware/main.cpp11
-rw-r--r--tools/designer/examples/sizeaware/sizeaware.cpp38
-rw-r--r--tools/designer/examples/sizeaware/sizeaware.h23
-rw-r--r--tools/designer/examples/sizeaware/sizeaware.pro6
4 files changed, 78 insertions, 0 deletions
diff --git a/tools/designer/examples/sizeaware/main.cpp b/tools/designer/examples/sizeaware/main.cpp
new file mode 100644
index 000000000..6ad151e63
--- /dev/null
+++ b/tools/designer/examples/sizeaware/main.cpp
@@ -0,0 +1,11 @@
+#include <qapplication.h>
+#include "sizeaware.h"
+
+int main( int argc, char ** argv )
+{
+ TQApplication app( argc, argv );
+ SizeAware *sizeaware = new SizeAware( 0, 0, TRUE );
+ sizeaware->exec();
+ sizeaware->destroy();
+ return 0;
+}
diff --git a/tools/designer/examples/sizeaware/sizeaware.cpp b/tools/designer/examples/sizeaware/sizeaware.cpp
new file mode 100644
index 000000000..9731126ca
--- /dev/null
+++ b/tools/designer/examples/sizeaware/sizeaware.cpp
@@ -0,0 +1,38 @@
+#include "sizeaware.h"
+#include <qsettings.h>
+
+
+SizeAware::SizeAware( TQDialog *parent, const char *name, bool modal )
+ : TQDialog( parent, 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 );
+}
+
+
+
diff --git a/tools/designer/examples/sizeaware/sizeaware.h b/tools/designer/examples/sizeaware/sizeaware.h
new file mode 100644
index 000000000..73c208fbd
--- /dev/null
+++ b/tools/designer/examples/sizeaware/sizeaware.h
@@ -0,0 +1,23 @@
+#ifndef SIZEAWARE_H
+#define SIZEAWARE_H
+#include <qdialog.h>
+
+class SizeAware : public TQDialog
+{
+ Q_OBJECT
+ Q_PROPERTY( TQString company READ company WRITE setCompany )
+ Q_PROPERTY( TQString settingsFile READ settingsFile WRITE setSettingsFile )
+public:
+ SizeAware( TQDialog *parent = 0, const char *name = 0, bool modal = FALSE );
+ ~SizeAware();
+ void setCompany( TQString company ) { m_company = company; }
+ TQString company() const { return m_company; }
+ void setSettingsFile( TQString settingsFile ) { m_settingsFile = settingsFile; }
+ TQString settingsFile() const { return m_settingsFile; }
+public slots:
+ void destroy();
+private:
+ TQString m_company;
+ TQString m_settingsFile;
+};
+#endif
diff --git a/tools/designer/examples/sizeaware/sizeaware.pro b/tools/designer/examples/sizeaware/sizeaware.pro
new file mode 100644
index 000000000..c223ed73d
--- /dev/null
+++ b/tools/designer/examples/sizeaware/sizeaware.pro
@@ -0,0 +1,6 @@
+TEMPLATE = app
+TARGET = sizeaware
+
+CONFIG += qt warn_on release
+SOURCES += sizeaware.cpp main.cpp
+HEADERS += sizeaware.h