summaryrefslogtreecommitdiffstats
path: root/tools/designer/examples/multiclip
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/multiclip
downloadtqt3-d796c9dd933ab96ec83b9a634feedd5d32e1ba3f.tar.gz
tqt3-d796c9dd933ab96ec83b9a634feedd5d32e1ba3f.zip
Test conversion to TQt3 from Qt3 8c6fc1f8e35fd264dd01c582ca5e7549b32ab731
Diffstat (limited to 'tools/designer/examples/multiclip')
-rw-r--r--tools/designer/examples/multiclip/main.cpp25
-rw-r--r--tools/designer/examples/multiclip/multiclip.pro9
-rw-r--r--tools/designer/examples/multiclip/multiclip.ui206
-rw-r--r--tools/designer/examples/multiclip/multiclip.ui.h70
4 files changed, 310 insertions, 0 deletions
diff --git a/tools/designer/examples/multiclip/main.cpp b/tools/designer/examples/multiclip/main.cpp
new file mode 100644
index 000000000..4c6a94092
--- /dev/null
+++ b/tools/designer/examples/multiclip/main.cpp
@@ -0,0 +1,25 @@
+/****************************************************************************
+**
+** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved.
+**
+** This file is part of an example program for TQt. This example
+** program may be used, distributed and modified without limitation.
+**
+*****************************************************************************/
+
+#include <qapplication.h>
+#include "multiclip.h"
+
+
+int main( int argc, char *argv[] )
+{
+ TQApplication app( argc, argv );
+
+ MulticlipForm clippingForm;
+ app.setMainWidget( &clippingForm );
+ clippingForm.show();
+
+ return app.exec();
+}
+
+
diff --git a/tools/designer/examples/multiclip/multiclip.pro b/tools/designer/examples/multiclip/multiclip.pro
new file mode 100644
index 000000000..f9391cbee
--- /dev/null
+++ b/tools/designer/examples/multiclip/multiclip.pro
@@ -0,0 +1,9 @@
+TEMPLATE = app
+LANGUAGE = C++
+TARGET = multiclip
+
+SOURCES += main.cpp
+FORMS = multiclip.ui
+CONFIG += qt warn_on release
+DBFILE = multiclip.db
+IMAGEFILE = images.cpp
diff --git a/tools/designer/examples/multiclip/multiclip.ui b/tools/designer/examples/multiclip/multiclip.ui
new file mode 100644
index 000000000..52f83f825
--- /dev/null
+++ b/tools/designer/examples/multiclip/multiclip.ui
@@ -0,0 +1,206 @@
+<!DOCTYPE UI><UI version="3.0" stdsetdef="1">
+<class>MulticlipForm</class>
+<include location="global" impldecl="in declaration">qclipboard.h</include>
+<include location="global" impldecl="in implementation">qapplication.h</include>
+<include location="local" implDecl="in declaration">multiclip.ui.h</include>
+<variable>TQClipboard *cb;</variable>
+<pixmapinproject/>
+<layoutdefaults spacing="6" margin="11"/>
+<widget class="TQDialog">
+ <property name="name">
+ <cstring>MulticlipForm</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>585</width>
+ <height>472</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Multiclip</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="TQLayoutWidget">
+ <property name="name">
+ <cstring>Layout1</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="TQLabel">
+ <property name="name">
+ <cstring>TextLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>Current Clipping</string>
+ </property>
+ </widget>
+ <widget class="TQLineEdit">
+ <property name="name">
+ <cstring>currentLineEdit</cstring>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="TQLayoutWidget">
+ <property name="name">
+ <cstring>Layout19</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="TQPushButton" row="4" column="1">
+ <property name="name">
+ <cstring>addPushButton</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Add Clipping</string>
+ </property>
+ </widget>
+ <spacer row="2" column="1">
+ <property name="name">
+ <cstring>Spacer4</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="TQPushButton" row="7" column="1">
+ <property name="name">
+ <cstring>tquitPushButton</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Quit</string>
+ </property>
+ </widget>
+ <widget class="TQLabel" row="0" column="1">
+ <property name="name">
+ <cstring>TextLabel3</cstring>
+ </property>
+ <property name="text">
+ <string>Length</string>
+ </property>
+ </widget>
+ <widget class="TQLabel" row="0" column="0">
+ <property name="name">
+ <cstring>TextLabel2</cstring>
+ </property>
+ <property name="text">
+ <string>Previous Clippings</string>
+ </property>
+ </widget>
+ <widget class="TQCheckBox" row="3" column="1">
+ <property name="name">
+ <cstring>autoCheckBox</cstring>
+ </property>
+ <property name="text">
+ <string>A&amp;uto Add Clippings</string>
+ </property>
+ </widget>
+ <widget class="TQLCDNumber" row="1" column="1">
+ <property name="name">
+ <cstring>lengthLCDNumber</cstring>
+ </property>
+ </widget>
+ <widget class="TQPushButton" row="6" column="1">
+ <property name="name">
+ <cstring>deletePushButton</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Delete Clipping</string>
+ </property>
+ </widget>
+ <widget class="TQListBox" row="1" column="0" rowspan="7" colspan="1">
+ <property name="name">
+ <cstring>clippingsListBox</cstring>
+ </property>
+ </widget>
+ <widget class="TQPushButton" row="5" column="1">
+ <property name="name">
+ <cstring>copyPushButton</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Copy Previous</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ </vbox>
+</widget>
+<connections>
+ <connection language="C++">
+ <sender>tquitPushButton</sender>
+ <signal>clicked()</signal>
+ <receiver>MulticlipForm</receiver>
+ <slot>accept()</slot>
+ </connection>
+ <connection language="C++">
+ <sender>addPushButton</sender>
+ <signal>clicked()</signal>
+ <receiver>MulticlipForm</receiver>
+ <slot>addClipping()</slot>
+ </connection>
+ <connection language="C++">
+ <sender>copyPushButton</sender>
+ <signal>pressed()</signal>
+ <receiver>MulticlipForm</receiver>
+ <slot>copyPrevious()</slot>
+ </connection>
+ <connection language="C++">
+ <sender>deletePushButton</sender>
+ <signal>clicked()</signal>
+ <receiver>MulticlipForm</receiver>
+ <slot>deleteClipping()</slot>
+ </connection>
+ <slot access="public" specifier="virtual" language="C++" returnType="void">addClipping()</slot>
+ <slot access="public" specifier="virtual" language="C++" returnType="void">dataChanged()</slot>
+ <slot access="public" specifier="virtual" language="C++" returnType="void">deleteClipping()</slot>
+ <slot access="protected" specifier="virtual" language="C++" returnType="void">init()</slot>
+ <slot access="public" specifier="virtual" language="C++" returnType="void">selectionChanged()</slot>
+ <slot access="public" specifier="virtual" language="C++" returnType="void">copyPrevious()</slot>
+ <slot access="public" specifier="virtual" language="C++" returnType="void">clippingChanged( const TQString &amp; clipping )</slot>
+</connections>
+<tabstops>
+ <tabstop>currentLineEdit</tabstop>
+ <tabstop>clippingsListBox</tabstop>
+ <tabstop>autoCheckBox</tabstop>
+ <tabstop>addPushButton</tabstop>
+ <tabstop>copyPushButton</tabstop>
+ <tabstop>deletePushButton</tabstop>
+ <tabstop>tquitPushButton</tabstop>
+</tabstops>
+</UI>
diff --git a/tools/designer/examples/multiclip/multiclip.ui.h b/tools/designer/examples/multiclip/multiclip.ui.h
new file mode 100644
index 000000000..a2b0b0cf7
--- /dev/null
+++ b/tools/designer/examples/multiclip/multiclip.ui.h
@@ -0,0 +1,70 @@
+void MulticlipForm::addClipping()
+{
+ TQString text = currentLineEdit->text();
+ if ( ! text.isEmpty() ) {
+ lengthLCDNumber->display( (int)text.length() );
+ int i = 0;
+ for ( ; i < (int)clippingsListBox->count(); i++ ) {
+ if ( clippingsListBox->text( i ) == text ) {
+ i = -1; // Do not add duplicates
+ break;
+ }
+ }
+ if ( i != -1 )
+ clippingsListBox->insertItem( text, 0 );
+ }
+}
+
+void MulticlipForm::dataChanged()
+{
+ TQString text;
+ text = cb->text();
+ clippingChanged( text );
+ if ( autoCheckBox->isChecked() )
+ addClipping();
+}
+
+void MulticlipForm::deleteClipping()
+{
+ clippingChanged( "" );
+ clippingsListBox->removeItem( clippingsListBox->currentItem() );
+}
+
+void MulticlipForm::init()
+{
+ lengthLCDNumber->setBackgroundColor( darkBlue );
+ currentLineEdit->setFocus();
+
+ cb = qApp->clipboard();
+ connect( cb, SIGNAL( dataChanged() ), SLOT( dataChanged() ) );
+ if ( cb->supportsSelection() )
+ connect( cb, SIGNAL( selectionChanged() ), SLOT( selectionChanged() ) );
+
+ dataChanged();
+}
+
+void MulticlipForm::selectionChanged()
+{
+ cb->setSelectionMode( TRUE );
+ dataChanged();
+ cb->setSelectionMode( FALSE );
+}
+
+void MulticlipForm::copyPrevious()
+{
+ if ( clippingsListBox->currentItem() != -1 ) {
+ cb->setText( clippingsListBox->currentText() );
+ if ( cb->supportsSelection() ) {
+ cb->setSelectionMode( TRUE );
+ cb->setText( clippingsListBox->currentText() );
+ cb->setSelectionMode( FALSE );
+ }
+ }
+}
+
+void MulticlipForm::clippingChanged( const TQString & clipping )
+{
+ currentLineEdit->setText( clipping );
+ lengthLCDNumber->display( (int)clipping.length() );
+}
+