From ea318d1431c89e647598c510c4245c6571aa5f46 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Thu, 26 Jan 2012 23:32:43 -0600 Subject: Update to latest tqt3 automated conversion --- doc/html/popup-example.html | 130 ++++++++++++++++++++++---------------------- 1 file changed, 65 insertions(+), 65 deletions(-) (limited to 'doc/html/popup-example.html') 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 <qlabel.h> -#include <qpushbutton.h> -#include <qlineedit.h> +#include <ntqlabel.h> +#include <ntqpushbutton.h> +#include <ntqlineedit.h> -class FancyPopup : public TQLabel +class FancyPopup : public TQLabel { Q_OBJECT public: - FancyPopup( TQWidget* parent = 0, const char* name=0); + FancyPopup( TQWidget* parent = 0, const char* name=0); - void popup( TQWidget* parent = 0); + void popup( TQWidget* parent = 0); protected: virtual void mouseMoveEvent( TQMouseEvent * ); virtual void mouseReleaseEvent( TQMouseEvent * ); virtual void closeEvent( TQCloseEvent * ); private: - TQWidget* popupParent; + TQWidget* popupParent; int moves; }; - class Frame : public TQFrame + class Frame : public TQFrame { Q_OBJECT public: - Frame( TQWidget *parent=0, const char* name=0); + Frame( TQWidget *parent=0, const char* name=0); protected: @@ -88,10 +88,10 @@ private: void button2Pressed(); private: - TQPushButton *button1; - TQPushButton *button2; + TQPushButton *button1; + TQPushButton *button2; - TQFrame* popup1; + TQFrame* popup1; FancyPopup* popup2; }; @@ -111,33 +111,33 @@ private: *****************************************************************************/ #include "popup.h" -#include <qapplication.h> -#include <qlayout.h> - -FancyPopup::FancyPopup( TQWidget* parent, const char* name ): - TQLabel( parent, name, WType_Popup ){ - setFrameStyle( WinPanel|Raised ); - setAlignment( AlignCenter ); - resize(150,100); +#include <ntqapplication.h> +#include <ntqlayout.h> + +FancyPopup::FancyPopup( TQWidget* parent, const char* name ): + TQLabel( parent, name, WType_Popup ){ + setFrameStyle( WinPanel|Raised ); + setAlignment( AlignCenter ); + resize(150,100); moves = 0; - setMouseTracking( TRUE ); + setMouseTracking( TRUE ); } -void FancyPopup::mouseMoveEvent( TQMouseEvent * e){ +void FancyPopup::mouseMoveEvent( TQMouseEvent * e){ moves++; - TQString s; - s.sprintf("%d/%d", e->pos().x(), e->pos().y()); + TQString s; + s.sprintf("%d/%d", e->pos().x(), e->pos().y()); if (e->state() & TQMouseEvent::LeftButton) s += " (down)"; - setText(s); + setText(s); } -void FancyPopup::mouseReleaseEvent( TQMouseEvent * e){ - if (rect().contains( e->pos() ) || moves > 5) - close(); +void FancyPopup::mouseReleaseEvent( TQMouseEvent * e){ + if (rect().contains( e->pos() ) || moves > 5) + close(); } -void FancyPopup::closeEvent( TQCloseEvent *e ){ +void FancyPopup::closeEvent( TQCloseEvent *e ){ e->accept(); 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. TQMouseEvent me( TQEvent::MouseButtonRelease, TQPoint(0,0), TQPoint(0,0), TQMouseEvent::LeftButton, TQMouseEvent::NoButton); - TQApplication::sendEvent( popupParent, &me ); + TQApplication::sendEvent( popupParent, &me ); } -void FancyPopup::popup( TQWidget* parent) { +void FancyPopup::popup( TQWidget* parent) { popupParent = parent; setText("Move the mouse!"); if (popupParent) - move( popupParent->mapToGlobal( popupParent->rect().bottomLeft() ) ); - show(); + move( popupParent->mapToGlobal( popupParent->rect().bottomLeft() ) ); + show(); } @@ -165,36 +165,36 @@ void FancyPopup::popup( TQWidget* -Frame::Frame(TQWidget* parent, const char* name): TQFrame(parent, name){ - button1 = new TQPushButton("Simple Popup", this); - connect ( button1, SIGNAL( clicked() ), SLOT( button1Clicked() ) ); - button2 = new TQPushButton("Fancy Popup", this); - connect ( button2, SIGNAL( pressed() ), SLOT( button2Pressed() ) ); +Frame::Frame(TQWidget* parent, const char* name): TQFrame(parent, name){ + button1 = new TQPushButton("Simple Popup", this); + connect ( button1, SIGNAL( clicked() ), SLOT( button1Clicked() ) ); + button2 = new TQPushButton("Fancy Popup", this); + connect ( button2, SIGNAL( pressed() ), SLOT( button2Pressed() ) ); TQBoxLayout * l = new TQHBoxLayout( this ); - button1->setMaximumSize(button1->sizeHint()); - button2->setMaximumSize(button2->sizeHint()); + button1->setMaximumSize(button1->sizeHint()); + button2->setMaximumSize(button2->sizeHint()); l->addWidget( button1 ); l->addWidget( button2 ); - l->activate(); + l->activate(); -// button1->setGeometry(20,20,100,30); -// button2->setGeometry(140,20,100,30); - resize(270, 70); +// button1->setGeometry(20,20,100,30); +// button2->setGeometry(140,20,100,30); + resize(270, 70); //create a very simple popup: it is just composed with other //widget and will be shown after clicking on button1 - popup1 = new TQFrame( this ,0, WType_Popup); - popup1->setFrameStyle( WinPanel|Raised ); - popup1->resize(150,100); - TQLineEdit *tmpE = new TQLineEdit( popup1 ); - connect( tmpE, SIGNAL( returnPressed() ), popup1, SLOT( hide() ) ); - tmpE->setGeometry(10,10, 130, 30); - tmpE->setFocus(); - TQPushButton *tmpB = new TQPushButton("Click me!", popup1); - connect( tmpB, SIGNAL( clicked() ), popup1, SLOT( close() ) ); - tmpB->setGeometry(10, 50, 130, 30); + popup1 = new TQFrame( this ,0, WType_Popup); + popup1->setFrameStyle( WinPanel|Raised ); + popup1->resize(150,100); + TQLineEdit *tmpE = new TQLineEdit( popup1 ); + connect( tmpE, SIGNAL( returnPressed() ), popup1, SLOT( hide() ) ); + tmpE->setGeometry(10,10, 130, 30); + tmpE->setFocus(); + TQPushButton *tmpB = new TQPushButton("Click me!", popup1); + connect( tmpB, SIGNAL( clicked() ), popup1, SLOT( close() ) ); + tmpB->setGeometry(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 FancyPopup::popup( TQWidget* // it with any other widget. The next four lines (if not // commented out) will for instance add a line edit widget. -// tmpE = new TQLineEdit( popup2 ); -// tmpE->setFocus(); -// connect( tmpE, SIGNAL( returnPressed() ), popup2, SLOT( close() ) ); -// tmpE->setGeometry(10, 10, 130, 30); +// tmpE = new TQLineEdit( popup2 ); +// tmpE->setFocus(); +// connect( tmpE, SIGNAL( returnPressed() ), popup2, SLOT( close() ) ); +// tmpE->setGeometry(10, 10, 130, 30); } void Frame::button1Clicked(){ - popup1->move( mapToGlobal( button1->geometry().bottomLeft() ) ); - popup1->show(); + popup1->move( mapToGlobal( button1->geometry().bottomLeft() ) ); + popup1->show(); } void Frame::button2Pressed(){ @@ -225,13 +225,13 @@ void Frame::button2Pressed(){ int main( int argc, char **argv ) { - TQApplication a(argc,argv); + TQApplication a(argc,argv); Frame frame; - frame.setCaption("TQt Example - Custom Popups"); - a.setMainWidget(&frame); - frame.show(); - return a.exec(); + frame.setCaption("TQt Example - Custom Popups"); + a.setMainWidget(&frame); + frame.show(); + return a.exec(); } -- cgit v1.2.3