Revision: 6349
Author: nogu.dev
Date: Wed Apr 28 15:51:18 2010
Log: * qt4/immodule/candidatewindow.cpp
  - (CandidateWindow::setPage):
    * Save annotation data to list.
    * Set column text to "..." if there are annotation data.
  - (CandidateWindow::slotHookSubwindow): Get data from list.
  - (CandidateListView::sizeHint):
    Don't check size of column for annotation.
* qt4/immodule/candidatewindow.h
  - Add list to save annotation data.
http://code.google.com/p/uim/source/detail?r=6349

Modified:
 /trunk/qt4/immodule/candidatewindow.cpp
 /trunk/qt4/immodule/candidatewindow.h

=======================================
--- /trunk/qt4/immodule/candidatewindow.cpp     Wed Apr 28 15:51:07 2010
+++ /trunk/qt4/immodule/candidatewindow.cpp     Wed Apr 28 15:51:18 2010
@@ -235,6 +235,7 @@

     // clear items
     cList->clearContents();
+    annotations.clear();

     // calculate page
     int newpage, lastpage;
@@ -297,6 +298,7 @@
         if ( hasAnnotation ) {
             annotationString
= QString::fromUtf8( uim_candidate_get_annotation_str( cand ) );
+            annotations.append( annotationString );
         }

         // insert new item to the candidate list
@@ -311,9 +313,9 @@
         cList->setItem( i, HEADING_COLUMN, headItem );
         cList->setItem( i, CANDIDATE_COLUMN, candItem );

-        if ( hasAnnotation ) {
+        if ( hasAnnotation && !annotationString.isEmpty() ) {
             QTableWidgetItem *annotationItem = new QTableWidgetItem;
-            annotationItem->setText( annotationString );
+            annotationItem->setText( "..." );
             annotationItem->setFlags(
                 Qt::ItemIsSelectable | Qt::ItemIsEnabled );

@@ -558,8 +560,7 @@
     subWin->cancelHook();

     // hook annotation
-    QString annotationString
-        = cList->item( list[0]->row(), ANNOTATION_COLUMN )->text();
+    QString annotationString = annotations.at( list[0]->row() );
     if ( !annotationString.isEmpty() )
     {
         subWin->layoutWindow( frameGeometry() );
@@ -620,8 +621,7 @@
     int width = frame;
     // the size of the dummy column should be 0.
     for ( int i = 0; i < columnCount() - 1; i++ )
-        width += ( i != ANNOTATION_COLUMN ) ?
-            columnWidth( i ) : qMin( columnWidth( i ), MIN_CAND_WIDTH );
+        width += columnWidth( i );

     return QSize( width, rowHeight( 0 ) * rowNum + frame );
 }
=======================================
--- /trunk/qt4/immodule/candidatewindow.h       Sun Apr  4 20:35:54 2010
+++ /trunk/qt4/immodule/candidatewindow.h       Wed Apr 28 15:51:18 2010
@@ -107,6 +107,7 @@

     // candidate data
     QList<uim_candidate> stores;
+    QList<QString> annotations;
     int nrCandidates;
     int displayLimit;
     int candidateIndex;

Reply via email to