summaryrefslogtreecommitdiffstats
path: root/src/popupmenu.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-05-17 08:20:48 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-05-17 08:20:48 +0000
commitaa0726b20f398264f0a2abc60215be044b106f9c (patch)
tree070fdbc19a1106cfdd7f651a8ce76bb1b89a513d /src/popupmenu.cpp
parentd3cf5b3e75aadc3b02d0b56f030d4c3f8c2c749d (diff)
downloadbasket-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.cpp')
-rw-r--r--src/popupmenu.cpp72
1 files changed, 36 insertions, 36 deletions
diff --git a/src/popupmenu.cpp b/src/popupmenu.cpp
index a73aa65..68085f3 100644
--- a/src/popupmenu.cpp
+++ b/src/popupmenu.cpp
@@ -19,9 +19,9 @@
***************************************************************************/
#include <kapplication.h>
-#include <qdesktopwidget.h>
-#include <qpopupmenu.h>
-#include <qrect.h>
+#include <tqdesktopwidget.h>
+#include <tqpopupmenu.h>
+#include <tqrect.h>
#include "popupmenu.h"
@@ -35,17 +35,17 @@
* expect to try to popup the menu first at bottom-right
* and not at bottom-left.
* NOTE 2 : This implementation do not support virtual desktop with more than
- * one screen. Pehrapse QPopupMenu solve it by itself but I can't
+ * one screen. Pehrapse TQPopupMenu solve it by itself but I can't
* try : I have only one screen.
- * => Have those methods directly in Qt (or KDE) would be a great benefits !
+ * => Have those methods directly in TQt (or KDE) would be a great benefits !
*/
-void PopupMenu::execAtRectCenter(QPopupMenu &menu, const QRect &rect)
+void PopupMenu::execAtRectCenter(TQPopupMenu &menu, const TQRect &rect)
{
// Compute point where to popup the menu that should be centered :
- QSize menuSize = menu.sizeHint();
- QSize menuHalfSize = menuSize / 2;
- QPoint point = rect.center() - QPoint(menuHalfSize.width(), menuHalfSize.height());
+ TQSize menuSize = menu.tqsizeHint();
+ TQSize menuHalfSize = menuSize / 2;
+ TQPoint point = rect.center() - TQPoint(menuHalfSize.width(), menuHalfSize.height());
// Very strange : menu.exec(point) do that clipping (but not when exec() by mouse !!! ) :
// If menu is partially out of the screen, move it :
@@ -57,95 +57,95 @@ void PopupMenu::execAtRectCenter(QPopupMenu &menu, const QRect &rect)
if (point.y() < 0) point.setY(0);*/
// And show the menu :
- menu.exec( point + QPoint(0, MENU_Y_OFFSET) ); // Stupid offset (Qt bug ?) : we should show the menus 2 pixels more bottom !
+ menu.exec( point + TQPoint(0, MENU_Y_OFFSET) ); // Stupid offset (TQt bug ?) : we should show the menus 2 pixels more bottom !
}
// Needed on debug to draw the passed global rectangle :
-//#include <qpainter.h>
-//#include <qpen.h>
+//#include <tqpainter.h>
+//#include <tqpen.h>
-void PopupMenu::execAtRectBottom(QPopupMenu &menu, const QRect &rect, bool centered)
+void PopupMenu::execAtRectBottom(TQPopupMenu &menu, const TQRect &rect, bool centered)
{
- QSize menuSize = menu.sizeHint() - QSize(1, 1); // A size is [1..n] => We want two lengths that are [0..(n-1)]
- int desktopWidth = kapp->desktop()->width(); // to be compared/added/substracted with QRects/QPoints...
+ TQSize menuSize = menu.tqsizeHint() - TQSize(1, 1); // A size is [1..n] => We want two lengths that are [0..(n-1)]
+ int desktopWidth = kapp->desktop()->width(); // to be compared/added/substracted with TQRects/TQPoints...
int desktopHeight = kapp->desktop()->height();
/** Paint the rect on the screen (desktop).
* For test purpose only (to be sure the passed rectangle is right).
* Comment this (and the qpainter and qpen includes) for a non-debug version.
*/
- /*QPainter paint(kapp->desktop(), kapp->desktop(), true);
- paint.setPen( QPen(Qt::black, 1) );
+ /*TQPainter paint(kapp->desktop(), kapp->desktop(), true);
+ paint.setPen( TQPen(TQt::black, 1) );
paint.drawRect(rect);
paint.end();*/
// rect.bottomLeft() and rect.bottomRight() must be VISIBLE :
// show the menu 1 pixel more BOTTOM (add 1 in Y) :
- QPoint point = rect.bottomLeft() + QPoint(0, 1);
+ TQPoint point = rect.bottomLeft() + TQPoint(0, 1);
if (point.y() + menuSize.height() < desktopHeight) { // First try at bottom
if (centered)
- point = QPoint( rect.center().x() - menuSize.width() / 2, point.y() );
+ point = TQPoint( rect.center().x() - menuSize.width() / 2, point.y() );
else if (point.x() + menuSize.width() < desktopWidth) // Then, try at bottom-left
/*point is already set*/;
else // Overwise, at bottom-right
- point = rect.bottomRight() - QPoint(menuSize.width(), - 1);
+ point = rect.bottomRight() - TQPoint(menuSize.width(), - 1);
// Idem : rect.topLeft() and rect.topRight() must be VISIBLE :
// show the menu 1 pixel more TOP (substract 1 in Y) :
} else { // Overwize, try at top
if (centered)
- point = QPoint( rect.center().x() - menuSize.width() / 2, rect.top() - menuSize.height() - 1 );
+ point = TQPoint( rect.center().x() - menuSize.width() / 2, rect.top() - menuSize.height() - 1 );
else if (point.x() + menuSize.width() < desktopWidth) // Then, try at top-left
- point = rect.topLeft() - QPoint(0, menuSize.height() + 1);
+ point = rect.topLeft() - TQPoint(0, menuSize.height() + 1);
else // Overwise, at top-right
- point = rect.topRight() - QPoint(menuSize.width(), menuSize.height() + 1);
+ point = rect.topRight() - TQPoint(menuSize.width(), menuSize.height() + 1);
}
// No need to clip : it will be done by menu.exec(...)
// And show the menu :
- menu.exec( point + QPoint(0, MENU_Y_OFFSET) ); // Stupid offset (Qt bug ?) : we should show the menus 2 pixels more bottom !
+ menu.exec( point + TQPoint(0, MENU_Y_OFFSET) ); // Stupid offset (TQt bug ?) : we should show the menus 2 pixels more bottom !
}
-void PopupMenu::execAtRectRight(QPopupMenu &menu, const QRect &rect, bool centered)
+void PopupMenu::execAtRectRight(TQPopupMenu &menu, const TQRect &rect, bool centered)
{
- QSize menuSize = menu.sizeHint() - QSize(1, 1); // A size is [1..n] => We want two lengths that are [0..(n-1)]
- int desktopWidth = kapp->desktop()->width(); // to be compared/added/substracted with QRects/QPoints...
+ TQSize menuSize = menu.tqsizeHint() - TQSize(1, 1); // A size is [1..n] => We want two lengths that are [0..(n-1)]
+ int desktopWidth = kapp->desktop()->width(); // to be compared/added/substracted with TQRects/TQPoints...
int desktopHeight = kapp->desktop()->height();
/** Paint the rect on the screen (desktop).
* For test purpose only (to be sure the passed rectangle is right).
* Comment this (and the qpainter and qpen includes) for a non-debug version.
*/
- /*QPainter paint(kapp->desktop(), kapp->desktop(), true);
- paint.setPen( QPen(Qt::black, 1) );
+ /*TQPainter paint(kapp->desktop(), kapp->desktop(), true);
+ paint.setPen( TQPen(TQt::black, 1) );
paint.drawRect(rect);
paint.end();*/
// rect.topRight() and rect.topLeft() must be VISIBLE :
// show the menu 1 pixel more RIGHT (add 1 in X) :
- QPoint point = rect.topRight() + QPoint(1, 0);
+ TQPoint point = rect.topRight() + TQPoint(1, 0);
if (point.x() + menuSize.width() < desktopWidth) { // First try at right
if (centered)
- point = QPoint( point.x(), rect.center().y() - menuSize.height() / 2 );
+ point = TQPoint( point.x(), rect.center().y() - menuSize.height() / 2 );
else if (point.y() + menuSize.height() < desktopHeight) // Then, try at top-right
/*point is already set*/;
else // Overwise, at top-left
- point = rect.bottomRight() - QPoint(-1, menuSize.height());
+ point = rect.bottomRight() - TQPoint(-1, menuSize.height());
// Idem : rect.topLeft() and rect.bottomLeft() must be VISIBLE :
// show the menu 1 pixel more LEFT (substract 1 in X) :
} else { // Overwize, try at top
if (centered)
- point = QPoint( rect.left() - menuSize.width() - 1, rect.center().y() - menuSize.height() / 2 );
+ point = TQPoint( rect.left() - menuSize.width() - 1, rect.center().y() - menuSize.height() / 2 );
else if (point.y() + menuSize.height() < desktopHeight) // Then, try at top-left
- point = rect.topLeft() - QPoint(menuSize.width() + 1, 0);
+ point = rect.topLeft() - TQPoint(menuSize.width() + 1, 0);
else // Overwise, at bottom-left
- point = rect.bottomLeft() - QPoint(menuSize.width() + 1, menuSize.height());
+ point = rect.bottomLeft() - TQPoint(menuSize.width() + 1, menuSize.height());
}
// No need to clip : it will be done by menu.exec(...)
// And show the menu :
- menu.exec( point + QPoint(0, MENU_Y_OFFSET) ); // Stupid offset (Qt bug ?) : we should show the menus 2 pixels more bottom !
+ menu.exec( point + TQPoint(0, MENU_Y_OFFSET) ); // Stupid offset (TQt bug ?) : we should show the menus 2 pixels more bottom !
}
// # i n c l u d e " p o p u p m e n u . m o c " // Comment this if you don't compile PopupMenuTest class