diff options
Diffstat (limited to 'doc/html/popup-example.html')
-rw-r--r-- | doc/html/popup-example.html | 130 |
1 files changed, 65 insertions, 65 deletions
diff --git a/doc/html/popup-example.html b/doc/html/popup-example.html index 4ae586c64..acff96e24 100644 --- a/doc/html/popup-example.html +++ b/doc/html/popup-example.html @@ -53,33 +53,33 @@ pop up. #ifndef POPUP_H #define POPUP_H -#include <<a href="qlabel-h.html">qlabel.h</a>> -#include <<a href="qpushbutton-h.html">qpushbutton.h</a>> -#include <<a href="qlineedit-h.html">qlineedit.h</a>> +#include <<a href="qlabel-h.html">ntqlabel.h</a>> +#include <<a href="qpushbutton-h.html">ntqpushbutton.h</a>> +#include <<a href="qlineedit-h.html">ntqlineedit.h</a>> -class FancyPopup : public <a href="qlabel.html">TQLabel</a> +class FancyPopup : public <a href="ntqlabel.html">TQLabel</a> { <a href="metaobjects.html#Q_OBJECT">Q_OBJECT</a> public: - FancyPopup( <a href="qwidget.html">TQWidget</a>* parent = 0, const char* name=0); + FancyPopup( <a href="ntqwidget.html">TQWidget</a>* parent = 0, const char* name=0); - void popup( <a href="qwidget.html">TQWidget</a>* parent = 0); + void popup( <a href="ntqwidget.html">TQWidget</a>* parent = 0); protected: virtual void mouseMoveEvent( <a href="qmouseevent.html">TQMouseEvent</a> * ); virtual void mouseReleaseEvent( <a href="qmouseevent.html">TQMouseEvent</a> * ); virtual void closeEvent( <a href="qcloseevent.html">TQCloseEvent</a> * ); private: - <a href="qwidget.html">TQWidget</a>* popupParent; + <a href="ntqwidget.html">TQWidget</a>* popupParent; int moves; }; - class Frame : public <a href="qframe.html">TQFrame</a> + class Frame : public <a href="ntqframe.html">TQFrame</a> { Q_OBJECT public: - Frame( <a href="qwidget.html">TQWidget</a> *parent=0, const char* name=0); + Frame( <a href="ntqwidget.html">TQWidget</a> *parent=0, const char* name=0); protected: @@ -88,10 +88,10 @@ private: void button2Pressed(); private: - <a href="qpushbutton.html">TQPushButton</a> *button1; - <a href="qpushbutton.html">TQPushButton</a> *button2; + <a href="ntqpushbutton.html">TQPushButton</a> *button1; + <a href="ntqpushbutton.html">TQPushButton</a> *button2; - <a href="qframe.html">TQFrame</a>* popup1; + <a href="ntqframe.html">TQFrame</a>* popup1; FancyPopup* popup2; }; @@ -111,33 +111,33 @@ private: *****************************************************************************/ #include "popup.h" -#include <<a href="qapplication-h.html">qapplication.h</a>> -#include <<a href="qlayout-h.html">qlayout.h</a>> - -<a name="f468"></a>FancyPopup::FancyPopup( <a href="qwidget.html">TQWidget</a>* parent, const char* name ): - <a href="qlabel.html">TQLabel</a>( parent, name, WType_Popup ){ - <a href="qframe.html#setFrameStyle">setFrameStyle</a>( WinPanel|Raised ); - <a href="qlabel.html#setAlignment">setAlignment</a>( AlignCenter ); - <a href="qwidget.html#resize">resize</a>(150,100); +#include <<a href="qapplication-h.html">ntqapplication.h</a>> +#include <<a href="qlayout-h.html">ntqlayout.h</a>> + +<a name="f468"></a>FancyPopup::FancyPopup( <a href="ntqwidget.html">TQWidget</a>* parent, const char* name ): + <a href="ntqlabel.html">TQLabel</a>( parent, name, WType_Popup ){ + <a href="ntqframe.html#setFrameStyle">setFrameStyle</a>( WinPanel|Raised ); + <a href="ntqlabel.html#setAlignment">setAlignment</a>( AlignCenter ); + <a href="ntqwidget.html#resize">resize</a>(150,100); moves = 0; - <a href="qwidget.html#setMouseTracking">setMouseTracking</a>( TRUE ); + <a href="ntqwidget.html#setMouseTracking">setMouseTracking</a>( TRUE ); } -<a name="x1620"></a>void FancyPopup::<a href="qwidget.html#mouseMoveEvent">mouseMoveEvent</a>( <a href="qmouseevent.html">TQMouseEvent</a> * e){ +<a name="x1620"></a>void FancyPopup::<a href="ntqwidget.html#mouseMoveEvent">mouseMoveEvent</a>( <a href="qmouseevent.html">TQMouseEvent</a> * e){ moves++; - <a href="qstring.html">TQString</a> s; -<a name="x1611"></a> s.<a href="qstring.html#sprintf">sprintf</a>("%d/%d", e-><a href="qmouseevent.html#pos">pos</a>().x(), e-><a href="qmouseevent.html#pos">pos</a>().y()); + <a href="ntqstring.html">TQString</a> s; +<a name="x1611"></a> s.<a href="ntqstring.html#sprintf">sprintf</a>("%d/%d", e-><a href="qmouseevent.html#pos">pos</a>().x(), e-><a href="qmouseevent.html#pos">pos</a>().y()); <a name="x1612"></a> if (e-><a href="qmouseevent.html#state">state</a>() & TQMouseEvent::LeftButton) s += " (down)"; - <a href="qlabel.html#setText">setText</a>(s); + <a href="ntqlabel.html#setText">setText</a>(s); } -<a name="x1621"></a>void FancyPopup::<a href="qwidget.html#mouseReleaseEvent">mouseReleaseEvent</a>( <a href="qmouseevent.html">TQMouseEvent</a> * e){ - if (<a href="qwidget.html#rect">rect</a>().contains( e-><a href="qmouseevent.html#pos">pos</a>() ) || moves > 5) - <a href="qwidget.html#close">close</a>(); +<a name="x1621"></a>void FancyPopup::<a href="ntqwidget.html#mouseReleaseEvent">mouseReleaseEvent</a>( <a href="qmouseevent.html">TQMouseEvent</a> * e){ + if (<a href="ntqwidget.html#rect">rect</a>().contains( e-><a href="qmouseevent.html#pos">pos</a>() ) || moves > 5) + <a href="ntqwidget.html#close">close</a>(); } -<a name="x1617"></a>void FancyPopup::<a href="qwidget.html#closeEvent">closeEvent</a>( <a href="qcloseevent.html">TQCloseEvent</a> *e ){ +<a name="x1617"></a>void FancyPopup::<a href="ntqwidget.html#closeEvent">closeEvent</a>( <a href="qcloseevent.html">TQCloseEvent</a> *e ){ <a name="x1607"></a> e-><a href="qcloseevent.html#accept">accept</a>(); moves = 0; if (!popupParent) @@ -149,15 +149,15 @@ private: // avoid the button remaining in pressed state we simply send a // faked mouse button release event to it. <a href="qmouseevent.html">TQMouseEvent</a> me( TQEvent::MouseButtonRelease, TQPoint(0,0), TQPoint(0,0), TQMouseEvent::LeftButton, TQMouseEvent::NoButton); -<a name="x1602"></a> TQApplication::<a href="qapplication.html#sendEvent">sendEvent</a>( popupParent, &me ); +<a name="x1602"></a> TQApplication::<a href="ntqapplication.html#sendEvent">sendEvent</a>( popupParent, &me ); } -void <a name="f469"></a>FancyPopup::popup( <a href="qwidget.html">TQWidget</a>* parent) { +void <a name="f469"></a>FancyPopup::popup( <a href="ntqwidget.html">TQWidget</a>* parent) { popupParent = parent; setText("Move the mouse!"); if (popupParent) - <a href="qwidget.html#move">move</a>( popupParent->mapToGlobal( popupParent->rect().bottomLeft() ) ); - <a href="qwidget.html#show">show</a>(); + <a href="ntqwidget.html#move">move</a>( popupParent->mapToGlobal( popupParent->rect().bottomLeft() ) ); + <a href="ntqwidget.html#show">show</a>(); } @@ -165,36 +165,36 @@ void <a name="f469"></a>FancyPopup::popup( <a href="qwidget.html">TQWidget</a>* -<a name="f470"></a>Frame::Frame(TQWidget* parent, const char* name): <a href="qframe.html">TQFrame</a>(parent, name){ - button1 = new <a href="qpushbutton.html">TQPushButton</a>("Simple Popup", this); - <a href="qobject.html#connect">connect</a> ( button1, SIGNAL( <a href="qbutton.html#clicked">clicked</a>() ), SLOT( button1Clicked() ) ); - button2 = new <a href="qpushbutton.html">TQPushButton</a>("Fancy Popup", this); -<a name="x1606"></a> <a href="qobject.html#connect">connect</a> ( button2, SIGNAL( <a href="qbutton.html#pressed">pressed</a>() ), SLOT( button2Pressed() ) ); +<a name="f470"></a>Frame::Frame(TQWidget* parent, const char* name): <a href="ntqframe.html">TQFrame</a>(parent, name){ + button1 = new <a href="ntqpushbutton.html">TQPushButton</a>("Simple Popup", this); + <a href="ntqobject.html#connect">connect</a> ( button1, SIGNAL( <a href="ntqbutton.html#clicked">clicked</a>() ), SLOT( button1Clicked() ) ); + button2 = new <a href="ntqpushbutton.html">TQPushButton</a>("Fancy Popup", this); +<a name="x1606"></a> <a href="ntqobject.html#connect">connect</a> ( button2, SIGNAL( <a href="ntqbutton.html#pressed">pressed</a>() ), SLOT( button2Pressed() ) ); <a href="qboxlayout.html">TQBoxLayout</a> * l = new <a href="qhboxlayout.html">TQHBoxLayout</a>( this ); -<a name="x1627"></a><a name="x1614"></a> button1-><a href="qwidget.html#setMaximumSize">setMaximumSize</a>(button1-><a href="qwidget.html#sizeHint">sizeHint</a>()); - button2-><a href="qwidget.html#setMaximumSize">setMaximumSize</a>(button2-><a href="qwidget.html#sizeHint">sizeHint</a>()); +<a name="x1627"></a><a name="x1614"></a> button1-><a href="ntqwidget.html#setMaximumSize">setMaximumSize</a>(button1-><a href="ntqwidget.html#sizeHint">sizeHint</a>()); + button2-><a href="ntqwidget.html#setMaximumSize">setMaximumSize</a>(button2-><a href="ntqwidget.html#sizeHint">sizeHint</a>()); l-><a href="qboxlayout.html#addWidget">addWidget</a>( button1 ); l-><a href="qboxlayout.html#addWidget">addWidget</a>( button2 ); -<a name="x1609"></a> l-><a href="qlayout.html#activate">activate</a>(); +<a name="x1609"></a> l-><a href="ntqlayout.html#activate">activate</a>(); -<a name="x1613"></a>// button1-><a href="qwidget.html#setGeometry">setGeometry</a>(20,20,100,30); -// button2-><a href="qwidget.html#setGeometry">setGeometry</a>(140,20,100,30); - <a href="qwidget.html#resize">resize</a>(270, 70); +<a name="x1613"></a>// button1-><a href="ntqwidget.html#setGeometry">setGeometry</a>(20,20,100,30); +// button2-><a href="ntqwidget.html#setGeometry">setGeometry</a>(140,20,100,30); + <a href="ntqwidget.html#resize">resize</a>(270, 70); //create a very simple popup: it is just composed with other //widget and will be shown after clicking on button1 - popup1 = new <a href="qframe.html">TQFrame</a>( this ,0, WType_Popup); - popup1-><a href="qframe.html#setFrameStyle">setFrameStyle</a>( WinPanel|Raised ); - popup1-><a href="qwidget.html#resize">resize</a>(150,100); - <a href="qlineedit.html">TQLineEdit</a> *tmpE = new <a href="qlineedit.html">TQLineEdit</a>( popup1 ); -<a name="x1619"></a><a name="x1610"></a> <a href="qobject.html#connect">connect</a>( tmpE, SIGNAL( <a href="qlineedit.html#returnPressed">returnPressed</a>() ), popup1, SLOT( <a href="qwidget.html#hide">hide</a>() ) ); -<a name="x1626"></a> tmpE-><a href="qwidget.html#setGeometry">setGeometry</a>(10,10, 130, 30); -<a name="x1625"></a> tmpE-><a href="qwidget.html#setFocus">setFocus</a>(); - <a href="qpushbutton.html">TQPushButton</a> *tmpB = new <a href="qpushbutton.html">TQPushButton</a>("Click me!", popup1); -<a name="x1616"></a> <a href="qobject.html#connect">connect</a>( tmpB, SIGNAL( <a href="qbutton.html#clicked">clicked</a>() ), popup1, SLOT( <a href="qwidget.html#close">close</a>() ) ); - tmpB-><a href="qwidget.html#setGeometry">setGeometry</a>(10, 50, 130, 30); + popup1 = new <a href="ntqframe.html">TQFrame</a>( this ,0, WType_Popup); + popup1-><a href="ntqframe.html#setFrameStyle">setFrameStyle</a>( WinPanel|Raised ); + popup1-><a href="ntqwidget.html#resize">resize</a>(150,100); + <a href="ntqlineedit.html">TQLineEdit</a> *tmpE = new <a href="ntqlineedit.html">TQLineEdit</a>( popup1 ); +<a name="x1619"></a><a name="x1610"></a> <a href="ntqobject.html#connect">connect</a>( tmpE, SIGNAL( <a href="ntqlineedit.html#returnPressed">returnPressed</a>() ), popup1, SLOT( <a href="ntqwidget.html#hide">hide</a>() ) ); +<a name="x1626"></a> tmpE-><a href="ntqwidget.html#setGeometry">setGeometry</a>(10,10, 130, 30); +<a name="x1625"></a> tmpE-><a href="ntqwidget.html#setFocus">setFocus</a>(); + <a href="ntqpushbutton.html">TQPushButton</a> *tmpB = new <a href="ntqpushbutton.html">TQPushButton</a>("Click me!", popup1); +<a name="x1616"></a> <a href="ntqobject.html#connect">connect</a>( tmpB, SIGNAL( <a href="ntqbutton.html#clicked">clicked</a>() ), popup1, SLOT( <a href="ntqwidget.html#close">close</a>() ) ); + tmpB-><a href="ntqwidget.html#setGeometry">setGeometry</a>(10, 50, 130, 30); // the fancier version uses its own class. It will be shown when // pressing button2, so they behavior is more like a modern menu @@ -206,16 +206,16 @@ void <a name="f469"></a>FancyPopup::popup( <a href="qwidget.html">TQWidget</a>* // it with any other widget. The next four lines (if not // commented out) will for instance add a line edit widget. -// tmpE = new <a href="qlineedit.html">TQLineEdit</a>( popup2 ); -// tmpE-><a href="qwidget.html#setFocus">setFocus</a>(); -// connect( tmpE, SIGNAL( <a href="qlineedit.html#returnPressed">returnPressed</a>() ), popup2, SLOT( <a href="qwidget.html#close">close</a>() ) ); -// tmpE-><a href="qwidget.html#setGeometry">setGeometry</a>(10, 10, 130, 30); +// tmpE = new <a href="ntqlineedit.html">TQLineEdit</a>( popup2 ); +// tmpE-><a href="ntqwidget.html#setFocus">setFocus</a>(); +// connect( tmpE, SIGNAL( <a href="ntqlineedit.html#returnPressed">returnPressed</a>() ), popup2, SLOT( <a href="ntqwidget.html#close">close</a>() ) ); +// tmpE-><a href="ntqwidget.html#setGeometry">setGeometry</a>(10, 10, 130, 30); } void <a name="f471"></a>Frame::button1Clicked(){ -<a name="x1622"></a><a name="x1618"></a> popup1-><a href="qwidget.html#move">move</a>( <a href="qwidget.html#mapToGlobal">mapToGlobal</a>( button1-><a href="qwidget.html#geometry">geometry</a>().bottomLeft() ) ); -<a name="x1628"></a> popup1-><a href="qwidget.html#show">show</a>(); +<a name="x1622"></a><a name="x1618"></a> popup1-><a href="ntqwidget.html#move">move</a>( <a href="ntqwidget.html#mapToGlobal">mapToGlobal</a>( button1-><a href="ntqwidget.html#geometry">geometry</a>().bottomLeft() ) ); +<a name="x1628"></a> popup1-><a href="ntqwidget.html#show">show</a>(); } void <a name="f472"></a>Frame::button2Pressed(){ @@ -225,13 +225,13 @@ void <a name="f472"></a>Frame::button2Pressed(){ int main( int argc, char **argv ) { - <a href="qapplication.html">TQApplication</a> a(argc,argv); + <a href="ntqapplication.html">TQApplication</a> a(argc,argv); Frame frame; - frame.<a href="qwidget.html#setCaption">setCaption</a>("TQt Example - Custom Popups"); - a.<a href="qapplication.html#setMainWidget">setMainWidget</a>(&frame); - frame.<a href="qwidget.html#show">show</a>(); - return a.<a href="qapplication.html#exec">exec</a>(); + frame.<a href="ntqwidget.html#setCaption">setCaption</a>("TQt Example - Custom Popups"); + a.<a href="ntqapplication.html#setMainWidget">setMainWidget</a>(&frame); + frame.<a href="ntqwidget.html#show">show</a>(); + return a.<a href="ntqapplication.html#exec">exec</a>(); } </pre> |