summaryrefslogtreecommitdiffstats
path: root/examples/action/toggleaction
diff options
context:
space:
mode:
Diffstat (limited to 'examples/action/toggleaction')
-rw-r--r--examples/action/toggleaction/labelonoff.xpm169
-rw-r--r--examples/action/toggleaction/toggleaction.cpp31
-rw-r--r--examples/action/toggleaction/toggleaction.doc15
-rw-r--r--examples/action/toggleaction/toggleaction.pro10
4 files changed, 225 insertions, 0 deletions
diff --git a/examples/action/toggleaction/labelonoff.xpm b/examples/action/toggleaction/labelonoff.xpm
new file mode 100644
index 000000000..87696d158
--- /dev/null
+++ b/examples/action/toggleaction/labelonoff.xpm
@@ -0,0 +1,169 @@
+/* XPM */
+static const char * labelonoff_xpm[] = {
+"32 32 134 2",
+" c None",
+". c #FFFFFF",
+"+ c #DEDEDE",
+"@ c #E7E7DE",
+"# c #E7E7E7",
+"$ c #EFEFDE",
+"% c #EFEFE7",
+"& c #F7F7DE",
+"* c #F7F7E7",
+"= c #DEDEE7",
+"- c #C6CEEF",
+"; c #B5B5E7",
+"> c #A5ADF7",
+", c #9CA5F7",
+"' c #8C94F7",
+") c #9C9CEF",
+"! c #BDBDE7",
+"~ c #8C8CEF",
+"{ c #7B7BEF",
+"] c #6B6BF7",
+"^ c #7373F7",
+"/ c #9494EF",
+"( c #DEDEEF",
+"_ c #A5ADFF",
+": c #6B7BFF",
+"< c #4A5AFF",
+"[ c #394AFF",
+"} c #424AF7",
+"| c #3142F7",
+"1 c #4252FF",
+"2 c #5A63F7",
+"3 c #3939F7",
+"4 c #0000FF",
+"5 c #E7E7EF",
+"6 c #9CA5FF",
+"7 c #3139E7",
+"8 c #424AD6",
+"9 c #7373D6",
+"0 c #8C8CCE",
+"a c #8C94CE",
+"b c #9494CE",
+"c c #8C8CD6",
+"d c #8484D6",
+"e c #6B6BD6",
+"f c #2121F7",
+"g c #4A52EF",
+"h c #5252EF",
+"i c #1818F7",
+"j c #C6CEFF",
+"k c #5A5AEF",
+"l c #0810FF",
+"m c #EFE7E7",
+"n c #7B84E7",
+"o c #3131F7",
+"p c #5263FF",
+"q c #7B84F7",
+"r c #1818FF",
+"s c #DEDED6",
+"t c #A5B5FF",
+"u c #848CF7",
+"v c #3939FF",
+"w c #3139EF",
+"x c #8C94EF",
+"y c #A5A5EF",
+"z c #D6D6D6",
+"A c #ADB5F7",
+"B c #7384FF",
+"C c #D6D6E7",
+"D c #2931FF",
+"E c #BDBDEF",
+"F c #C6CEE7",
+"G c #C6C6E7",
+"H c #525AF7",
+"I c #6B73EF",
+"J c #5A6BFF",
+"K c #949CF7",
+"L c #7B84FF",
+"M c #2129F7",
+"N c #0000EF",
+"O c #0808FF",
+"P c #1010FF",
+"Q c #6B6BEF",
+"R c #CECECE",
+"S c #BDBDDE",
+"T c #6B6BDE",
+"U c #4A52E7",
+"V c #2931EF",
+"W c #3942DE",
+"X c #8484EF",
+"Y c #A5A5E7",
+"Z c #CECEDE",
+"` c #A5A5D6",
+" . c #BDBDBD",
+".. c #EFEFEF",
+"+. c #F7F7EF",
+"@. c #8C8C94",
+"#. c #080821",
+"$. c #000008",
+"%. c #181818",
+"&. c #212129",
+"*. c #313131",
+"=. c #393939",
+"-. c #393942",
+";. c #424242",
+">. c #4A4A4A",
+",. c #4A4A52",
+"'. c #42424A",
+"). c #313139",
+"!. c #292931",
+"~. c #000000",
+"{. c #848484",
+"]. c #A5A5AD",
+"^. c #8C8C8C",
+"/. c #ADADAD",
+"(. c #B5B5BD",
+"_. c #7B7B7B",
+":. c #5A5A63",
+"<. c #292929",
+"[. c #6B6B6B",
+"}. c #949494",
+"|. c #F7F7F7",
+"1. c #A5A5A5",
+"2. c #5A5A5A",
+"3. c #636363",
+"4. c #7B7B84",
+"5. c #737373",
+"6. c #101010",
+"7. c #212121",
+"8. c #525252",
+"9. c #080808",
+"0. c #BDBDC6",
+"a. c #C6C6C6",
+"b. c #9C9C9C",
+"c. c #B5B5B5",
+". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
+". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
+". . . + @ # # @ @ $ # # # % $ # @ # @ % $ & $ $ * % % # # . . . ",
+". . . + = @ = - ; > , ' ' ' ) ! @ # ! ) ~ { ] ^ { / ! # @ . . . ",
+". . . + @ ( _ : < [ } } | | [ 1 2 3 4 4 4 4 4 4 4 4 4 3 ! . . . ",
+". . . + 5 6 7 8 9 0 a b c d e 7 4 4 4 f 3 g h g 3 f 4 4 i . . . ",
+". . . @ j g 0 @ $ % % % % $ & k 4 l { @ @ # $ m @ = ; h 4 . . . ",
+". . . + 6 n @ # + # + # # # # o f p q * # # # # # @ * % r . . . ",
+". . . s t u @ @ # @ # # # @ # v w ] x & @ # # @ # & % y 4 . . . ",
+". . . z A B / C = # # @ # # % ^ < D k E F = C C G ) H 4 4 . . . ",
+". . . s G I J : ' ' K , ' u L < M N N 4 4 O P O 4 4 4 4 Q . . . ",
+". . . R $ S T U } } } } | V V W 0 X 3 P 4 4 4 4 P f h Y % . . . ",
+". . . R # # @ Z ` a d d a ` S @ % % # = F ! ; G = = % % # . . . ",
+". . . ...# # # % * % * +.* % # # % # % % % * % % # % # # . . . ",
+". . . @.. . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
+". . #.$.%.&.*.=.-.-.;.;.;.>.>.>.,.>.>.>.>.'.;.;.;.-.-.).!.&.$.. ",
+". . ~.{.R R z z z z + + + + + + + + + + + + + + + s z z s z ].. ",
+". . ).z ^./.# # # # # + + + + # + + + # + + + @ + = # % (._.... ",
+". . :.^.~.^...+ + + + # # # + + # + # + # # @ = # @ # + *.<.... ",
+". . [.^.~.}.. # # # ....# ....+ # + ..|.# + = # ....# ..<.*.. . ",
+". . -.;.~.=._.+ # # 1.2.;.3./.# # # _.[.R # # + 4.5.R [.6.6.[.. ",
+". . <.%.~.%.;.+ # 2.~.7.>.%.~.{...# 5.~.8...+._.~.2.+ ;.~.9.=.. ",
+". . 5.}.~.^.|...{.~.[.....+ 8.~. ...# 8.~./.0.~.;.# % + 7.=.|.. ",
+". . 5.}.~.{.|.# =.9.+ ..# ..a.~.5.....z %.7.<.%.R ..# = %.=.|.. ",
+". . 5.}.~.{...+ 7.~.*.*.*.*.*.~.>.# # ../.~.~.1...# # @ %.=.|.. ",
+". . 5.b.~.{.|.+ %.6.8.8.8.8.8.2.^.+ # ..b.~.~.^...# # + %.=.|.. ",
+". . 5.b.~._.|.+ *.%...|.......a.+ # ..a.6.=.>.~.c...# + 6.;.. . ",
+". . 5./.~.5.. ..[.~.{.|...|.^.~.{...+ *.9.a.z 6.<.z ..+ 7.=.. . ",
+". . [.a.~.%.2.z + 7.~.2.}.3.~.7.z ..[.~._...|.{.~.8...# =.~.>.. ",
+". . 3.# {.<.%.c...z [.7.9.%.3.R ..R ;.2.+ # # # 3.;.a.../.;.<.. ",
+". . 3.= ..+ + # # # ..# s + ..# # + # # # + # # # # + # ....|.. ",
+". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . "};
diff --git a/examples/action/toggleaction/toggleaction.cpp b/examples/action/toggleaction/toggleaction.cpp
new file mode 100644
index 000000000..e9fcc5c49
--- /dev/null
+++ b/examples/action/toggleaction/toggleaction.cpp
@@ -0,0 +1,31 @@
+#include <qapplication.h>
+#include <qmainwindow.h>
+#include <qtoolbar.h>
+#include <qaction.h>
+
+#include "labelonoff.xpm"
+
+int main( int argc, char **argv )
+{
+ TQApplication app( argc, argv );
+ TQMainWindow * window = new TQMainWindow;
+ window->setCaption("TQt Example - Toggleaction");
+ TQToolBar * toolbar = new TQToolBar( window );
+
+ TQAction * labelonoffaction = new TQAction( window, "labelonoff" );
+ labelonoffaction->setToggleAction( TRUE );
+
+ labelonoffaction->setText( "labels on/off" );
+ labelonoffaction->setAccel( TQt::ALT+TQt::Key_L );
+ labelonoffaction->setIconSet( (TQPixmap) labelonoff_xpm );
+
+ TQObject::connect( labelonoffaction, SIGNAL( toggled( bool ) ),
+ window, SLOT( setUsesTextLabel( bool ) ) );
+
+ labelonoffaction->addTo( toolbar );
+
+ app.setMainWidget( window );
+ window->show();
+ return app.exec();
+}
+
diff --git a/examples/action/toggleaction/toggleaction.doc b/examples/action/toggleaction/toggleaction.doc
new file mode 100644
index 000000000..7924a2631
--- /dev/null
+++ b/examples/action/toggleaction/toggleaction.doc
@@ -0,0 +1,15 @@
+/*! \page toggleaction-example.html
+
+ \ingroup qaction-examples
+
+ \title A Tiny Example Featuring a Toggle Action
+
+ This example program demonstrates the use of QAction
+ in its incarnation as a toggle action.
+
+ <hr>
+
+ Main:
+
+ \include action/toggleaction/toggleaction.cpp
+*/
diff --git a/examples/action/toggleaction/toggleaction.pro b/examples/action/toggleaction/toggleaction.pro
new file mode 100644
index 000000000..697d7cd76
--- /dev/null
+++ b/examples/action/toggleaction/toggleaction.pro
@@ -0,0 +1,10 @@
+TEMPLATE = app
+TARGET = toggleaction
+
+CONFIG += qt warn_on release
+DEPENDPATH = ../../../include
+
+REQUIRES = full-config
+
+HEADERS =
+SOURCES = toggleaction.cpp