[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdevplatform/sublime
From: Milian Wolff <mail () milianw ! de>
Date: 2009-10-28 0:59:41
Message-ID: 1256691581.048191.27510.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 1041441 by mwolff:
show the same context menu on the tool view toggle-button as on the tool view itself \
(i.e. the position menu)
M +12 -2 ideal.cpp
M +4 -1 ideal.h
--- trunk/KDE/kdevplatform/sublime/ideal.cpp #1041440:1041441
@@ -50,6 +50,8 @@
setAutoRaise(true);
setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
setIcons( "process-working-kde" );
+
+ setContextMenuPolicy(Qt::CustomContextMenu);
}
Qt::Orientation IdealToolButton::orientation() const
@@ -283,6 +285,8 @@
connect(button, SIGNAL(toggled(bool)), action, SLOT(setChecked(bool)));
connect(_widgets[action]->view(), SIGNAL(showProgressIndicator()), \
button, SLOT(showProgressIndicator()));
connect(_widgets[action]->view(), SIGNAL(hideProgressIndicator()), \
button, SLOT(hideProgressIndicator())); + connect(button, \
SIGNAL(customContextMenuRequested(QPoint)), + _widgets[action], \
SLOT(contextMenuRequested(QPoint))); }
} break;
@@ -336,6 +340,9 @@
m_docking_area(Qt::NoDockWidgetArea),
m_maximized(false)
{
+ setContextMenuPolicy(Qt::CustomContextMenu);
+ connect(this, SIGNAL(customContextMenuRequested(QPoint)),
+ this, SLOT(contextMenuRequested(QPoint)));
QAbstractButton *floatButton =
qFindChild<QAbstractButton *>(this, QLatin1String("qt_dockwidget_floatbutton"));
@@ -440,8 +447,11 @@
m_area->removeToolView(m_view);
}
-void IdealDockWidget::contextMenuEvent(QContextMenuEvent *event)
+void IdealDockWidget::contextMenuRequested(const QPoint &point)
{
+ QWidget* senderWidget = qobject_cast<QWidget*>(sender());
+ Q_ASSERT(senderWidget);
+
KMenu menu;
menu.addTitle(i18n("Position"));
@@ -468,7 +478,7 @@
else
right->setChecked(true);
- QAction* triggered = menu.exec(event->globalPos());
+ QAction* triggered = menu.exec(senderWidget->mapToGlobal(point));
if (triggered)
{
--- trunk/KDE/kdevplatform/sublime/ideal.h #1041440:1041441
@@ -129,8 +129,11 @@
virtual bool event(QEvent *event);
+public slots:
+ /// The IdealToolButton also connects to this slot to show the same context \
menu. + void contextMenuRequested(const QPoint &point);
+
protected: // QWidget overrides
- virtual void contextMenuEvent(QContextMenuEvent *);
virtual void mouseDoubleClickEvent(QMouseEvent *event);
Q_SIGNALS:
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic