keramik kwin theme an dialog boxes

Matthias Ettrich ettrich at trolltech.com
Mon Jul 1 15:35:23 BST 2002


On Monday 01 July 2002 15:55, Martijn Klingens wrote:
> On Mon, 1 Jul 2002, Matthias Ettrich wrote:
> > It's not a QComboBox feature, but a feature of QDialog.
> >
> > Context menu events in Qt are propagated up the parent widget chain, as
> > long as the receiving widgets ignore them. When the context menu event
> > reaches the toplevel QDialog, it will show the whats this context menu if
> > any of the widgets in question had whats this help assigned to them.
>
> So essentially the widgets that do their own context menu should wrap that
> functionality themselves? Or does it rely on QDialog internals that are
> not available to widgets lower in the tree?

It's all public API, QWhatsThis::textFor and QWhatsThis::display, see 
qdialog.cpp:

void QDialog::contextMenuEvent( QContextMenuEvent *e )
{
#if !defined(QT_NO_WHATSTHIS) && !defined(QT_NO_POPUPMENU)
    QWidget* w = childAt( e->pos(), TRUE );
    if ( !w )
	return;
    QString s = QWhatsThis::textFor( w, e->pos(), TRUE );
    if ( !s.isEmpty() ) {
	QPopupMenu p(0,"qt_whats_this_menu");
	p.insertItem( tr("What's This?"), 42 );
	if ( p.exec( e->globalPos() ) >= 42 )
	    QWhatsThis::display( s, w->mapToGlobal( w->rect().center() ) );
    }
#endif
}

Matthias




More information about the kde-core-devel mailing list