[Kst] kdeextragear-2/kst/kst
George Staikos
staikos at kde.org
Thu Apr 8 06:57:48 CEST 2004
CVS commit by staikos:
fix some more weird mouse handling cases that were unhandled, add in menu
titles
M +1 -0 kst2dplot.cpp 1.4
M +9 -0 ksttoplevelview.cpp 1.19
M +2 -1 kstviewobject.cpp 1.15
M +10 -5 kstviewwidget.cpp 1.10
--- kdeextragear-2/kst/kst/kst2dplot.cpp #1.3:1.4
@@ -50,4 +50,5 @@ void Kst2DPlot::paint(QPainter& p) {
bool Kst2DPlot::popupMenu(KPopupMenu *menu, const QPoint& pos, KstViewObjectPtr topLevelParent) {
+ KstViewObject::popupMenu(menu, pos, topLevelParent);
_view = dynamic_cast<KstTopLevelView*>(topLevelParent.data());
if (_view) {
--- kdeextragear-2/kst/kst/ksttoplevelview.cpp #1.18:1.19
@@ -341,4 +341,8 @@ static void slideInto(const QRect& regio
// Optimize me: can store, for instance, the painter I think
void KstTopLevelView::pressMove(const QPoint& pos) {
+ if (_pressDirection == -1 && _pressTarget) { // menu released
+ return;
+ }
+
if (_pressTarget) {
if (_pressDirection == 0) {
@@ -387,4 +391,9 @@ void KstTopLevelView::pressMove(const QP
void KstTopLevelView::releasePress(const QPoint& pos) {
+ if (_pressDirection == -1 && _pressTarget) { // menu released
+ _pressTarget = 0L;
+ return;
+ }
+
if (_pressTarget) {
if (_pressDirection == 0) {
--- kdeextragear-2/kst/kst/kstviewobject.cpp #1.14:1.15
@@ -24,4 +24,5 @@
#include <kdebug.h>
+#include <kpopupmenu.h>
KstViewObject::KstViewObject() : KstObject(), _geom(0, 0, 1, 1), _focus(false) {
@@ -274,7 +275,7 @@ const QRect& KstViewObject::geometry() c
bool KstViewObject::popupMenu(KPopupMenu *menu, const QPoint& pos, KstViewObjectPtr topParent) {
- Q_UNUSED(menu)
Q_UNUSED(pos)
Q_UNUSED(topParent)
+ menu->insertTitle(tagName(), -1, 0);
return false;
}
--- kdeextragear-2/kst/kst/kstviewwidget.cpp #1.9:1.10
@@ -80,5 +80,5 @@ void KstViewWidget::mouseMoveEvent(QMous
void KstViewWidget::mousePressEvent(QMouseEvent *e) {
- //kdDebug() << "Press event." << endl;
+ //kdDebug() << "Press event. button=" << e->button() << " state=" << e->state() << endl;
if (hasMouseTracking()) {
if (e->button() & Qt::LeftButton && _view->handlePress(e->pos())) {
@@ -94,8 +94,11 @@ void KstViewWidget::mousePressEvent(QMou
void KstViewWidget::mouseReleaseEvent(QMouseEvent *e) {
- if (hasMouseTracking()) {
+ //kdDebug() << "Release event. button=" << e->button() << " state=" << e->state() << endl;
+ if (hasMouseTracking() && e->button() & Qt::LeftButton) {
+ //kdDebug() << "doing releasePress" << endl;
_view->releasePress(e->pos());
e->accept();
} else {
+ _view->updateFocus(e->pos());
QWidget::mouseReleaseEvent(e);
}
@@ -107,7 +110,9 @@ void KstViewWidget::contextMenuEvent(QCo
//kdDebug() << "Querying for the popup" << endl;
bool onChild = _view->popupMenu(menu, e->pos());
+ if (menu->count() > 0) {
menu->popup(mapToGlobal(e->pos()));
//kdDebug() << "Showing the popup." << endl;
menu->exec();
+ }
delete menu;
//kdDebug() << "Deleting the popup." << endl;
More information about the Kst
mailing list