From bd0f3345a938b35ce6a12f6150373b0955b8dd12 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Sun, 10 Jul 2011 15:24:15 -0500 Subject: Add Qt3 development HEAD version --- doc/html/toggleaction-example.html | 82 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 doc/html/toggleaction-example.html (limited to 'doc/html/toggleaction-example.html') diff --git a/doc/html/toggleaction-example.html b/doc/html/toggleaction-example.html new file mode 100644 index 0000000..0a4f023 --- /dev/null +++ b/doc/html/toggleaction-example.html @@ -0,0 +1,82 @@ + + + + + +A Tiny Example Featuring a Toggle Action + + + + + + + +
+ +Home + | +All Classes + | +Main Classes + | +Annotated + | +Grouped Classes + | +Functions +

A Tiny Example Featuring a Toggle Action

+ + +

+

This example program demonstrates the use of QAction +in its incarnation as a toggle action. +


+

Main: +

#include <qapplication.h>
+#include <qmainwindow.h>
+#include <qtoolbar.h>
+#include <qaction.h>
+
+#include "labelonoff.xpm"
+
+int main( int argc, char **argv )
+{
+    QApplication app( argc, argv );
+    QMainWindow * window = new QMainWindow;
+    window->setCaption("Qt Example - Toggleaction");
+    QToolBar * toolbar = new QToolBar( window );
+
+    QAction * labelonoffaction = new QAction( window, "labelonoff" );
+    labelonoffaction->setToggleAction( TRUE );
+
+    labelonoffaction->setText( "labels on/off" );
+    labelonoffaction->setAccel( Qt::ALT+Qt::Key_L );
+    labelonoffaction->setIconSet( (QPixmap) labelonoff_xpm );
+
+    QObject::connect( labelonoffaction, SIGNAL( toggled( bool ) ),
+                      window, SLOT( setUsesTextLabel( bool ) ) );
+
+    labelonoffaction->addTo( toolbar );
+
+    app.setMainWidget( window );
+    window->show();
+    return app.exec();
+}
+
+
+ +

See also QAction Examples. + + +


+ +
Copyright © 2007 +TrolltechTrademarks +
Qt 3.3.8
+
+ -- cgit v1.2.3