[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: branches/KDE/3.5/kdebase/kicker/kicker/ui
From: Aaron J. Seigo <aseigo () kde ! org>
Date: 2005-08-01 6:26:41
Message-ID: 1122877601.613616.7591.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 441944 by aseigo:
restore (and improve) drag and drop.
now just the success feedback and this is done for 3.5
M +42 -0 addapplet.cpp
M +1 -0 appletwidget.h
--- branches/KDE/3.5/kdebase/kicker/kicker/ui/addapplet.cpp #441943:441944
@@ -67,14 +67,56 @@
setSelected(m_selected);
itemTitle->setText("<h3>" + info.name() + "</h3>");
+ itemTitle->installEventFilter(this);
itemDescription->setText(info.comment());
+ itemDescription->installEventFilter(this);
KIconLoader * ldr = KGlobal::iconLoader();
QPixmap icon = ldr->loadIcon(info.icon(), KIcon::Panel, KIcon::SizeLarge,
KIcon::DefaultState, 0, false);
itemPixmap->setPixmap(icon);
+ itemPixmap->installEventFilter(this);
}
+bool AppletWidget::eventFilter(QObject* watched, QEvent* e)
+{
+ if (e->type() == QEvent::MouseButtonPress)
+ {
+ QMouseEvent* me = static_cast<QMouseEvent*>(e);
+ if (me->button() & LeftButton)
+ {
+ m_dragStart = me->pos();
+ }
+ }
+ else if (m_dragStart.isNull())
+ {
+ return false;
+ }
+
+ if (e->type() == QEvent::MouseMove)
+ {
+ QMouseEvent* me = static_cast<QMouseEvent*>(e);
+ if ((me->pos() - m_dragStart).manhattanLength() >
+ KGlobalSettings::dndEventDelay())
+ {
+ AppletInfoDrag* drag = new AppletInfoDrag(m_appletInfo, this);
+
+ if (itemPixmap->pixmap())
+ {
+ drag->setPixmap(*itemPixmap->pixmap());
+ }
+
+ drag->dragCopy();
+ }
+ }
+ else if (e->type() == QEvent::MouseButtonRelease)
+ {
+ m_dragStart = QPoint();
+ }
+
+ return false;
+}
+
void AppletWidget::keyPressEvent(QKeyEvent *e)
{
if (e->key() == Qt::Key_Enter ||
--- branches/KDE/3.5/kdebase/kicker/kicker/ui/appletwidget.h #441943:441944
@@ -43,6 +43,7 @@
AppletWidget(const AppletInfo& info, bool odd, QWidget *parent);
const AppletInfo& info() const { return m_appletInfo; }
+ virtual bool eventFilter(QObject* watched, QEvent* e);
void setSelected(bool selected);
void setOdd(bool odd);
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic