diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-05-17 08:20:48 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-05-17 08:20:48 +0000 |
commit | aa0726b20f398264f0a2abc60215be044b106f9c (patch) | |
tree | 070fdbc19a1106cfdd7f651a8ce76bb1b89a513d /src/popupmenu.h | |
parent | d3cf5b3e75aadc3b02d0b56f030d4c3f8c2c749d (diff) | |
download | basket-aa0726b20f398264f0a2abc60215be044b106f9c.tar.gz basket-aa0726b20f398264f0a2abc60215be044b106f9c.zip |
TQt4 port basket
This enables compilation under both Qt3 and Qt4
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/basket@1232416 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/popupmenu.h')
-rw-r--r-- | src/popupmenu.h | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/src/popupmenu.h b/src/popupmenu.h index fa92f39..e9bdaae 100644 --- a/src/popupmenu.h +++ b/src/popupmenu.h @@ -21,10 +21,10 @@ #ifndef POPUPMENU_H #define POPUPMENU_H -class QPopupMenu; -class QRect; +class TQPopupMenu; +class TQRect; -/** QPopupMenu/KPopupMenu doesn't provide metod to exec a menu +/** TQPopupMenu/KPopupMenu doesn't provide metod to exec a menu * at a given rectangle ! * eg, popup at bottom of a rectangle, and at top if not possible... * @author Sébastien Laoût @@ -33,7 +33,7 @@ namespace PopupMenu { /** Show the popup menu centered into rect. */ - void execAtRectCenter(QPopupMenu &menu, const QRect &rect); + void execAtRectCenter(TQPopupMenu &menu, const TQRect &rect); /** Show the popup menu at left-bottom of rect, or at right-bottom * if not possible (not enought place). @@ -42,7 +42,7 @@ namespace PopupMenu * If center is true, it will try to horizontaly center the popup with * rect, so it will try two positions : bottom center and then top center. */ - void execAtRectBottom(QPopupMenu &menu, const QRect &rect, bool centered = false); + void execAtRectBottom(TQPopupMenu &menu, const TQRect &rect, bool centered = false); /** Idem execAtRectBottom but on the right or left sides, * prior aligned with the top of the rect, and at the bottom @@ -50,11 +50,11 @@ namespace PopupMenu * If center is true, it will try to vertically center the popup with * rect, so it will try two positions : right center and then left center. */ - void execAtRectRight(QPopupMenu &menu, const QRect &rect, bool centered = false); + void execAtRectRight(TQPopupMenu &menu, const TQRect &rect, bool centered = false); } /** Test window of PopupMenu methods. - * Just include popupmenu.h in a main Qt application and call + * Just include popupmenu.h in a main TQt application and call * new PopupMenuTest(); * Click the window for more explications. * Resize it to test particular cases. @@ -64,26 +64,26 @@ namespace PopupMenu /***** -#include <qwidget.h> -#include <qpopupmenu.h> -#include <qpainter.h> -#include <qpen.h> +#include <tqwidget.h> +#include <tqpopupmenu.h> +#include <tqpainter.h> +#include <tqpen.h> c l a s s P o p u p M e n u T e s t : p u b l i c Q W i d g e t { Q _ O B J E C T p u b l i c: PopupMenuTest() - : QWidget(0) + : TQWidget(0) { setCaption("Click to test!"); show(); } - void mousePressEvent(QMouseEvent *event) + void mousePressEvent(TQMouseEvent *event) { - QPopupMenu menu; - QRect rect( mapToGlobal(QPoint(0,0)), size() ); + TQPopupMenu menu; + TQRect rect( mapToGlobal(TQPoint(0,0)), size() ); menu.insertItem("A test of popup menu!"); menu.insertItem("This menu contain some items"); @@ -96,23 +96,23 @@ c l a s s P o p u p M e n u T e s t : p u b l i c Q W i d g e t if (event->button() & Qt::LeftButton) PopupMenu::execAtRectCenter(menu, rect); - else if ((event->button() & Qt::RightButton) && (event->state() & Qt::ShiftButton)) + else if ((event->button() & Qt::RightButton) && (event->state() & TQt::ShiftButton)) PopupMenu::execAtRectBottom(menu, rect, true); else if (event->button() & Qt::RightButton) PopupMenu::execAtRectBottom(menu, rect); - else if ((event->button() & Qt::MidButton) && (event->state() & Qt::ShiftButton)) + else if ((event->button() & TQt::MidButton) && (event->state() & TQt::ShiftButton)) PopupMenu::execAtRectRight(menu, rect, true); - else if (event->button() & Qt::MidButton) + else if (event->button() & TQt::MidButton) PopupMenu::execAtRectRight(menu, rect); } - void paintEvent(QPaintEvent*) + void paintEvent(TQPaintEvent*) { - QPainter paint(this); + TQPainter paint(this); paint.setPen(paletteBackgroundColor()); paint.drawRect(rect()); paint.drawWinFocusRect(rect()); - paint.setPen( QPen(Qt::black, 1) ); + paint.setPen( TQPen(TQt::black, 1) ); paint.drawLine( rect().topLeft(), rect().bottomRight() ); paint.drawLine( rect().topRight(), rect().bottomLeft() ); } |