Author: ek.kato
Date: Sat Jan 17 01:01:47 2009
New Revision: 5728
Modified:
branches/1.5/qt/pref-customwidgets.cpp
branches/1.5/qt/pref-qt.cpp
branches/1.5/qt/pref-qt.h
Log:
* Port r5727 from trunk.
Modified: branches/1.5/qt/pref-customwidgets.cpp
==============================================================================
--- branches/1.5/qt/pref-customwidgets.cpp (original)
+++ branches/1.5/qt/pref-customwidgets.cpp Sat Jan 17 01:01:47 2009
@@ -258,7 +258,7 @@
//----------------------------------------------------------------------------------------
CustomChoiceCombo::CustomChoiceCombo( struct uim_custom *c, QWidget
*parent, const char *name)
- : QComboBox( parent, name ),
+ : QComboBox( FALSE, parent, name ),
UimCustomItemIface( c )
{
QObject::connect( this, SIGNAL(activated(int)),
Modified: branches/1.5/qt/pref-qt.cpp
==============================================================================
--- branches/1.5/qt/pref-qt.cpp (original)
+++ branches/1.5/qt/pref-qt.cpp Sat Jan 17 01:01:47 2009
@@ -65,6 +65,9 @@
#include <stdlib.h>
#include <locale.h>
+#define DEFAULT_WINDOW_WIDTH 800
+#define DEFAULT_WINDOW_HEIGHT 600
+
#define _FU8(String) QString::fromUtf8(String)
UimPrefDialog::UimPrefDialog( QWidget *parent, const char *name )
@@ -146,14 +149,14 @@
this, SLOT(slotSelectionChanged( QListViewItem * ))
);
/* Contents Frame */
- QWidget *rightSideWidget = new QWidget( mainSplitter );
- QVBoxLayout *rightVLayout = new QVBoxLayout( rightSideWidget );
- m_groupWidgetStack = new QWidgetStack( rightSideWidget );
- rightVLayout->setSpacing( 6 );
- rightVLayout->addWidget( m_groupWidgetStack );
+ QScrollView *rightSideWidget = new QScrollView( mainSplitter );
+ rightSideWidget->setResizePolicy(QScrollView::AutoOneFit);
+ m_groupWidgetStack = new QWidgetStack( rightSideWidget->viewport() );
+ rightSideWidget->addChild(m_groupWidgetStack);
/* Buttons */
QWidget *buttonHWidget = new QWidget( this );
+ buttonHWidget->setSizePolicy( QSizePolicy::Expanding,
QSizePolicy::Fixed);
QHBoxLayout *buttonHLayout = new QHBoxLayout( buttonHWidget );
buttonHLayout->setMargin( 6 );
buttonHLayout->setSpacing( 6 );
@@ -200,6 +203,9 @@
item = new QListViewItem( m_groupListView, _FU8(group->label)
);
GroupPageWidget *w = new GroupPageWidget( m_groupWidgetStack, *grp
);
+ if ( grp == primary_groups )
+ w->setupWidgets();
+
QObject::connect( w, SIGNAL(customValueChanged()),
this, SLOT(slotCustomValueChanged()) );
@@ -229,6 +235,7 @@
/* switch group widget */
QString grpname = item->text( 0 );
+ ((GroupPageWidget *)m_groupWidgetsDict[grpname])->setupWidgets();
m_groupWidgetStack->raiseWidget( m_groupWidgetsDict[grpname] );
#if 0
@@ -385,16 +392,20 @@
m_customIfaceList.clear();
m_customIfaceList.setAutoDelete( false );
- setupWidgets( group_name );
+ m_group_sym = group_name;
+ m_widget_created = false;
}
-void GroupPageWidget::setupWidgets( const char *group_name )
+void GroupPageWidget::setupWidgets()
{
+ if ( m_widget_created )
+ return;
+
QVBoxLayout *vLayout = new QVBoxLayout( this );
vLayout->setMargin( 6 );
vLayout->setSpacing( 3 );
- struct uim_custom_group *group = uim_custom_group_get( group_name );
+ struct uim_custom_group *group = uim_custom_group_get( (const char
*)m_group_sym );
if( group == NULL )
return;
@@ -434,7 +445,7 @@
uim_custom_symbol_list_free( custom_syms );
}
#else
- char **sub_groups = uim_custom_group_subgroups( group_name );
+ char **sub_groups = uim_custom_group_subgroups( (const char
*)m_group_sym );
char **sgrp;
for( sgrp = sub_groups; *sgrp; sgrp++ )
{
@@ -452,7 +463,7 @@
}
/* XXX quick hack to use AND expression of groups */
- QString groups( group_name );
+ QString groups( m_group_sym );
groups += " '";
groups += *sgrp;
char **custom_syms = uim_custom_collect_by_group( groups );
@@ -479,6 +490,8 @@
/* bottom up */
vLayout->addStretch();
+
+ m_widget_created = true;
}
/*
@@ -643,6 +656,7 @@
QApplication a( argc, argv );
UimPrefDialog *dlg = new UimPrefDialog();
+ dlg->resize( DEFAULT_WINDOW_WIDTH, DEFAULT_WINDOW_HEIGHT );
a.setMainWidget( dlg );
dlg->show();
Modified: branches/1.5/qt/pref-qt.h
==============================================================================
--- branches/1.5/qt/pref-qt.h (original)
+++ branches/1.5/qt/pref-qt.h Sat Jan 17 01:01:47 2009
@@ -45,6 +45,7 @@
#include <qvgroupbox.h>
#include <qmap.h>
#include <qptrlist.h>
+#include <qsplitter.h>
#include <uim/uim.h>
#include <uim/uim-custom.h>
@@ -116,9 +117,9 @@
GroupPageWidget( QWidget *parent, const char *group_name );
void setDefault();
+ void setupWidgets();
protected:
- void setupWidgets( const char *group_name );
UimCustomItemIface *addCustom( QVGroupBox *vbox, const char
*custom_sym );
UimCustomItemIface *addCustomTypeBool( QVGroupBox *vbox, struct
uim_custom *custom );
@@ -136,6 +137,8 @@
protected:
QPtrList<UimCustomItemIface> m_customIfaceList;
+ QString m_group_sym;
+ bool m_widget_created;
};
#endif /* Not def: UIM_QT_PREF_QT_H */