Improving tabbar context menus

Milian Wolff mail at milianw.de
Thu Sep 10 23:48:15 UTC 2009


Hey guys!

First up: It looks like sublime/switcher.{cpp,h} is not used anywhere, can it 
be removed? The container uses a KTabBar.

Then in regard to r1022160, I have a few questions which you guys can 
hopefully help me with.

Currently I just implemented the two features in the context menu that are 
directly dependent on KTabBar features. Anything else I want to see in that 
context menu is - as far as I can see it - not accessible to me:

A "new tab" feature would require something like
ICore::self()->documentController()->openDocumentFromText(QString());
But sublime is detached from kdevplatform, hence I could only link to that 
from inside shell. Which leads us to the real problem:

How can I access the TabBar from inside shell? It's stored in a d-pointer of 
the container... And other than that the container is created in the 
mainwindow d-pointer of sublime, i.e. sublime/mainwindow_p.cpp:230



Is this possibly solvable through KXMLGui? To have some exensible xml file with 
associated signal/slots that get called? Or anything else that isn't a royal 
pita to use?

Or what about a generic signal that the container emits, lets call it 
contextMenuRequested(QPointer globalPos, QWidget* widget);
The widget would be the widget that the tab contains, i.e. the document in 
most cases.

Then it should be possible to bubble this signal up to the main window, where 
we can finally show the context menu.

I.e.: in container grab the contextMenu event and emit a new signal with View 
and position, instead of some index. Then in the Mainwindow grab that signal 
and do something.

This should actually work I think... Do you think this is OK design-wise or 
should I come up with something different?

I think I'Ll try it out tomorrow and see how far I can get it!

-- 
Milian Wolff
mail at milianw.de
http://milianw.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20090911/9887b3ec/attachment.sig>


More information about the KDevelop-devel mailing list