Merge pull request #150 from garakmon/speedup
Improve Combobox Speed & Autocompletion
This commit is contained in:
commit
e87d669e1d
3 changed files with 13 additions and 1 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,3 +1,4 @@
|
|||
Makefile
|
||||
porymap.pro.user
|
||||
*.autosave
|
||||
*.stash
|
||||
|
|
|
@ -206,7 +206,7 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="3">
|
||||
<widget class="QComboBox" name="comboBox_metatileBehaviors"/>
|
||||
<widget class="NoScrollComboBox" name="comboBox_metatileBehaviors"/>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
|
|
|
@ -1,10 +1,21 @@
|
|||
#include "noscrollcombobox.h"
|
||||
|
||||
#include <QCompleter>
|
||||
|
||||
NoScrollComboBox::NoScrollComboBox(QWidget *parent)
|
||||
: QComboBox(parent)
|
||||
{
|
||||
// Don't let scrolling hijack focus.
|
||||
setFocusPolicy(Qt::StrongFocus);
|
||||
|
||||
// Make speed a priority when loading comboboxes.
|
||||
setMinimumContentsLength(20);// an arbitrary limit
|
||||
setSizeAdjustPolicy(QComboBox::AdjustToMinimumContentsLength);
|
||||
|
||||
// Allow items to be searched by any part of the word, displaying all matches.
|
||||
setEditable(true);// can set to false manually when using
|
||||
this->completer()->setCompletionMode(QCompleter::PopupCompletion);
|
||||
this->completer()->setFilterMode(Qt::MatchContains);
|
||||
}
|
||||
|
||||
void NoScrollComboBox::wheelEvent(QWheelEvent *event)
|
||||
|
|
Loading…
Reference in a new issue