Revision: 7167
Author: nogu.dev
Date: Thu Jun 30 09:47:20 2011
Log: * qt4/immodule/subwindow.cpp
- (SubWindow::layoutWindow): Add support for horizontal candidate window.
* qt4/immodule/subwindow.h
- (SubWindow::layoutWindow): Ditto.
* qt4/immodule/candidatewindow.cpp
- (CandidateWindow::slotHookSubwindow, CandidateWindow::moveEvent,
CandidateWindow::resizeEvent): Follow API change.
http://code.google.com/p/uim/source/detail?r=7167
Modified:
/trunk/qt4/immodule/candidatewindow.cpp
/trunk/qt4/immodule/subwindow.cpp
/trunk/qt4/immodule/subwindow.h
=======================================
--- /trunk/qt4/immodule/candidatewindow.cpp Thu Jun 30 09:46:49 2011
+++ /trunk/qt4/immodule/candidatewindow.cpp Thu Jun 30 09:47:20 2011
@@ -254,7 +254,7 @@
QString annotationString
= annotations.at( isVertical ? list[0]->row() : list[0]->column()
);
if ( !annotationString.isEmpty() ) {
- subWin->layoutWindow( frameGeometry() );
+ subWin->layoutWindow( frameGeometry(), isVertical );
subWin->hookPopup( annotationString );
}
}
@@ -264,14 +264,14 @@
{
// move subwindow
if ( subWin )
- subWin->layoutWindow( QRect( e->pos(), size() ) );
+ subWin->layoutWindow( QRect( e->pos(), size() ), isVertical );
}
void CandidateWindow::resizeEvent( QResizeEvent *e )
{
// move subwindow
if ( subWin )
- subWin->layoutWindow( QRect( pos(), e->size() ) );
+ subWin->layoutWindow( QRect( pos(), e->size() ), isVertical );
}
void CandidateWindow::hideEvent( QHideEvent *event )
=======================================
--- /trunk/qt4/immodule/subwindow.cpp Thu Jan 6 18:09:56 2011
+++ /trunk/qt4/immodule/subwindow.cpp Thu Jun 30 09:47:20 2011
@@ -101,21 +101,37 @@
popup();
}
-void SubWindow::layoutWindow( const QRect &rect )
+void SubWindow::layoutWindow( const QRect &rect, bool isVertical )
{
const QRect screenRect = QApplication::desktop()->screenGeometry();
const int w = width();
const int candX = rect.x();
- int destX = candX + rect.width();
- if ( destX + w > screenRect.width() )
- destX = candX - w;
+ const int screenW = screenRect.width();
+ int destX;
+ if ( isVertical ) {
+ destX = candX + rect.width();
+ if ( destX + w > screenW )
+ destX = candX - w;
+ } else {
+ destX = candX;
+ if ( destX + w > screenW )
+ destX = screenW - w;
+ }
const int h = height();
+ const int candY = rect.y();
const int screenH = screenRect.height();
- int destY = rect.y();
- if ( destY + h > screenH )
- destY = screenH - h;
+ int destY;
+ if ( isVertical ) {
+ destY = candY;
+ if ( destY + h > screenH )
+ destY = screenH - h;
+ } else {
+ destY = candY + rect.height();
+ if ( destY + h > screenH )
+ destY = candY - h;
+ }
move( destX, destY );
}
=======================================
--- /trunk/qt4/immodule/subwindow.h Thu Jan 6 18:09:56 2011
+++ /trunk/qt4/immodule/subwindow.h Thu Jun 30 09:47:20 2011
@@ -46,7 +46,7 @@
explicit SubWindow( QWidget *parent = 0 );
~SubWindow();
- void layoutWindow( const QRect &rect );
+ void layoutWindow( const QRect &rect, bool isVertical );
bool isHooked()
{