korganizer
koincidencetooltip.cpp00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #include <libkcal/incidence.h>
00026 #include <libkcal/incidenceformatter.h>
00027
00028 #include "koincidencetooltip.h"
00029 #include "koagendaitem.h"
00030
00036 void KOIncidenceToolTip::add ( QWidget *widget, Calendar *calendar,
00037 Incidence *incidence, const QDate &date,
00038 QToolTipGroup *group, const QString &longText )
00039 {
00040 if ( !widget || !incidence ) {
00041 return;
00042 }
00043 QToolTip::add( widget, IncidenceFormatter::toolTipStr( calendar, incidence, date ), group, longText );
00044 }
00045
00046 void KOIncidenceToolTip::add( KOAgendaItem *item, Calendar *calendar,
00047 Incidence *incidence, const QDate &date,
00048 QToolTipGroup *group )
00049 {
00050 Q_UNUSED( incidence );
00051 Q_UNUSED( group );
00052 QToolTip::remove( item );
00053 new KOIncidenceToolTip( item, calendar, date );
00054 }
00055
00056 void KOIncidenceToolTip::maybeTip(const QPoint & pos)
00057 {
00058 Q_UNUSED( pos );
00059 KOAgendaItem *item = dynamic_cast<KOAgendaItem*>( parentWidget() );
00060 if ( !item )
00061 return;
00062 if ( !mText )
00063 mText = IncidenceFormatter::toolTipStr( mCalendar, item->incidence(), mDate );
00064 tip( QRect( QPoint( 0, 0 ), item->size() ), mText );
00065 }
|