SearchWidget::SearchWidget(Window *window, QWidget *parent) : QComboBox(parent), m_window(NULL), m_completer(new QCompleter(this)), m_suggester(NULL), m_lastValidIndex(0), m_isIgnoringActivation(false), m_isPopupUpdated(false), m_shouldSelectAllOnRelease(false), m_wasPopupVisible(false) { m_completer->setCaseSensitivity(Qt::CaseInsensitive); m_completer->setCompletionMode(QCompleter::PopupCompletion); m_completer->setCompletionRole(Qt::DisplayRole); setEditable(true); setMinimumWidth(100); setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); setItemDelegate(new SearchDelegate(this)); setModel(SearchesManager::getSearchEnginesModel()); setInsertPolicy(QComboBox::NoInsert); optionChanged(QLatin1String("Search/SearchEnginesSuggestions"), SettingsManager::getValue(QLatin1String("Search/SearchEnginesSuggestions"))); lineEdit()->setCompleter(m_completer); lineEdit()->setDragEnabled(true); lineEdit()->setStyleSheet(QLatin1String("QLineEdit {background:transparent;}")); lineEdit()->installEventFilter(this); ToolBarWidget *toolBar = qobject_cast<ToolBarWidget*>(parent); if (toolBar && toolBar->getIdentifier() != ToolBarsManager::NavigationBar) { connect(toolBar, SIGNAL(windowChanged(Window*)), this, SLOT(setWindow(Window*))); }
CaptureFilterCombo::CaptureFilterCombo(QWidget *parent, bool plain) : QComboBox(parent), cf_edit_(NULL) { cf_edit_ = new CaptureFilterEdit(this, plain); setEditable(true); // Enabling autocompletion here gives us two simultaneous completions: // Inline (highlighted text) for entire filters, handled here and popup // completion for fields handled by CaptureFilterEdit. setAutoCompletion(false); setLineEdit(cf_edit_); setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed); setInsertPolicy(QComboBox::NoInsert); setAccessibleName(tr("Capture filter selector")); setStyleSheet( "QComboBox {" #ifdef Q_OS_MAC " border: 1px solid gray;" #else " border: 1px solid palette(shadow);" #endif " border-radius: 3px;" " padding: 0px 0px 0px 0px;" " margin-left: 0px;" " min-width: 20em;" " }" "QComboBox::drop-down {" " subcontrol-origin: padding;" " subcontrol-position: top right;" " width: 16px;" " border-left-width: 0px;" " }" "QComboBox::down-arrow {" " image: url(:/icons/toolbar/14x14/x-filter-dropdown.png);" " }" "QComboBox::down-arrow:on { /* shift the arrow when popup is open */" " top: 1px;" " left: 1px;" "}" ); connect(this, SIGNAL(interfacesChanged()), cf_edit_, SLOT(checkFilter())); connect(cf_edit_, SIGNAL(pushFilterSyntaxStatus(const QString&)), this, SIGNAL(pushFilterSyntaxStatus(const QString&))); connect(cf_edit_, SIGNAL(popFilterSyntaxStatus()), this, SIGNAL(popFilterSyntaxStatus())); connect(cf_edit_, SIGNAL(captureFilterSyntaxChanged(bool)), this, SIGNAL(captureFilterSyntaxChanged(bool))); connect(cf_edit_, SIGNAL(startCapture()), this, SIGNAL(startCapture())); connect(cf_edit_, SIGNAL(startCapture()), this, SLOT(saveAndRebuildFilterList())); connect(wsApp, SIGNAL(appInitialized()), this, SLOT(rebuildFilterList())); connect(wsApp, SIGNAL(preferencesChanged()), this, SLOT(rebuildFilterList())); rebuildFilterList(); clearEditText(); }
void KHistoryComboBox::init( bool useCompletion ) { // Set a default history size to something reasonable, Qt sets it to INT_MAX by default setMaxCount( 50 ); if ( useCompletion ) completionObject()->setOrder( KCompletion::Weighted ); setInsertPolicy( NoInsert ); d->myIterateIndex = -1; d->myRotated = false; d->myPixProvider = 0L; // obey HISTCONTROL setting QByteArray histControl = qgetenv("HISTCONTROL"); if ( histControl == "ignoredups" || histControl == "ignoreboth" ) setDuplicatesEnabled( false ); connect(this, SIGNAL(aboutToShowContextMenu(QMenu*)), SLOT(addContextMenuItems(QMenu*))); connect(this, SIGNAL(activated(int)), SLOT(slotReset())); connect(this, SIGNAL(returnPressed(QString)), SLOT(slotReset())); // We want slotSimulateActivated to be called _after_ QComboBoxPrivate::_q_returnPressed // otherwise there's a risk of emitting activated twice (slotSimulateActivated will find // the item, after some app's slotActivated inserted the item into the combo). connect(this, SIGNAL(returnPressed(QString)), SLOT(slotSimulateActivated(QString)), Qt::QueuedConnection); }
AutocompletingComboBox::AutocompletingComboBox(QWidget* parent) : QComboBox(parent) { setEditable(true); setInsertPolicy(QComboBox::NoInsert); completer()->setCompletionMode(QCompleter::PopupCompletion); connect(this, SIGNAL(currentIndexChanged(int)), this, SLOT(resetColor())); }
AddressWidget::AddressWidget(Window *window, QWidget *parent) : ComboBoxWidget(parent), m_window(nullptr), m_lineEdit(new LineEditWidget(this)), m_completionModel(new AddressCompletionModel(this)), m_completionView(nullptr), m_visibleView(nullptr), m_bookmarkLabel(nullptr), m_feedsLabel(nullptr), m_loadPluginsLabel(nullptr), m_urlIconLabel(nullptr), m_completionModes(NoCompletionMode), m_hints(WindowsManager::DefaultOpen), m_removeModelTimer(0), m_isHistoryDropdownEnabled(SettingsManager::getValue(SettingsManager::AddressField_EnableHistoryDropdownOption).toBool()), m_isNavigatingCompletion(false), m_isUsingSimpleMode(false), m_wasPopupVisible(false) { ToolBarWidget *toolBar(qobject_cast<ToolBarWidget*>(parent)); if (!toolBar) { m_isUsingSimpleMode = true; } setEditable(true); setLineEdit(m_lineEdit); setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); setMinimumWidth(100); setItemDelegate(new AddressDelegate(AddressDelegate::HistoryMode, this)); setInsertPolicy(QComboBox::NoInsert); setMouseTracking(true); setWindow(window); optionChanged(SettingsManager::AddressField_CompletionModeOption, SettingsManager::getValue(SettingsManager::AddressField_CompletionModeOption)); optionChanged(SettingsManager::AddressField_DropActionOption, SettingsManager::getValue(SettingsManager::AddressField_DropActionOption)); optionChanged(SettingsManager::AddressField_SelectAllOnFocusOption, SettingsManager::getValue(SettingsManager::AddressField_SelectAllOnFocusOption)); m_lineEdit->setStyleSheet(QLatin1String("QLineEdit {background:transparent;}")); m_lineEdit->installEventFilter(this); view()->installEventFilter(this); view()->viewport()->setAttribute(Qt::WA_Hover); view()->viewport()->setMouseTracking(true); view()->viewport()->installEventFilter(this); if (toolBar) { optionChanged(SettingsManager::AddressField_ShowBookmarkIconOption, SettingsManager::getValue(SettingsManager::AddressField_ShowBookmarkIconOption)); optionChanged(SettingsManager::AddressField_ShowFeedsIconOption, SettingsManager::getValue(SettingsManager::AddressField_ShowFeedsIconOption)); optionChanged(SettingsManager::AddressField_ShowUrlIconOption, SettingsManager::getValue(SettingsManager::AddressField_ShowUrlIconOption)); m_lineEdit->setPlaceholderText(tr("Enter address or search…")); connect(SettingsManager::getInstance(), SIGNAL(valueChanged(int,QVariant)), this, SLOT(optionChanged(int,QVariant))); if (toolBar->getIdentifier() != ToolBarsManager::NavigationBar) { connect(toolBar, SIGNAL(windowChanged(Window*)), this, SLOT(setWindow(Window*))); } }
CaptureFilterCombo::CaptureFilterCombo(QWidget *parent) : QComboBox(parent), cf_edit_(NULL) { cf_edit_ = new CaptureFilterEdit(); setEditable(true); setLineEdit(cf_edit_); setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed); setInsertPolicy(QComboBox::NoInsert); setAccessibleName(tr("Capture filter selector")); setStyleSheet( "QComboBox {" #ifdef Q_OS_MAC " border: 1px solid gray;" #else " border: 1px solid palette(shadow);" #endif " border-radius: 3px;" " padding: 0px 0px 0px 0px;" " margin-left: 0px;" " min-width: 20em;" " }" "QComboBox::drop-down {" " subcontrol-origin: padding;" " subcontrol-position: top right;" " width: 16px;" " border-left-width: 0px;" " }" "QComboBox::down-arrow {" " image: url(:/dfilter/dfilter_dropdown.png);" " }" "QComboBox::down-arrow:on { /* shift the arrow when popup is open */" " top: 1px;" " left: 1px;" "}" ); completer()->setCompletionMode(QCompleter::PopupCompletion); connect(this, SIGNAL(interfacesChanged()), cf_edit_, SLOT(checkFilter())); connect(cf_edit_, SIGNAL(pushFilterSyntaxStatus(QString&)), this, SIGNAL(pushFilterSyntaxStatus(QString&))); connect(cf_edit_, SIGNAL(popFilterSyntaxStatus()), this, SIGNAL(popFilterSyntaxStatus())); connect(cf_edit_, SIGNAL(captureFilterSyntaxChanged(bool)), this, SIGNAL(captureFilterSyntaxChanged(bool))); connect(cf_edit_, SIGNAL(startCapture()), this, SIGNAL(startCapture())); connect(cf_edit_, SIGNAL(startCapture()), this, SLOT(rebuildFilterList())); connect(wsApp, SIGNAL(appInitialized()), this, SLOT(rebuildFilterList())); connect(wsApp, SIGNAL(preferencesChanged()), this, SLOT(rebuildFilterList())); rebuildFilterList(false); clearEditText(); }
void ComboBox::setupLineEdit() { setInsertPolicy(QComboBox::NoInsert); setLineEdit(new QLineEdit(this)); QCompleter *currentCompleter = completer(); currentCompleter->setCompletionMode(QCompleter::PopupCompletion); currentCompleter->setCaseSensitivity(Qt::CaseSensitive); }
WindowSelectComboBox::WindowSelectComboBox(QWidget* parent) : QComboBox(parent) { setEditable(true); setInsertPolicy(QComboBox::NoInsert); setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed, QSizePolicy::ComboBox)); // first item is always the current content of the line edit insertItem(0, ""); }
QgsScaleComboBox::QgsScaleComboBox( QWidget* parent ) : QComboBox( parent ), mScale( 1.0 ) { updateScales(); setEditable( true ); setInsertPolicy( QComboBox::NoInsert ); setCompleter( 0 ); connect( this, SIGNAL( activated( const QString & ) ), this, SLOT( fixupScale() ) ); connect( lineEdit(), SIGNAL( editingFinished() ), this, SLOT( fixupScale() ) ); fixupScale(); }
void TComboBoxModelRecord::setEditable ( bool editable ) { editable_=editable; QComboBox::setEditable(editable); setCompleter(0); setInsertPolicy( QComboBox::NoInsert ); m=NULL; lstview = new QListView; lstview->installEventFilter( this ); setView( lstview ); }
QgsScaleComboBox::QgsScaleComboBox( QWidget *parent ) : QComboBox( parent ) { updateScales(); setEditable( true ); setInsertPolicy( QComboBox::NoInsert ); setCompleter( nullptr ); connect( this, static_cast<void ( QComboBox::* )( const QString & )>( &QComboBox::activated ), this, &QgsScaleComboBox::fixupScale ); connect( lineEdit(), &QLineEdit::editingFinished, this, &QgsScaleComboBox::fixupScale ); fixupScale(); }
AddressWidget::AddressWidget(Window *window, QWidget *parent) : QComboBox(parent), m_window(NULL), m_completer(new QCompleter(AddressCompletionModel::getInstance(), this)), m_bookmarkLabel(NULL), m_feedsLabel(NULL), m_loadPluginsLabel(NULL), m_urlIconLabel(NULL), m_removeModelTimer(0), m_isHistoryDropdownEnabled(SettingsManager::getValue(QLatin1String("AddressField/EnableHistoryDropdown")).toBool()), m_isUsingSimpleMode(false), m_shouldSelectAllOnRelease(false), m_wasPopupVisible(false) { ToolBarWidget *toolBar = qobject_cast<ToolBarWidget*>(parent); if (!toolBar) { m_isUsingSimpleMode = true; } m_completer->setCaseSensitivity(Qt::CaseInsensitive); m_completer->setCompletionMode(QCompleter::InlineCompletion); m_completer->setCompletionRole(Qt::DisplayRole); m_completer->setFilterMode(Qt::MatchStartsWith); setEditable(true); setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); setMinimumWidth(100); setItemDelegate(new AddressDelegate(this)); setInsertPolicy(QComboBox::NoInsert); setWindow(window); lineEdit()->setCompleter(m_completer); lineEdit()->setDragEnabled(true); lineEdit()->setStyleSheet(QLatin1String("QLineEdit {background:transparent;}")); lineEdit()->setMouseTracking(true); lineEdit()->installEventFilter(this); if (toolBar) { optionChanged(QLatin1String("AddressField/ShowBookmarkIcon"), SettingsManager::getValue(QLatin1String("AddressField/ShowBookmarkIcon"))); optionChanged(QLatin1String("AddressField/ShowUrlIcon"), SettingsManager::getValue(QLatin1String("AddressField/ShowUrlIcon"))); lineEdit()->setPlaceholderText(tr("Enter address or search…")); connect(SettingsManager::getInstance(), SIGNAL(valueChanged(QString,QVariant)), this, SLOT(optionChanged(QString,QVariant))); if (toolBar->getIdentifier() != ToolBarsManager::NavigationBar) { connect(toolBar, SIGNAL(windowChanged(Window*)), this, SLOT(setWindow(Window*))); } }
UIFilePathSelector::UIFilePathSelector(QWidget *pParent /* = 0 */) : QIWithRetranslateUI<QComboBox>(pParent) , m_enmMode(Mode_Folder) , m_strHomeDir(QDir::current().absolutePath()) , m_fEditable(true) , m_fModified(false) , m_fEditableMode(false) , m_fMouseAwaited(false) , m_fToolTipOverriden(false) , m_pCopyAction(new QAction(this)) { #ifdef VBOX_WS_WIN // WORKAROUND: // On at least Windows host there is a bug with // the QListView which doesn't take into account // the item size change caused by assigning item's // icon of another size or unassigning icon at all. if (view()->inherits("QListView")) qobject_cast<QListView*>(view())->setUniformItemSizes(true); #endif /* VBOX_WS_WIN */ /* Populate items: */ insertItem(PathId, ""); insertItem(SelectId, ""); insertItem(ResetId, ""); /* Attaching known icons: */ setItemIcon(SelectId, UIIconPool::iconSet(":/select_file_16px.png")); setItemIcon(ResetId, UIIconPool::iconSet(":/eraser_16px.png")); /* Setup context menu: */ addAction(m_pCopyAction); m_pCopyAction->setShortcut(QKeySequence(QKeySequence::Copy)); m_pCopyAction->setShortcutContext(Qt::WidgetShortcut); /* Initial setup: */ setInsertPolicy(QComboBox::NoInsert); setContextMenuPolicy(Qt::ActionsContextMenu); setMinimumWidth(200); /* Setup connections: */ connect(this, SIGNAL(activated(int)), this, SLOT(onActivated(int))); connect(m_pCopyAction, SIGNAL(triggered(bool)), this, SLOT(copyToClipboard())); /* Editable by default: */ setEditable(true); /* Applying language settings: */ retranslateUi(); }
VBoxDbgConsoleInput::VBoxDbgConsoleInput(QWidget *pParent/* = NULL*/, const char *pszName/* = NULL*/) : QComboBox(pParent), m_hGUIThread(RTThreadNativeSelf()) { addItem(""); /* invariant: empty command line is the last item */ setEditable(true); setInsertPolicy(NoInsert); setAutoCompletion(false); setMaxCount(50); const QLineEdit *pEdit = lineEdit(); if (pEdit) connect(pEdit, SIGNAL(returnPressed()), this, SLOT(returnPressed())); NOREF(pszName); }
DepthComboBox::DepthComboBox( QWidget * parent) : QComboBox(parent) { // Add the bedrock and specify depth items addItem(tr("Specify depth...")); addItem(tr("Bedrock")); // Set the insert policy to that "specify depth..." is over-written setInsertPolicy(InsertAtCurrent); setValidator(new QDoubleValidator(this)); setCurrentIndex(-1); connect( this, SIGNAL(currentIndexChanged(int)), SLOT(updateEditable(int))); connect( this, SIGNAL(editTextChanged(QString)), SLOT(toDouble(QString))); }
MyQComboBox::MyQComboBox(QWidget *parent) : QComboBox(parent) { setEditable(false); setMaxVisibleItems(1); setInsertPolicy(QComboBox::NoInsert); _menu = new QMenu(this); QWidget * basicEditor = new QFrame(this); QFormLayout * formLayout = new QFormLayout(basicEditor); basicEditor->setLayout(formLayout); QLineEdit * input = new QLineEdit(basicEditor); formLayout->addRow("Text", input); QWidgetAction * pickerAction = new QWidgetAction(this); pickerAction->setDefaultWidget(basicEditor); _menu->addAction(pickerAction); }
KonqCombo::KonqCombo( QWidget *parent ) : KHistoryComboBox( parent ), m_returnPressed( false ), m_permanent( false ), m_pageSecurity( KonqMainWindow::NotCrypted ) { setLayoutDirection(Qt::LeftToRight); setInsertPolicy( NoInsert ); setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed )); setSizeAdjustPolicy( QComboBox::AdjustToMinimumContentsLength ); Q_ASSERT( s_config ); KConfigGroup locationBarGroup( s_config, "Location Bar" ); setMaxCount( locationBarGroup.readEntry("Maximum of URLs in combo", 20 )); // We should also connect the completionBox' highlighted signal to // our setEditText() slot, because we're handling the signals ourselves. // But we're lazy and let KCompletionBox do this and simply switch off // handling of signals later. setHandleSignals( true ); KonqComboLineEdit *edit = new KonqComboLineEdit( this ); edit->setHandleSignals( true ); edit->setCompletionBox( new KonqComboCompletionBox( edit ) ); setLineEdit( edit ); setItemDelegate( new KonqComboItemDelegate( this ) ); connect( edit, SIGNAL(textEdited(QString)), this, SLOT(slotTextEdited(QString)) ); completionBox()->setTabHandling(true); // #167135 completionBox()->setItemDelegate( new KonqComboItemDelegate( this ) ); // Make the lineedit consume the Qt::Key_Enter event... setTrapReturnKey( true ); connect( KonqHistoryManager::kself(), SIGNAL(cleared()), SLOT(slotCleared()) ); connect( this, SIGNAL(cleared()), SLOT(slotCleared()) ); connect( this, SIGNAL(highlighted(int)), SLOT(slotSetIcon(int)) ); connect( this, SIGNAL(activated(QString)), SLOT(slotActivated(QString)) ); }
CodeComboBox::CodeComboBox(QWidget *parent) : QComboBox(parent) { setModel(new CodeComboBoxModel(this)); setItemDelegate(new CodeComboBoxDelegate(this)); CodeLineEdit *codeLineEdit = new CodeLineEdit(parent); codeLineEdit->setEmbedded(true); setLineEdit(codeLineEdit); setEditable(true); setInsertPolicy(QComboBox::NoInsert); connect(codeLineEdit, SIGNAL(codeChanged(bool)), this, SIGNAL(codeChanged(bool))); addActions(codeLineEdit->actions()); setMinimumWidth(sizeHint().width() + codeLineEdit->codeButton()->maximumWidth() + codeLineEdit->editorButton()->maximumWidth() + 50); }
/*! Constructs a new QxtCheckComboBox with \a parent. */ QxtCheckComboBox::QxtCheckComboBox(QWidget* parent) : QComboBox(parent) { QXT_INIT_PRIVATE(QxtCheckComboBox); setModel(new QxtCheckComboModel(this)); connect(this, SIGNAL(activated(int)), &qxt_d(), SLOT(toggleCheckState(int))); connect(model(), SIGNAL(checkStateChanged()), &qxt_d(), SLOT(updateCheckedItems())); connect(model(), SIGNAL(rowsInserted(const QModelIndex &, int, int)), &qxt_d(), SLOT(updateCheckedItems())); connect(model(), SIGNAL(rowsRemoved(const QModelIndex &, int, int)), &qxt_d(), SLOT(updateCheckedItems())); // read-only contents QLineEdit* lineEdit = new QLineEdit(this); lineEdit->setReadOnly(true); setLineEdit(lineEdit); setInsertPolicy(QComboBox::NoInsert); view()->installEventFilter(&qxt_d()); view()->window()->installEventFilter(&qxt_d()); view()->viewport()->installEventFilter(&qxt_d()); this->installEventFilter(&qxt_d()); }
ComboBoxChoiceFieldWidget::ComboBoxChoiceFieldWidget(QMutex* mutex, Poppler::FormFieldChoice* formField, QWidget* parent) : QComboBox(parent), m_mutex(mutex), m_formField(formField) { LOCK_FORM_FIELD addItems(m_formField->choices()); if(!m_formField->currentChoices().isEmpty()) { setCurrentIndex(m_formField->currentChoices().first()); } connect(this, SIGNAL(currentIndexChanged(int)), SLOT(on_currentIndexChanged(int))); connect(this, SIGNAL(currentIndexChanged(int)), SIGNAL(wasModified())); #ifdef HAS_POPPLER_22 if(m_formField->isEditable()) { setEditable(true); setInsertPolicy(QComboBox::NoInsert); lineEdit()->setText(m_formField->editChoice()); connect(lineEdit(), SIGNAL(textChanged(QString)), SLOT(on_currentTextChanged(QString))); connect(lineEdit(), SIGNAL(textChanged(QString)), SIGNAL(wasModified())); connect(lineEdit(), SIGNAL(returnPressed()), SLOT(hide())); } else { connect(this, SIGNAL(activated(int)), SLOT(hide())); } #else connect(this, SIGNAL(activated(int)), SLOT(hide())); #endif // HAS_POPPLER_22 }
/*! Constructs a new QxtCheckComboBox with \a parent. */ QxtCheckComboBox::QxtCheckComboBox(QWidget* parent) : QComboBox(parent), m_containerMousePress(false) { setModel(new QxtCheckComboModel(this)); connect(this, SIGNAL(activated(int)), this, SLOT(toggleCheckState(int))); connect(model(), SIGNAL(checkStateChanged()), this, SLOT(updateCheckedItems())); connect(model(), SIGNAL(rowsInserted(const QModelIndex &, int, int)), this, SLOT(updateCheckedItems())); connect(model(), SIGNAL(rowsRemoved(const QModelIndex &, int, int)), this, SLOT(updateCheckedItems())); // read-only contents QLineEdit* lineEdit = new QLineEdit(this); lineEdit->setReadOnly(true); setLineEdit(lineEdit); lineEdit->disconnect(this); setInsertPolicy(QComboBox::NoInsert); view()->installEventFilter(this); view()->window()->installEventFilter(this); view()->viewport()->installEventFilter(this); this->installEventFilter(this); m_separator = QLatin1String(","); }
/****************************************************************************** * Constructs the widget. ******************************************************************************/ SceneNodeSelectionBox::SceneNodeSelectionBox(DataSetContainer& datasetContainer, QWidget* parent) : QComboBox(parent), _datasetContainer(datasetContainer) { // Set the list model, which tracks the scene nodes. setModel(new SceneNodesListModel(datasetContainer, this)); setInsertPolicy(QComboBox::NoInsert); setEditable(false); setMinimumContentsLength(25); setSizeAdjustPolicy(QComboBox::AdjustToMinimumContentsLengthWithIcon); setToolTip(tr("Object Selector")); // Listen for selection changes. connect(&datasetContainer, &DataSetContainer::selectionChangeComplete, this, &SceneNodeSelectionBox::onSceneSelectionChanged); connect(model(), &SceneNodesListModel::modelReset, this, &SceneNodeSelectionBox::onSceneSelectionChanged); connect(model(), &SceneNodesListModel::modelReset, this, &SceneNodeSelectionBox::onNodeCountChanged); connect(model(), &SceneNodesListModel::rowsRemoved, this, &SceneNodeSelectionBox::onNodeCountChanged); connect(model(), &SceneNodesListModel::rowsInserted, this, &SceneNodeSelectionBox::onNodeCountChanged); connect(this, (void (QComboBox::*)(int))&QComboBox::activated, this, &SceneNodeSelectionBox::onItemActivated); onNodeCountChanged(); }
CustomComboBox::CustomComboBox(QWidget* parent, QListWidget* viewWidget, QObject* filterObject) : QComboBox(parent) { containerMousePress = false; if (viewWidget && viewWidget->model()) { setModel(viewWidget->model()); setView(viewWidget); } QLineEdit* lineEdit = new QLineEdit(this); lineEdit->setReadOnly(true); setLineEdit(lineEdit); lineEdit->disconnect(this); setSizeAdjustPolicy(QComboBox::AdjustToContents); setInsertPolicy(QComboBox::NoInsert); installEventFilter(filterObject); view()->installEventFilter(filterObject); view()->window()->installEventFilter(filterObject); view()->viewport()->installEventFilter(filterObject); }
HistoryComboBox::HistoryComboBox(QWidget *parent): QComboBox(parent) { setInsertPolicy(QComboBox::InsertAtTop); setMaxCount(10); }
int QComboBox::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QWidget::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { if (_id < 24) qt_static_metacall(this, _c, _id, _a); _id -= 24; } #ifndef QT_NO_PROPERTIES else if (_c == QMetaObject::ReadProperty) { void *_v = _a[0]; switch (_id) { case 0: *reinterpret_cast< bool*>(_v) = isEditable(); break; case 1: *reinterpret_cast< int*>(_v) = count(); break; case 2: *reinterpret_cast< QString*>(_v) = currentText(); break; case 3: *reinterpret_cast< int*>(_v) = currentIndex(); break; case 4: *reinterpret_cast< int*>(_v) = maxVisibleItems(); break; case 5: *reinterpret_cast< int*>(_v) = maxCount(); break; case 6: *reinterpret_cast< InsertPolicy*>(_v) = insertPolicy(); break; case 7: *reinterpret_cast< SizeAdjustPolicy*>(_v) = sizeAdjustPolicy(); break; case 8: *reinterpret_cast< int*>(_v) = minimumContentsLength(); break; case 9: *reinterpret_cast< QSize*>(_v) = iconSize(); break; case 10: *reinterpret_cast< bool*>(_v) = autoCompletion(); break; case 11: *reinterpret_cast< Qt::CaseSensitivity*>(_v) = autoCompletionCaseSensitivity(); break; case 12: *reinterpret_cast< bool*>(_v) = duplicatesEnabled(); break; case 13: *reinterpret_cast< bool*>(_v) = hasFrame(); break; case 14: *reinterpret_cast< int*>(_v) = modelColumn(); break; } _id -= 15; } else if (_c == QMetaObject::WriteProperty) { void *_v = _a[0]; switch (_id) { case 0: setEditable(*reinterpret_cast< bool*>(_v)); break; case 3: setCurrentIndex(*reinterpret_cast< int*>(_v)); break; case 4: setMaxVisibleItems(*reinterpret_cast< int*>(_v)); break; case 5: setMaxCount(*reinterpret_cast< int*>(_v)); break; case 6: setInsertPolicy(*reinterpret_cast< InsertPolicy*>(_v)); break; case 7: setSizeAdjustPolicy(*reinterpret_cast< SizeAdjustPolicy*>(_v)); break; case 8: setMinimumContentsLength(*reinterpret_cast< int*>(_v)); break; case 9: setIconSize(*reinterpret_cast< QSize*>(_v)); break; case 10: setAutoCompletion(*reinterpret_cast< bool*>(_v)); break; case 11: setAutoCompletionCaseSensitivity(*reinterpret_cast< Qt::CaseSensitivity*>(_v)); break; case 12: setDuplicatesEnabled(*reinterpret_cast< bool*>(_v)); break; case 13: setFrame(*reinterpret_cast< bool*>(_v)); break; case 14: setModelColumn(*reinterpret_cast< int*>(_v)); break; } _id -= 15; } else if (_c == QMetaObject::ResetProperty) { _id -= 15; } else if (_c == QMetaObject::QueryPropertyDesignable) { _id -= 15; } else if (_c == QMetaObject::QueryPropertyScriptable) { _id -= 15; } else if (_c == QMetaObject::QueryPropertyStored) { _id -= 15; } else if (_c == QMetaObject::QueryPropertyEditable) { _id -= 15; } else if (_c == QMetaObject::QueryPropertyUser) { _id -= 15; } #endif // QT_NO_PROPERTIES return _id; }