diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2012-01-26 23:32:43 -0600 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2012-01-26 23:32:43 -0600 |
commit | ea318d1431c89e647598c510c4245c6571aa5f46 (patch) | |
tree | 996d29b80c30d453dda86d1a23162d441628f169 /doc/html/menu-example.html | |
parent | aaf89d4b48f69c9293feb187db26362e550b5561 (diff) | |
download | tqt3-ea318d1431c89e647598c510c4245c6571aa5f46.tar.gz tqt3-ea318d1431c89e647598c510c4245c6571aa5f46.zip |
Update to latest tqt3 automated conversion
Diffstat (limited to 'doc/html/menu-example.html')
-rw-r--r-- | doc/html/menu-example.html | 280 |
1 files changed, 140 insertions, 140 deletions
diff --git a/doc/html/menu-example.html b/doc/html/menu-example.html index d734a8531..b611166cd 100644 --- a/doc/html/menu-example.html +++ b/doc/html/menu-example.html @@ -51,16 +51,16 @@ context menu. #ifndef MENU_H #define MENU_H -#include <<a href="qwidget-h.html">qwidget.h</a>> -#include <<a href="qmenubar-h.html">qmenubar.h</a>> -#include <<a href="qlabel-h.html">qlabel.h</a>> +#include <<a href="qwidget-h.html">ntqwidget.h</a>> +#include <<a href="qmenubar-h.html">ntqmenubar.h</a>> +#include <<a href="qlabel-h.html">ntqlabel.h</a>> -class MenuExample : public <a href="qwidget.html">TQWidget</a> +class MenuExample : public <a href="ntqwidget.html">TQWidget</a> { <a href="metaobjects.html#Q_OBJECT">Q_OBJECT</a> public: - MenuExample( <a href="qwidget.html">TQWidget</a> *parent=0, const char *name=0 ); + MenuExample( <a href="ntqwidget.html">TQWidget</a> *parent=0, const char *name=0 ); public slots: void open(); @@ -83,14 +83,14 @@ protected: void resizeEvent( <a href="qresizeevent.html">TQResizeEvent</a> * ); signals: - void explain( const <a href="qstring.html">TQString</a>& ); + void explain( const <a href="ntqstring.html">TQString</a>& ); private: void contextMenuEvent ( <a href="qcontextmenuevent.html">TQContextMenuEvent</a> * ); - <a href="qmenubar.html">TQMenuBar</a> *menu; - <a href="qlabel.html">TQLabel</a> *label; + <a href="ntqmenubar.html">TQMenuBar</a> *menu; + <a href="ntqlabel.html">TQLabel</a> *label; bool isBold; bool isUnderline; int boldID, underlineID; @@ -113,12 +113,12 @@ private: *****************************************************************************/ #include "menu.h" -#include <<a href="qcursor-h.html">qcursor.h</a>> -#include <<a href="qpopupmenu-h.html">qpopupmenu.h</a>> -#include <<a href="qapplication-h.html">qapplication.h</a>> -#include <<a href="qmessagebox-h.html">qmessagebox.h</a>> -#include <<a href="qpixmap-h.html">qpixmap.h</a>> -#include <<a href="qpainter-h.html">qpainter.h</a>> +#include <<a href="qcursor-h.html">ntqcursor.h</a>> +#include <<a href="qpopupmenu-h.html">ntqpopupmenu.h</a>> +#include <<a href="qapplication-h.html">ntqapplication.h</a>> +#include <<a href="qmessagebox-h.html">ntqmessagebox.h</a>> +#include <<a href="qpixmap-h.html">ntqpixmap.h</a>> +#include <<a href="qpainter-h.html">ntqpainter.h</a>> /* XPM */ static const char * p1_xpm[] = { @@ -198,140 +198,140 @@ static const char * p3_xpm[] = { class MyMenuItem : public <a href="qcustommenuitem.html">TQCustomMenuItem</a> { public: - MyMenuItem( const <a href="qstring.html">TQString</a>& s, const <a href="qfont.html">TQFont</a>& f ) + MyMenuItem( const <a href="ntqstring.html">TQString</a>& s, const <a href="ntqfont.html">TQFont</a>& f ) : string( s ), font( f ){}; ~MyMenuItem(){} - void paint( <a href="qpainter.html">TQPainter</a>* p, const TQColorGroup& /*cg*/, bool /*act*/, bool /*enabled*/, int x, int y, int w, int h ) + void paint( <a href="ntqpainter.html">TQPainter</a>* p, const TQColorGroup& /*cg*/, bool /*act*/, bool /*enabled*/, int x, int y, int w, int h ) { - p-><a href="qpainter.html#setFont">setFont</a> ( font ); - p-><a href="qpainter.html#drawText">drawText</a>( x, y, w, h, AlignLeft | AlignVCenter | DontClip | ShowPrefix, string ); + p-><a href="ntqpainter.html#setFont">setFont</a> ( font ); + p-><a href="ntqpainter.html#drawText">drawText</a>( x, y, w, h, AlignLeft | AlignVCenter | DontClip | ShowPrefix, string ); } - <a href="qsize.html">TQSize</a> sizeHint() + <a href="ntqsize.html">TQSize</a> sizeHint() { return TQFontMetrics( font ).size( AlignLeft | AlignVCenter | ShowPrefix | DontClip, string ); } private: - <a href="qstring.html">TQString</a> string; - <a href="qfont.html">TQFont</a> font; + <a href="ntqstring.html">TQString</a> string; + <a href="ntqfont.html">TQFont</a> font; }; -<a name="f501"></a>MenuExample::MenuExample( <a href="qwidget.html">TQWidget</a> *parent, const char *name ) - : <a href="qwidget.html">TQWidget</a>( parent, name ) +<a name="f501"></a>MenuExample::MenuExample( <a href="ntqwidget.html">TQWidget</a> *parent, const char *name ) + : <a href="ntqwidget.html">TQWidget</a>( parent, name ) { - <a href="qpixmap.html">TQPixmap</a> p1( p1_xpm ); - <a href="qpixmap.html">TQPixmap</a> p2( p2_xpm ); - <a href="qpixmap.html">TQPixmap</a> p3( p3_xpm ); - <a href="qpopupmenu.html">TQPopupMenu</a> *print = new <a href="qpopupmenu.html">TQPopupMenu</a>( this ); - <a href="qapplication.html#Q_CHECK_PTR">Q_CHECK_PTR</a>( print ); -<a name="x1879"></a> print-><a href="qpopupmenu.html#insertTearOffHandle">insertTearOffHandle</a>(); -<a name="x1869"></a> print-><a href="qmenudata.html#insertItem">insertItem</a>( "&Print to printer", this, SLOT(printer()) ); - print-><a href="qmenudata.html#insertItem">insertItem</a>( "Print to &file", this, SLOT(file()) ); - print-><a href="qmenudata.html#insertItem">insertItem</a>( "Print to fa&x", this, SLOT(fax()) ); -<a name="x1870"></a> print-><a href="qmenudata.html#insertSeparator">insertSeparator</a>(); - print-><a href="qmenudata.html#insertItem">insertItem</a>( "Printer &Setup", this, SLOT(printerSetup()) ); - - <a href="qpopupmenu.html">TQPopupMenu</a> *file = new <a href="qpopupmenu.html">TQPopupMenu</a>( this ); - <a href="qapplication.html#Q_CHECK_PTR">Q_CHECK_PTR</a>( file ); - file-><a href="qmenudata.html#insertItem">insertItem</a>( p1, "&Open", this, SLOT(open()), CTRL+Key_O ); - file-><a href="qmenudata.html#insertItem">insertItem</a>( p2, "&New", this, SLOT(news()), CTRL+Key_N ); - file-><a href="qmenudata.html#insertItem">insertItem</a>( p3, "&Save", this, SLOT(save()), CTRL+Key_S ); - file-><a href="qmenudata.html#insertItem">insertItem</a>( "&Close", this, SLOT(closeDoc()), CTRL+Key_W ); - file-><a href="qmenudata.html#insertSeparator">insertSeparator</a>(); - file-><a href="qmenudata.html#insertItem">insertItem</a>( "&Print", print, CTRL+Key_P ); - file-><a href="qmenudata.html#insertSeparator">insertSeparator</a>(); - file-><a href="qmenudata.html#insertItem">insertItem</a>( "E&xit", qApp, SLOT(<a href="qapplication.html#quit">quit</a>()), CTRL+Key_Q ); - - <a href="qpopupmenu.html">TQPopupMenu</a> *edit = new <a href="qpopupmenu.html">TQPopupMenu</a>( this ); - <a href="qapplication.html#Q_CHECK_PTR">Q_CHECK_PTR</a>( edit ); - int undoID = edit-><a href="qmenudata.html#insertItem">insertItem</a>( "&Undo", this, SLOT(undo()) ); - int redoID = edit-><a href="qmenudata.html#insertItem">insertItem</a>( "&Redo", this, SLOT(redo()) ); -<a name="x1873"></a> edit-><a href="qmenudata.html#setItemEnabled">setItemEnabled</a>( undoID, FALSE ); - edit-><a href="qmenudata.html#setItemEnabled">setItemEnabled</a>( redoID, FALSE ); - - <a href="qpopupmenu.html">TQPopupMenu</a>* options = new <a href="qpopupmenu.html">TQPopupMenu</a>( this ); - <a href="qapplication.html#Q_CHECK_PTR">Q_CHECK_PTR</a>( options ); - options-><a href="qpopupmenu.html#insertTearOffHandle">insertTearOffHandle</a>(); - options-><a href="qwidget.html#setCaption">setCaption</a>("Options"); - options-><a href="qmenudata.html#insertItem">insertItem</a>( "&Normal Font", this, SLOT(normal()) ); - options-><a href="qmenudata.html#insertSeparator">insertSeparator</a>(); - -<a name="x1883"></a> options-><a href="qwidget.html#polish">polish</a>(); // adjust system settings -<a name="x1882"></a> <a href="qfont.html">TQFont</a> f = options-><a href="qwidget.html#font">font</a>(); -<a name="x1860"></a> f.<a href="qfont.html#setBold">setBold</a>( TRUE ); - boldID = options-><a href="qmenudata.html#insertItem">insertItem</a>( new MyMenuItem( "Bold", f ) ); -<a name="x1871"></a> options-><a href="qmenudata.html#setAccel">setAccel</a>( CTRL+Key_B, boldID ); -<a name="x1868"></a> options-><a href="qmenudata.html#connectItem">connectItem</a>( boldID, this, SLOT(bold()) ); - f = <a href="qwidget.html#font">font</a>(); -<a name="x1861"></a> f.<a href="qfont.html#setUnderline">setUnderline</a>( TRUE ); - underlineID = options-><a href="qmenudata.html#insertItem">insertItem</a>( new MyMenuItem( "Underline", f ) ); - options-><a href="qmenudata.html#setAccel">setAccel</a>( CTRL+Key_U, underlineID ); - options-><a href="qmenudata.html#connectItem">connectItem</a>( underlineID, this, SLOT(underline()) ); + <a href="ntqpixmap.html">TQPixmap</a> p1( p1_xpm ); + <a href="ntqpixmap.html">TQPixmap</a> p2( p2_xpm ); + <a href="ntqpixmap.html">TQPixmap</a> p3( p3_xpm ); + <a href="ntqpopupmenu.html">TQPopupMenu</a> *print = new <a href="ntqpopupmenu.html">TQPopupMenu</a>( this ); + <a href="ntqapplication.html#Q_CHECK_PTR">Q_CHECK_PTR</a>( print ); +<a name="x1879"></a> print-><a href="ntqpopupmenu.html#insertTearOffHandle">insertTearOffHandle</a>(); +<a name="x1869"></a> print-><a href="ntqmenudata.html#insertItem">insertItem</a>( "&Print to printer", this, SLOT(printer()) ); + print-><a href="ntqmenudata.html#insertItem">insertItem</a>( "Print to &file", this, SLOT(file()) ); + print-><a href="ntqmenudata.html#insertItem">insertItem</a>( "Print to fa&x", this, SLOT(fax()) ); +<a name="x1870"></a> print-><a href="ntqmenudata.html#insertSeparator">insertSeparator</a>(); + print-><a href="ntqmenudata.html#insertItem">insertItem</a>( "Printer &Setup", this, SLOT(printerSetup()) ); + + <a href="ntqpopupmenu.html">TQPopupMenu</a> *file = new <a href="ntqpopupmenu.html">TQPopupMenu</a>( this ); + <a href="ntqapplication.html#Q_CHECK_PTR">Q_CHECK_PTR</a>( file ); + file-><a href="ntqmenudata.html#insertItem">insertItem</a>( p1, "&Open", this, SLOT(open()), CTRL+Key_O ); + file-><a href="ntqmenudata.html#insertItem">insertItem</a>( p2, "&New", this, SLOT(news()), CTRL+Key_N ); + file-><a href="ntqmenudata.html#insertItem">insertItem</a>( p3, "&Save", this, SLOT(save()), CTRL+Key_S ); + file-><a href="ntqmenudata.html#insertItem">insertItem</a>( "&Close", this, SLOT(closeDoc()), CTRL+Key_W ); + file-><a href="ntqmenudata.html#insertSeparator">insertSeparator</a>(); + file-><a href="ntqmenudata.html#insertItem">insertItem</a>( "&Print", print, CTRL+Key_P ); + file-><a href="ntqmenudata.html#insertSeparator">insertSeparator</a>(); + file-><a href="ntqmenudata.html#insertItem">insertItem</a>( "E&xit", qApp, SLOT(<a href="ntqapplication.html#quit">quit</a>()), CTRL+Key_Q ); + + <a href="ntqpopupmenu.html">TQPopupMenu</a> *edit = new <a href="ntqpopupmenu.html">TQPopupMenu</a>( this ); + <a href="ntqapplication.html#Q_CHECK_PTR">Q_CHECK_PTR</a>( edit ); + int undoID = edit-><a href="ntqmenudata.html#insertItem">insertItem</a>( "&Undo", this, SLOT(undo()) ); + int redoID = edit-><a href="ntqmenudata.html#insertItem">insertItem</a>( "&Redo", this, SLOT(redo()) ); +<a name="x1873"></a> edit-><a href="ntqmenudata.html#setItemEnabled">setItemEnabled</a>( undoID, FALSE ); + edit-><a href="ntqmenudata.html#setItemEnabled">setItemEnabled</a>( redoID, FALSE ); + + <a href="ntqpopupmenu.html">TQPopupMenu</a>* options = new <a href="ntqpopupmenu.html">TQPopupMenu</a>( this ); + <a href="ntqapplication.html#Q_CHECK_PTR">Q_CHECK_PTR</a>( options ); + options-><a href="ntqpopupmenu.html#insertTearOffHandle">insertTearOffHandle</a>(); + options-><a href="ntqwidget.html#setCaption">setCaption</a>("Options"); + options-><a href="ntqmenudata.html#insertItem">insertItem</a>( "&Normal Font", this, SLOT(normal()) ); + options-><a href="ntqmenudata.html#insertSeparator">insertSeparator</a>(); + +<a name="x1883"></a> options-><a href="ntqwidget.html#polish">polish</a>(); // adjust system settings +<a name="x1882"></a> <a href="ntqfont.html">TQFont</a> f = options-><a href="ntqwidget.html#font">font</a>(); +<a name="x1860"></a> f.<a href="ntqfont.html#setBold">setBold</a>( TRUE ); + boldID = options-><a href="ntqmenudata.html#insertItem">insertItem</a>( new MyMenuItem( "Bold", f ) ); +<a name="x1871"></a> options-><a href="ntqmenudata.html#setAccel">setAccel</a>( CTRL+Key_B, boldID ); +<a name="x1868"></a> options-><a href="ntqmenudata.html#connectItem">connectItem</a>( boldID, this, SLOT(bold()) ); + f = <a href="ntqwidget.html#font">font</a>(); +<a name="x1861"></a> f.<a href="ntqfont.html#setUnderline">setUnderline</a>( TRUE ); + underlineID = options-><a href="ntqmenudata.html#insertItem">insertItem</a>( new MyMenuItem( "Underline", f ) ); + options-><a href="ntqmenudata.html#setAccel">setAccel</a>( CTRL+Key_U, underlineID ); + options-><a href="ntqmenudata.html#connectItem">connectItem</a>( underlineID, this, SLOT(underline()) ); isBold = FALSE; isUnderline = FALSE; -<a name="x1880"></a> options-><a href="qpopupmenu.html#setCheckable">setCheckable</a>( TRUE ); +<a name="x1880"></a> options-><a href="ntqpopupmenu.html#setCheckable">setCheckable</a>( TRUE ); - <a href="qpopupmenu.html">TQPopupMenu</a> *help = new <a href="qpopupmenu.html">TQPopupMenu</a>( this ); - <a href="qapplication.html#Q_CHECK_PTR">Q_CHECK_PTR</a>( help ); - help-><a href="qmenudata.html#insertItem">insertItem</a>( "&About", this, SLOT(about()), CTRL+Key_H ); - help-><a href="qmenudata.html#insertItem">insertItem</a>( "About &TQt", this, SLOT(aboutTQt()) ); + <a href="ntqpopupmenu.html">TQPopupMenu</a> *help = new <a href="ntqpopupmenu.html">TQPopupMenu</a>( this ); + <a href="ntqapplication.html#Q_CHECK_PTR">Q_CHECK_PTR</a>( help ); + help-><a href="ntqmenudata.html#insertItem">insertItem</a>( "&About", this, SLOT(about()), CTRL+Key_H ); + help-><a href="ntqmenudata.html#insertItem">insertItem</a>( "About &TQt", this, SLOT(aboutTQt()) ); // If we used a TQMainWindow we could use its built-in menuBar(). - menu = new <a href="qmenubar.html">TQMenuBar</a>( this ); - <a href="qapplication.html#Q_CHECK_PTR">Q_CHECK_PTR</a>( menu ); - menu-><a href="qmenudata.html#insertItem">insertItem</a>( "&File", file ); - menu-><a href="qmenudata.html#insertItem">insertItem</a>( "&Edit", edit ); - menu-><a href="qmenudata.html#insertItem">insertItem</a>( "&Options", options ); - menu-><a href="qmenudata.html#insertSeparator">insertSeparator</a>(); - menu-><a href="qmenudata.html#insertItem">insertItem</a>( "&Help", help ); -<a name="x1867"></a> menu-><a href="qmenubar.html#setSeparator">setSeparator</a>( TQMenuBar::InWindowsStyle ); - - - <a href="qlabel.html">TQLabel</a> *msg = new <a href="qlabel.html">TQLabel</a>( this ); - <a href="qapplication.html#Q_CHECK_PTR">Q_CHECK_PTR</a>( msg ); - msg-><a href="qlabel.html#setText">setText</a>( "A context menu is available.\n" + menu = new <a href="ntqmenubar.html">TQMenuBar</a>( this ); + <a href="ntqapplication.html#Q_CHECK_PTR">Q_CHECK_PTR</a>( menu ); + menu-><a href="ntqmenudata.html#insertItem">insertItem</a>( "&File", file ); + menu-><a href="ntqmenudata.html#insertItem">insertItem</a>( "&Edit", edit ); + menu-><a href="ntqmenudata.html#insertItem">insertItem</a>( "&Options", options ); + menu-><a href="ntqmenudata.html#insertSeparator">insertSeparator</a>(); + menu-><a href="ntqmenudata.html#insertItem">insertItem</a>( "&Help", help ); +<a name="x1867"></a> menu-><a href="ntqmenubar.html#setSeparator">setSeparator</a>( TQMenuBar::InWindowsStyle ); + + + <a href="ntqlabel.html">TQLabel</a> *msg = new <a href="ntqlabel.html">TQLabel</a>( this ); + <a href="ntqapplication.html#Q_CHECK_PTR">Q_CHECK_PTR</a>( msg ); + msg-><a href="ntqlabel.html#setText">setText</a>( "A context menu is available.\n" "Invoke it by right-clicking or by" " pressing the 'context' button." ); -<a name="x1886"></a> msg-><a href="qwidget.html#setGeometry">setGeometry</a>( 0, height() - 60, width(), 60 ); -<a name="x1864"></a> msg-><a href="qlabel.html#setAlignment">setAlignment</a>( AlignCenter ); +<a name="x1886"></a> msg-><a href="ntqwidget.html#setGeometry">setGeometry</a>( 0, height() - 60, width(), 60 ); +<a name="x1864"></a> msg-><a href="ntqlabel.html#setAlignment">setAlignment</a>( AlignCenter ); - label = new <a href="qlabel.html">TQLabel</a>( this ); - <a href="qapplication.html#Q_CHECK_PTR">Q_CHECK_PTR</a>( label ); - label-><a href="qwidget.html#setGeometry">setGeometry</a>( 20, rect().center().y()-20, width()-40, 40 ); - label-><a href="qframe.html#setFrameStyle">setFrameStyle</a>( TQFrame::Box | TQFrame::Raised ); -<a name="x1863"></a> label-><a href="qframe.html#setLineWidth">setLineWidth</a>( 1 ); - label-><a href="qlabel.html#setAlignment">setAlignment</a>( AlignCenter ); + label = new <a href="ntqlabel.html">TQLabel</a>( this ); + <a href="ntqapplication.html#Q_CHECK_PTR">Q_CHECK_PTR</a>( label ); + label-><a href="ntqwidget.html#setGeometry">setGeometry</a>( 20, rect().center().y()-20, width()-40, 40 ); + label-><a href="ntqframe.html#setFrameStyle">setFrameStyle</a>( TQFrame::Box | TQFrame::Raised ); +<a name="x1863"></a> label-><a href="ntqframe.html#setLineWidth">setLineWidth</a>( 1 ); + label-><a href="ntqlabel.html#setAlignment">setAlignment</a>( AlignCenter ); - <a href="qobject.html#connect">connect</a>( this, SIGNAL(explain(const <a href="qstring.html">TQString</a>&)), - label, SLOT(<a href="qlabel.html#setText">setText</a>(const <a href="qstring.html">TQString</a>&)) ); + <a href="ntqobject.html#connect">connect</a>( this, SIGNAL(explain(const <a href="ntqstring.html">TQString</a>&)), + label, SLOT(<a href="ntqlabel.html#setText">setText</a>(const <a href="ntqstring.html">TQString</a>&)) ); - <a href="qwidget.html#setMinimumSize">setMinimumSize</a>( 100, 80 ); - <a href="qwidget.html#setFocusPolicy">setFocusPolicy</a>( TQWidget::ClickFocus ); + <a href="ntqwidget.html#setMinimumSize">setMinimumSize</a>( 100, 80 ); + <a href="ntqwidget.html#setFocusPolicy">setFocusPolicy</a>( TQWidget::ClickFocus ); } -<a name="x1881"></a>void MenuExample::<a href="qwidget.html#contextMenuEvent">contextMenuEvent</a>( <a href="qcontextmenuevent.html">TQContextMenuEvent</a> * ) +<a name="x1881"></a>void MenuExample::<a href="ntqwidget.html#contextMenuEvent">contextMenuEvent</a>( <a href="qcontextmenuevent.html">TQContextMenuEvent</a> * ) { - <a href="qpopupmenu.html">TQPopupMenu</a>* contextMenu = new <a href="qpopupmenu.html">TQPopupMenu</a>( this ); - <a href="qapplication.html#Q_CHECK_PTR">Q_CHECK_PTR</a>( contextMenu ); - <a href="qlabel.html">TQLabel</a> *caption = new <a href="qlabel.html">TQLabel</a>( "<font color=darkblue><u><b>" + <a href="ntqpopupmenu.html">TQPopupMenu</a>* contextMenu = new <a href="ntqpopupmenu.html">TQPopupMenu</a>( this ); + <a href="ntqapplication.html#Q_CHECK_PTR">Q_CHECK_PTR</a>( contextMenu ); + <a href="ntqlabel.html">TQLabel</a> *caption = new <a href="ntqlabel.html">TQLabel</a>( "<font color=darkblue><u><b>" "Context Menu</b></u></font>", this ); - caption-><a href="qlabel.html#setAlignment">setAlignment</a>( TQt::AlignCenter ); - contextMenu-><a href="qmenudata.html#insertItem">insertItem</a>( caption ); - contextMenu-><a href="qmenudata.html#insertItem">insertItem</a>( "&New", this, SLOT(news()), CTRL+Key_N ); - contextMenu-><a href="qmenudata.html#insertItem">insertItem</a>( "&Open...", this, SLOT(open()), CTRL+Key_O ); - contextMenu-><a href="qmenudata.html#insertItem">insertItem</a>( "&Save", this, SLOT(save()), CTRL+Key_S ); - <a href="qpopupmenu.html">TQPopupMenu</a> *submenu = new <a href="qpopupmenu.html">TQPopupMenu</a>( this ); - <a href="qapplication.html#Q_CHECK_PTR">Q_CHECK_PTR</a>( submenu ); - submenu-><a href="qmenudata.html#insertItem">insertItem</a>( "&Print to printer", this, SLOT(printer()) ); - submenu-><a href="qmenudata.html#insertItem">insertItem</a>( "Print to &file", this, SLOT(file()) ); - submenu-><a href="qmenudata.html#insertItem">insertItem</a>( "Print to fa&x", this, SLOT(fax()) ); - contextMenu-><a href="qmenudata.html#insertItem">insertItem</a>( "&Print", submenu ); -<a name="x1878"></a><a name="x1859"></a> contextMenu-><a href="qpopupmenu.html#exec">exec</a>( TQCursor::<a href="qcursor.html#pos">pos</a>() ); + caption-><a href="ntqlabel.html#setAlignment">setAlignment</a>( TQt::AlignCenter ); + contextMenu-><a href="ntqmenudata.html#insertItem">insertItem</a>( caption ); + contextMenu-><a href="ntqmenudata.html#insertItem">insertItem</a>( "&New", this, SLOT(news()), CTRL+Key_N ); + contextMenu-><a href="ntqmenudata.html#insertItem">insertItem</a>( "&Open...", this, SLOT(open()), CTRL+Key_O ); + contextMenu-><a href="ntqmenudata.html#insertItem">insertItem</a>( "&Save", this, SLOT(save()), CTRL+Key_S ); + <a href="ntqpopupmenu.html">TQPopupMenu</a> *submenu = new <a href="ntqpopupmenu.html">TQPopupMenu</a>( this ); + <a href="ntqapplication.html#Q_CHECK_PTR">Q_CHECK_PTR</a>( submenu ); + submenu-><a href="ntqmenudata.html#insertItem">insertItem</a>( "&Print to printer", this, SLOT(printer()) ); + submenu-><a href="ntqmenudata.html#insertItem">insertItem</a>( "Print to &file", this, SLOT(file()) ); + submenu-><a href="ntqmenudata.html#insertItem">insertItem</a>( "Print to fa&x", this, SLOT(fax()) ); + contextMenu-><a href="ntqmenudata.html#insertItem">insertItem</a>( "&Print", submenu ); +<a name="x1878"></a><a name="x1859"></a> contextMenu-><a href="ntqpopupmenu.html#exec">exec</a>( TQCursor::<a href="ntqcursor.html#pos">pos</a>() ); delete contextMenu; } @@ -375,10 +375,10 @@ void <a name="f508"></a>MenuExample::normal() { isBold = FALSE; isUnderline = FALSE; - <a href="qfont.html">TQFont</a> font; -<a name="x1865"></a> label-><a href="qlabel.html#setFont">setFont</a>( font ); -<a name="x1872"></a> menu-><a href="qmenudata.html#setItemChecked">setItemChecked</a>( boldID, isBold ); - menu-><a href="qmenudata.html#setItemChecked">setItemChecked</a>( underlineID, isUnderline ); + <a href="ntqfont.html">TQFont</a> font; +<a name="x1865"></a> label-><a href="ntqlabel.html#setFont">setFont</a>( font ); +<a name="x1872"></a> menu-><a href="ntqmenudata.html#setItemChecked">setItemChecked</a>( boldID, isBold ); + menu-><a href="ntqmenudata.html#setItemChecked">setItemChecked</a>( underlineID, isUnderline ); emit explain( "Options/Normal selected" ); } @@ -386,11 +386,11 @@ void <a name="f508"></a>MenuExample::normal() void <a name="f509"></a>MenuExample::bold() { isBold = !isBold; - <a href="qfont.html">TQFont</a> font; - font.<a href="qfont.html#setBold">setBold</a>( isBold ); - font.<a href="qfont.html#setUnderline">setUnderline</a>( isUnderline ); - label-><a href="qlabel.html#setFont">setFont</a>( font ); - menu-><a href="qmenudata.html#setItemChecked">setItemChecked</a>( boldID, isBold ); + <a href="ntqfont.html">TQFont</a> font; + font.<a href="ntqfont.html#setBold">setBold</a>( isBold ); + font.<a href="ntqfont.html#setUnderline">setUnderline</a>( isUnderline ); + label-><a href="ntqlabel.html#setFont">setFont</a>( font ); + menu-><a href="ntqmenudata.html#setItemChecked">setItemChecked</a>( boldID, isBold ); emit explain( "Options/Bold selected" ); } @@ -398,18 +398,18 @@ void <a name="f509"></a>MenuExample::bold() void <a name="f510"></a>MenuExample::underline() { isUnderline = !isUnderline; - <a href="qfont.html">TQFont</a> font; - font.<a href="qfont.html#setBold">setBold</a>( isBold ); - font.<a href="qfont.html#setUnderline">setUnderline</a>( isUnderline ); - label-><a href="qlabel.html#setFont">setFont</a>( font ); - menu-><a href="qmenudata.html#setItemChecked">setItemChecked</a>( underlineID, isUnderline ); + <a href="ntqfont.html">TQFont</a> font; + font.<a href="ntqfont.html#setBold">setBold</a>( isBold ); + font.<a href="ntqfont.html#setUnderline">setUnderline</a>( isUnderline ); + label-><a href="ntqlabel.html#setFont">setFont</a>( font ); + menu-><a href="ntqmenudata.html#setItemChecked">setItemChecked</a>( underlineID, isUnderline ); emit explain( "Options/Underline selected" ); } void <a name="f511"></a>MenuExample::about() { -<a name="x1874"></a> TQMessageBox::<a href="qmessagebox.html#about">about</a>( this, "TQt Menu Example", +<a name="x1874"></a> TQMessageBox::<a href="ntqmessagebox.html#about">about</a>( this, "TQt Menu Example", "This example demonstrates simple use of TQt menus.\n" "You can cut and paste lines from it to your own\n" "programs." ); @@ -418,7 +418,7 @@ void <a name="f511"></a>MenuExample::about() void <a name="f512"></a>MenuExample::aboutTQt() { -<a name="x1875"></a> TQMessageBox::<a href="qmessagebox.html#aboutTQt">aboutTQt</a>( this, "TQt Menu Example" ); +<a name="x1875"></a> TQMessageBox::<a href="ntqmessagebox.html#aboutTQt">aboutTQt</a>( this, "TQt Menu Example" ); } @@ -443,20 +443,20 @@ void <a name="f516"></a>MenuExample::printerSetup() } -<a name="x1884"></a>void MenuExample::<a href="qwidget.html#resizeEvent">resizeEvent</a>( <a href="qresizeevent.html">TQResizeEvent</a> * ) +<a name="x1884"></a>void MenuExample::<a href="ntqwidget.html#resizeEvent">resizeEvent</a>( <a href="qresizeevent.html">TQResizeEvent</a> * ) { - label-><a href="qwidget.html#setGeometry">setGeometry</a>( 20, rect().center().y()-20, width()-40, 40 ); + label-><a href="ntqwidget.html#setGeometry">setGeometry</a>( 20, rect().center().y()-20, width()-40, 40 ); } int main( int argc, char ** argv ) { - <a href="qapplication.html">TQApplication</a> a( argc, argv ); + <a href="ntqapplication.html">TQApplication</a> a( argc, argv ); MenuExample m; - m.<a href="qwidget.html#setCaption">setCaption</a>("TQt Examples - Menus"); - a.<a href="qapplication.html#setMainWidget">setMainWidget</a>( &m ); - m.<a href="qwidget.html#show">show</a>(); - return a.<a href="qapplication.html#exec">exec</a>(); + m.<a href="ntqwidget.html#setCaption">setCaption</a>("TQt Examples - Menus"); + a.<a href="ntqapplication.html#setMainWidget">setMainWidget</a>( &m ); + m.<a href="ntqwidget.html#show">show</a>(); + return a.<a href="ntqapplication.html#exec">exec</a>(); } </pre> |