Author: tgoettlicher Date: Fri Mar 6 16:05:07 2009 New Revision: 55980 URL: http://svn.opensuse.org/viewcvs/yast?rev=55980&view=rev Log: enabled context menu for tree and table widgets Modified: trunk/qt/src/YQTable.cc trunk/qt/src/YQTable.h trunk/qt/src/YQTree.cc trunk/qt/src/YQTree.h trunk/ycp-ui-bindings/examples/Events.ycp Modified: trunk/qt/src/YQTable.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/qt/src/YQTable.cc?rev=55980&r1=55979&r2=55980&view=diff ============================================================================== --- trunk/qt/src/YQTable.cc (original) +++ trunk/qt/src/YQTable.cc Fri Mar 6 16:05:07 2009 @@ -30,6 +30,8 @@ #include "QY2ListView.h" #include "YQTable.h" +#include "YQApplication.h" + YQTable::YQTable( YWidget * parent, YTableHeader * tableHeader, bool multiSelectionMode ) @@ -384,6 +386,14 @@ } +void +YQTable::slotContextMenu ( const QPoint & pos ) +{ + YQUI::yqApp()->setContextMenuPos( pos ); + if ( contextMenu() ) + YQUI::ui()->sendEvent( new YWidgetEvent( this, YEvent::ContextMenuActivated ) ); +} + Modified: trunk/qt/src/YQTable.h URL: http://svn.opensuse.org/viewcvs/yast/trunk/qt/src/YQTable.h?rev=55980&r1=55979&r2=55980&view=diff ============================================================================== --- trunk/qt/src/YQTable.h (original) +++ trunk/qt/src/YQTable.h Fri Mar 6 16:05:07 2009 @@ -152,6 +152,14 @@ **/ void slotActivated( QTreeWidgetItem * ); + /** + * Propagate a context menu selection + * + * This will trigger an 'ContextMenuActivated' event if 'contextMenu' is set. + **/ + void slotContextMenu ( const QPoint & pos ); + + protected: Modified: trunk/qt/src/YQTree.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/qt/src/YQTree.cc?rev=55980&r1=55979&r2=55980&view=diff ============================================================================== --- trunk/qt/src/YQTree.cc (original) +++ trunk/qt/src/YQTree.cc Fri Mar 6 16:05:07 2009 @@ -69,7 +69,8 @@ _qt_treeWidget->header()->hide(); // _qt_treeWidget->setHeader(0L); _qt_treeWidget->setRootIsDecorated ( true ); - _qt_treeWidget->setContextMenuPolicy( Qt::CustomContextMenu ); + + _qt_treeWidget->setContextMenuPolicy( Qt::CustomContextMenu ); _caption->setBuddy ( _qt_treeWidget ); Modified: trunk/qt/src/YQTree.h URL: http://svn.opensuse.org/viewcvs/yast/trunk/qt/src/YQTree.h?rev=55980&r1=55979&r2=55980&view=diff ============================================================================== --- trunk/qt/src/YQTree.h (original) +++ trunk/qt/src/YQTree.h Fri Mar 6 16:05:07 2009 @@ -120,7 +120,6 @@ protected slots: - void slotContextMenu ( const QPoint & pos ); /** @@ -147,6 +146,13 @@ **/ void slotItemCollapsed( QTreeWidgetItem * item ); + /** + * Propagate a context menu selection + * + * This will trigger an 'ContextMenuActivated' event if 'contextMenu' is set. + **/ + void slotContextMenu ( const QPoint & pos ); + protected: Modified: trunk/ycp-ui-bindings/examples/Events.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/ycp-ui-bindings/examples/Events.ycp?rev=55980&r1=55979&r2=55980&view=diff ============================================================================== --- trunk/ycp-ui-bindings/examples/Events.ycp (original) +++ trunk/ycp-ui-bindings/examples/Events.ycp Fri Mar 6 16:05:07 2009 @@ -42,7 +42,7 @@ "chef de cuisine Giuseppe</a>.</p>"; - term delivery = `Tree(`id(`delivery_service ), `opt(`notify), "&Delivery Service", + term delivery = `Tree(`id(`delivery_service ), `opt(`notify, `contextMenu), "&Delivery Service", [ `item(`id(`europe), "Europe", true, [ @@ -81,7 +81,7 @@ ] ); - term pizza = `SelectionBox(`id(`pizza), `opt(`notify,`immediate), "Pi&zza", + term pizza = `SelectionBox(`id(`pizza), `opt(`notify,`immediate, `contextMenu), "Pi&zza", [ `item(`id(`napoli ), "Napoli" ), `item(`id(`funghi ), "Funghi" ), @@ -92,7 +92,7 @@ ] ); - term toppings = `MultiSelectionBox(`id(`toppings), `opt(`notify), "To&ppings", + term toppings = `MultiSelectionBox(`id(`toppings), `opt(`notify, `contextMenu), "To&ppings", [ `item( `id(`cheese ), "Cheese" , true ), `item( `id(`tomatoes ), "Tomatoes" , true ), @@ -103,7 +103,7 @@ ] ); - term drink = `Table(`id(`drink), `opt(`notify, `immediate, `multiSelection), `header( "Drink", "Contents" ), + term drink = `Table(`id(`drink), `opt(`notify, `immediate, `multiSelection, `contextMenu), `header( "Drink", "Contents" ), [ `item(`id(`coke), "Coca Cola", "Caffeine" ), `item(`id(`sprite), "Sprite", "" ), -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org