[Marble-devel] mouse bindings for the marble widget

Arnd Baecker arnd.baecker at web.de
Wed Jul 16 12:09:35 CEST 2008


Hi,

as a follow-up to a discussion on IRC:

There are two open issues for doing a fully useful
integration of marble into digikam 0.10(-svn):
a)  If one has a merker over the map, clicking with left mouse button,
    should not raise the popup-menu but trigger a custom function:
    The aim within digikam is: whenever a user clicks on an icon point
    (=photo) we (for example) want that image to be the currently
    selected one.

    To address this, Thorsten pointed me at:
    For the pop-up
    void MarbleWidgetPopupMenu::showFeatureInfo( QAction* action )
    is used, and the data in the action returns the
    position which was clicked.
    The suggestion was to reimplemnt the popupmenu.

    By now I looked further into the code and I don't think
    it is possible to simply do that for the following reason:

    In MarbleWidget.cpp there is a  MarbleWidgetPopupMenu   *m_popupmenu;
    but that's private  and thus not accessible from a
    MarbleWidget marble( &widget );

    Roughly I thought of something like this
    http://pastebin.com/m174328f5
    where then a reimplementation of
    MarbleWidgetPopupMenu::MarbleWidgetPopupMenu could be used
    there just the constructor would need to be changed,
    connect( m_lmbMenu, SIGNAL( triggered( QAction* ) ),
               this,      SLOT( showFeatureInfo( QAction* ) ) );

    However, as it is currently, this won't work.

    Gilles suggested the following:
    Because in marblewidget.cpp, the popupmenu is hardcoded,
    you first need to define a method to set it and remove the
    hardcoded  implementation and provide the default popupmenu code using
    current harcoded code.
    The default popup menu method must return a  pointer over an
    menu instance you pass this one to the setPopupmenu().
    In this way things would be customizable.
    If one does not want a popup-menu, just a null pop-up menu
    could be set.
    In marble's code, one needs to check if this one is null
    all the connection needed to fully embed/interact it ...
    in this case one doesn't try to use it anywhere, and instead
    emit a signal for the host application.

    While this sounds technically fine to me, it is beyond
    my present C++/Qt/... coding abilities and knowledge of marble code
    basis.

    Maybe the marble experts could have a look at this?

b)  To find an image in a given region on map
    we need to draw a rectangle (eg. via SHIFT+left mouse)
    and get the bounding box.
    This is already discussed, together with proposed patches in
    http://bugs.kde.org/show_bug.cgi?id=153070

    On the digikam side everything is prepared, and,
    If I understand things correctly, Thorsten said
    that on the marble side only the bounding box needs
    to be fixed.

    (BTW a demo of how things will look in digikam
    once this feature is implemented can be found here:
    http://www.digikam.org/drupal/node/318)

And (even though I mentioned it before ;-):
keep on the great work. Marble is fantastic!

Best, Arnd


More information about the Marble-devel mailing list