Revision: 6536
Author: nogu.dev
Date: Mon Jul 19 01:40:04 2010
Log: * qt4/immodule/candidatetablewindow.cpp
- (CandidateTableWindow::CandidateTableWindow): Add lLayout and rLayout
to member variables of CandidateTableWindow.
- (CandidateTableWindow::sizeHint): New function.
- (CandidateTableWindow::slotCandidateClicked): Adjust size.
* qt4/immodule/candidatetablewindow.h
- (CandidateTableWindow): Declare CandidateTableWindow::sizeHint().
http://code.google.com/p/uim/source/detail?r=6536
Modified:
/trunk/qt4/immodule/candidatetablewindow.cpp
/trunk/qt4/immodule/candidatetablewindow.h
=======================================
--- /trunk/qt4/immodule/candidatetablewindow.cpp Mon Jul 19 01:39:54 2010
+++ /trunk/qt4/immodule/candidatetablewindow.cpp Mon Jul 19 01:40:04 2010
@@ -74,8 +74,8 @@
{
initTable();
- QGridLayout *lLayout = createLayout(A_HEIGHT, L_WIDTH, 0, 0);
- QGridLayout *rLayout = createLayout(A_HEIGHT, R_WIDTH, 0, L_WIDTH);
+ lLayout = createLayout(A_HEIGHT, L_WIDTH, 0, 0);
+ rLayout = createLayout(A_HEIGHT, R_WIDTH, 0, L_WIDTH);
aLayout = createLayout(A_HEIGHT, A_WIDTH, 0, L_WIDTH + R_WIDTH);
lsLayout = createLayout(AS_HEIGHT, L_WIDTH, A_HEIGHT, 0);
rsLayout = createLayout(AS_HEIGHT, R_WIDTH, A_HEIGHT, L_WIDTH);
@@ -105,6 +105,37 @@
if (table != DEFAULT_TABLE)
free(table);
}
+
+QSize CandidateTableWindow::sizeHint() const
+{
+ QRect lRect = lLayout->geometry();
+ QRect lSpacerRect = lLayout->cellRect(A_HEIGHT, L_WIDTH);
+
+ // height
+ // numLabel + lLayout
+ int height = numLabel->height()
+ + lRect.height() - lSpacerRect.height();
+ if (lsLayout->isEnabled()) {
+ // lsLayout
+ height += lsLayout->geometry().height()
+ - lsLayout->cellRect(AS_HEIGHT, 0).height()
+ + BLOCK_SPACING - 2 * HOMEPOSITION_SPACING;
+ }
+
+ // width
+ // lLayout + rLayout
+ int width = lRect.width() - lSpacerRect.width()
+ + rLayout->geometry().width() - rLayout->cellRect(0,
R_WIDTH).width()
+ + BLOCK_SPACING - 2 * HOMEPOSITION_SPACING;
+ if (aLayout->isEnabled()) {
+ // aLayout
+ width += aLayout->geometry().width()
+ - aLayout->cellRect(0, A_WIDTH).width()
+ + BLOCK_SPACING - 2 * HOMEPOSITION_SPACING;
+ }
+
+ return QSize(width, height);
+}
void CandidateTableWindow::slotCandidateClicked(int index)
{
@@ -266,6 +297,9 @@
setBlockVisible(asLayout, hasBlockAs || (hasBlockA && hasBlockLrs));
setBlockVisible(lsLayout, hasBlockLrs || hasBlockAs);
setBlockVisible(rsLayout, hasBlockLrs || hasBlockAs);
+
+ setMaximumSize(sizeHint());
+ setMinimumSize(QSize(0, 0));
}
void CandidateTableWindow::setIndex(int totalIndex)
=======================================
--- /trunk/qt4/immodule/candidatetablewindow.h Sat Jul 17 22:32:00 2010
+++ /trunk/qt4/immodule/candidatetablewindow.h Mon Jul 19 01:40:04 2010
@@ -52,6 +52,8 @@
explicit CandidateTableWindow(QWidget *parent);
~CandidateTableWindow();
+ QSize sizeHint() const;
+
private slots:
void slotCandidateClicked(int index);
@@ -66,6 +68,8 @@
void getPosition(int &row, int &column,
const QString &headString);
+ QGridLayout *lLayout;
+ QGridLayout *rLayout;
QGridLayout *lsLayout;
QGridLayout *rsLayout;
QGridLayout *aLayout;