Revision: 6229
Author: nogu.dev
Date: Fri Mar 5 06:02:52 2010
Log: * qt4/immodule/candidatewindow.cpp
- (CandidateWindow::CandidateWindow, CandidateWindow::setPage,
CandidateWindow::updateLabel):
Add column for annotation only when eb-enable-for-annotation is #t.
* qt4/immodule/candidatewindow.h
- Add CandidateWindow::hasAnnotation.
http://code.google.com/p/uim/source/detail?r=6229
Modified:
/trunk/qt4/immodule/candidatewindow.cpp
/trunk/qt4/immodule/candidatewindow.h
=======================================
--- /trunk/qt4/immodule/candidatewindow.cpp Fri Mar 5 06:02:25 2010
+++ /trunk/qt4/immodule/candidatewindow.cpp Fri Mar 5 06:02:52 2010
@@ -39,6 +39,8 @@
#include <QtGui/QLabel>
#include <QtGui/QVBoxLayout>
+#include <uim/uim-scm.h>
+
#include "debug.h"
#include "quiminputcontext.h"
#include "subwindow.h"
@@ -61,7 +63,8 @@
CandidateWindow::CandidateWindow( QWidget *parent )
: QFrame( parent, candidateFlag ), nrCandidates( 0 ), displayLimit( 0 ),
candidateIndex( -1 ), pageIndex( -1 ), ic( 0 ), isAlwaysLeft( false ),
- subWin( 0 )
+ subWin( 0 ), hasAnnotation( uim_scm_symbol_value_bool(
+ "eb-enable-for-annotation?" ) == UIM_TRUE )
{
setFrameStyle( Raised | NoFrame );
@@ -70,7 +73,7 @@
cList->setSelectionMode( QAbstractItemView::SingleSelection );
cList->setSelectionBehavior( QAbstractItemView::SelectRows );
// the last column is dummy for adjusting size.
- cList->setColumnCount( 4 );
+ cList->setColumnCount( hasAnnotation ? 4 : 3 );
cList->horizontalHeader()->setResizeMode(
QHeaderView::ResizeToContents );
cList->horizontalHeader()->setStretchLastSection( true );
cList->horizontalHeader()->hide();
@@ -294,8 +297,10 @@
QString candString
= QString::fromUtf8( uim_candidate_get_cand_str( cand ) );
QString annotationString;
- // QString annotationString
- // = QString::fromUtf8( uim_candidate_get_annotation_str( cand
) );
+ // if ( hasAnnotation ) {
+ // annotationString
+ // = QString::fromUtf8( uim_candidate_get_annotation_str( cand
) );
+ // }
// insert new item to the candidate list
QTableWidgetItem *headItem = new QTableWidgetItem;
@@ -306,13 +311,18 @@
candItem->setText( candString );
candItem->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEnabled );
- QTableWidgetItem *annotationItem = new QTableWidgetItem;
- annotationItem->setText( annotationString );
- annotationItem->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEnabled
);
-
cList->setItem( i, HEADING_COLUMN, headItem );
cList->setItem( i, CANDIDATE_COLUMN, candItem );
- cList->setItem( i, ANNOTATION_COLUMN, annotationItem );
+
+ if ( hasAnnotation ) {
+ QTableWidgetItem *annotationItem = new QTableWidgetItem;
+ annotationItem->setText( annotationString );
+ annotationItem->setFlags(
+ Qt::ItemIsSelectable | Qt::ItemIsEnabled );
+
+ cList->setItem( i, ANNOTATION_COLUMN, annotationItem );
+ }
+
cList->setRowHeight( i, QFontMetrics( cList->font() ).height() + 2
);
}
@@ -453,7 +463,7 @@
void CandidateWindow::slotHookSubwindow()
{
- if ( !subWin )
+ if ( !hasAnnotation || !subWin )
return;
QList<QTableWidgetItem *> list = cList->selectedItems();
=======================================
--- /trunk/qt4/immodule/candidatewindow.h Wed Mar 3 05:56:07 2010
+++ /trunk/qt4/immodule/candidatewindow.h Fri Mar 5 06:02:52 2010
@@ -100,6 +100,8 @@
bool isAlwaysLeft;
SubWindow *subWin;
+
+ const bool hasAnnotation;
};