[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-core-devel
Subject: Patch: Replace combo box by list box in KInputDialog::getItem
From: Cornelius Schumacher <schumacher () kde ! org>
Date: 2003-09-11 8:43:44
[Download RAW message or body]
The attached patch changes KInputDialog wo use a list box instead of a combo
box when selecting from a list of items. This saves the mouse click to open
the combo box. Any objections?
--
Cornelius Schumacher <schumacher@kde.org>
["getitem.diff" (text/x-diff)]
Index: kinputdialog.cpp
===================================================================
RCS file: /home/kde/kdelibs/kdeui/kinputdialog.cpp,v
retrieving revision 1.4
diff -u -p -r1.4 kinputdialog.cpp
--- kinputdialog.cpp 7 Jun 2003 17:26:12 -0000 1.4
+++ kinputdialog.cpp 11 Sep 2003 08:40:46 -0000
@@ -146,22 +146,29 @@ KInputDialog::KInputDialog( const QStrin
d->m_label = new QLabel( label, frame );
layout->addWidget( d->m_label );
- d->m_comboBox = new KComboBox( editable, frame );
- d->m_comboBox->insertStringList( list );
- d->m_comboBox->setCurrentItem( current );
- layout->addWidget( d->m_comboBox );
-
- layout->addStretch();
-
if ( editable )
{
+ d->m_comboBox = new KComboBox( editable, frame );
+ d->m_comboBox->insertStringList( list );
+ d->m_comboBox->setCurrentItem( current );
+ layout->addWidget( d->m_comboBox );
+
connect( d->m_comboBox, SIGNAL( textChanged( const QString & ) ),
SLOT( slotUpdateButtons( const QString & ) ) );
connect( this, SIGNAL( user1Clicked() ),
d->m_comboBox, SLOT( clearEdit() ) );
+
+ d->m_comboBox->setFocus();
+ } else {
+ d->m_listBox = new KListBox( frame );
+ d->m_listBox->insertStringList( list );
+ d->m_listBox->setSelected( current, true );
+ d->m_listBox->ensureCurrentVisible();
+ layout->addWidget( d->m_listBox );
}
- d->m_comboBox->setFocus();
+ layout->addStretch();
+
setMinimumWidth( 320 );
}
@@ -313,7 +320,10 @@ QString KInputDialog::getItem( const QSt
QString result;
if ( _ok )
- result = dlg->comboBox()->currentText();
+ if ( editable )
+ result = dlg->comboBox()->currentText();
+ else
+ result = dlg->listBox()->currentText();
delete dlg;
return result;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic