From kde-commits Sun Dec 08 21:58:19 2002 From: Bryce Nesbitt Date: Sun, 08 Dec 2002 21:58:19 +0000 To: kde-commits Subject: kdelibs/kdeui X-MARC-Message: https://marc.info/?l=kde-commits&m=103938480303344 CVS commit by bryce: Add tooltip with decimal ASCII value of current character (Thanks to Stanislav Visnovsky) (i18n) M +23 -0 kcharselect.cpp 1.31 M +3 -2 kcharselect.h 1.22 --- kdelibs/kdeui/kcharselect.cpp #1.30:1.31 @@ -33,4 +33,5 @@ #include #include +#include #include @@ -67,4 +68,6 @@ KCharSelectTable::KCharSelectTable( QWid repaintContents( false ); + setToolTips(); + setFocusPolicy( QWidget::StrongFocus ); setBackgroundMode( QWidget::NoBackground ); @@ -76,4 +79,6 @@ void KCharSelectTable::setFont( const QS vFont = _font; repaintContents( false ); + + setToolTips(); } @@ -92,4 +97,6 @@ void KCharSelectTable::setTableNum( int vTableNum = _tableNum; repaintContents( false ); + + setToolTips(); } @@ -116,4 +123,6 @@ void KCharSelectTable::resizeEvent( QRes if( new_h != cellHeight()) setCellHeight( new_h ); + + setToolTips(); } @@ -323,4 +332,18 @@ void KCharSelectTable::gotoDown() emit focusItemChanged( vChr ); emit focusItemChanged(); + } +} + +//================================================================== +void KCharSelectTable::setToolTips() +{ + for( int i=0 ; i< numRows(); i++ ) + { + for( int j=0; j< numCols(); j++ ) + { + QRect r( cellWidth()*j, cellHeight()*i, cellWidth(), cellHeight() ); + QToolTip::remove(this,r); + QToolTip::add(this, r, i18n("Character code","UTF code: %1").arg(QString::number(vTableNum * 256 + numCols()*i + j))); + } } } --- kdelibs/kdeui/kcharselect.h #1.21:1.22 @@ -99,4 +99,5 @@ signals: private: virtual void setFont(const QFont &f) { QGridView::setFont(f); } + void setToolTips(); protected: virtual void virtual_hook( int id, void* data );