source: trunk/examples/action/toggleaction/toggleaction.cpp@ 10

Last change on this file since 10 was 2, checked in by dmik, 20 years ago

Imported xplatform parts of the official release 3.3.1 from Trolltech

  • Property svn:keywords set to Id
File size: 906 bytes
Line 
1#include <qapplication.h>
2#include <qmainwindow.h>
3#include <qtoolbar.h>
4#include <qaction.h>
5
6#include "labelonoff.xpm"
7
8int main( int argc, char **argv )
9{
10 QApplication app( argc, argv );
11 QMainWindow * window = new QMainWindow;
12 window->setCaption("Qt Example - Toggleaction");
13 QToolBar * toolbar = new QToolBar( window );
14
15 QAction * labelonoffaction = new QAction( window, "labelonoff", TRUE );
16
17 labelonoffaction->setText( "labels on/off" );
18 labelonoffaction->setAccel( Qt::ALT+Qt::Key_L );
19 labelonoffaction->setIconSet( (QPixmap) labelonoff_xpm );
20
21 QObject::connect( labelonoffaction, SIGNAL( toggled( bool ) ),
22 window, SLOT( setUsesTextLabel( bool ) ) );
23
24 labelonoffaction->addTo( toolbar );
25
26 app.setMainWidget( window );
27 window->show();
28 return app.exec();
29}
30
Note: See TracBrowser for help on using the repository browser.