void TreeViewLineEditComboBox::installLineEdit() { if (!m_comboLineEdit) { setLineEdit(new TreeViewComboBoxLineEdit(this)); } }
void ChoiceSearchComboBox::installView(QAbstractItemView* v) { // make protected again ListViewComboBox::installView(v); //view()->setHeaderHidden(true); view()->setAlternatingRowColors(true); // create the label m_label = new DSqueezedClickLabel; m_label->setElideMode(Qt::ElideRight); // set a line edit that carries the label ProxyClickLineEdit* const lineEdit = new ProxyClickLineEdit; lineEdit->setCursor(m_label->cursor()); lineEdit->setWidget(m_label); setLineEdit(lineEdit); // connect clicks on upper area (both line edit and widget within) to showPopup connect(lineEdit, SIGNAL(leftClicked()), this, SLOT(labelClicked())); connect(m_label, SIGNAL(activated()), this, SLOT(labelClicked())); }
SearchWidget::SearchWidget(Window *window, QWidget *parent) : QComboBox(parent), m_window(NULL), m_lineEdit(new LineEditWidget(this)), m_completer(new QCompleter(this)), m_suggester(NULL), m_lastValidIndex(0), m_isIgnoringActivation(false), m_isPopupUpdated(false), m_wasPopupVisible(false) { m_completer->setCaseSensitivity(Qt::CaseInsensitive); m_completer->setCompletionMode(QCompleter::PopupCompletion); m_completer->setCompletionRole(Qt::DisplayRole); setEditable(true); setLineEdit(m_lineEdit); setMinimumWidth(100); setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); setItemDelegate(new SearchDelegate(this)); setModel(SearchesManager::getSearchEnginesModel()); setInsertPolicy(QComboBox::NoInsert); optionChanged(QLatin1String("AddressField/DropAction"), SettingsManager::getValue(QLatin1String("AddressField/DropAction"))); optionChanged(QLatin1String("AddressField/SelectAllOnFocus"), SettingsManager::getValue(QLatin1String("AddressField/SelectAllOnFocus"))); optionChanged(QLatin1String("Search/SearchEnginesSuggestions"), SettingsManager::getValue(QLatin1String("Search/SearchEnginesSuggestions"))); m_lineEdit->setCompleter(m_completer); m_lineEdit->setStyleSheet(QLatin1String("QLineEdit {background:transparent;}")); ToolBarWidget *toolBar = qobject_cast<ToolBarWidget*>(parent); if (toolBar && toolBar->getIdentifier() != ToolBarsManager::NavigationBar) { connect(toolBar, SIGNAL(windowChanged(Window*)), this, SLOT(setWindow(Window*))); }
RatingComboBox::RatingComboBox(QWidget* const parent) : ModelIndexBasedComboBox(parent) { m_syncing = false; // create a custom model that contains the rating values m_model = new RatingComboBoxModel(this); setModel(m_model); // set a custom delegate which draws rating stars RatingComboBoxDelegate* delegate = new RatingComboBoxDelegate(this); view()->setItemDelegate(delegate); // set a line edit that carries a RatingWidget ProxyLineEdit* lineEdit = new ProxyLineEdit; m_ratingWidget = new RatingComboBoxWidget; lineEdit->setWidget(m_ratingWidget); setLineEdit(lineEdit); connect(view()->selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)), this, SLOT(currentValueChanged(QModelIndex,QModelIndex))); connect(m_ratingWidget, SIGNAL(ratingValueChanged(int)), this, SLOT(ratingWidgetChanged(int))); }
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*))); } }
NifCheckBoxList::NifCheckBoxList( QWidget *widget /*= 0*/ ) : CheckBoxList(widget) { // Make editable NifCheckListBoxEditor *edit = new NifCheckListBoxEditor(this); validator = new NifCheckBoxListValidator(edit); edit->setValidator(validator); setLineEdit(edit); // set delegate items view view()->setItemDelegate(new CheckBoxListDelegate(this)); // Enable editing on items view view()->setEditTriggers(QAbstractItemView::CurrentChanged); // set "CheckBoxList::eventFilter" as event filter for items view view()->viewport()->installEventFilter(this); // it just cool to have it as default ;) view()->setAlternatingRowColors(true); connect( model(), SIGNAL( dataChanged( const QModelIndex &, const QModelIndex & ) ), this, SLOT( sltDataChanged( const QModelIndex &, const QModelIndex & ) ) ); connect( edit, SIGNAL( editingFinished() ), this, SLOT( sltEditingFinished() ) ); }
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 ComboBox::setupLineEdit() { setInsertPolicy(QComboBox::NoInsert); setLineEdit(new QLineEdit(this)); QCompleter *currentCompleter = completer(); currentCompleter->setCompletionMode(QCompleter::PopupCompletion); currentCompleter->setCaseSensitivity(Qt::CaseSensitive); }
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(); }
KComboBox::KComboBox( bool rw, QWidget *parent, const char *name ) : QComboBox( rw, parent, name ), d(new KComboBoxPrivate) { init(); if ( rw ) { KLineEdit *edit = new KLineEdit( this, "combo lineedit" ); setLineEdit( edit ); } }
CodeSpinBox::CodeSpinBox(QWidget *parent) : QSpinBox(parent) { CodeLineEdit *codeLineEdit = new CodeLineEdit(parent); codeLineEdit->setEmbedded(true); setLineEdit(codeLineEdit); connect(codeLineEdit, SIGNAL(codeChanged(bool)), this, SLOT(codeChanged(bool))); addActions(codeLineEdit->actions()); }
NumberBoxWidget::NumberBoxWidget() : modifier( 0 ), scrollStep( 1 ) { ScrollLineEdit *scrollLineEdit = new ScrollLineEdit(); scrollLineEdit->setScroll( true ); setLineEdit( scrollLineEdit ); connect( scrollLineEdit, SIGNAL( scrolled(int) ), this, SLOT( scrollBy(int) ) ); connect( this, SIGNAL( editingFinished() ), this, SLOT( onEditingFinished() ) ); }
SpinBox::SpinBox(QWidget* parent) : QSpinBox(parent) { _returnMode = false; SpinBoxLineEdit* le = new SpinBoxLineEdit(this); setLineEdit(le); setKeyboardTracking(false); connect(le, SIGNAL(doubleClicked()), this, SIGNAL(doubleClicked())); connect(le, SIGNAL(ctrlDoubleClicked()), this, SIGNAL(ctrlDoubleClicked())); //connect(le, SIGNAL(ctrlClicked()), this, SIGNAL(ctrlClicked())); }
CodeDateTimeEdit::CodeDateTimeEdit(QWidget *parent) : QDateTimeEdit(parent) { CodeLineEdit *codeLineEdit = new CodeLineEdit(parent); codeLineEdit->setEmbedded(true); setLineEdit(codeLineEdit); setCalendarPopup(true); connect(codeLineEdit, SIGNAL(codeChanged(bool)), this, SLOT(codeChanged(bool))); addActions(codeLineEdit->actions()); }
QgsSpinBox::QgsSpinBox( QWidget *parent ) : QSpinBox( parent ) { mLineEdit = new QgsSpinBoxLineEdit(); setLineEdit( mLineEdit ); QSize msz = minimumSizeHint(); setMinimumSize( msz.width() + CLEAR_ICON_SIZE + 9 + frameWidth() * 2 + 2, std::max( msz.height(), CLEAR_ICON_SIZE + frameWidth() * 2 + 2 ) ); connect( mLineEdit, &QgsFilterLineEdit::cleared, this, &QgsSpinBox::clear ); connect( this, static_cast < void ( QSpinBox::* )( int ) > ( &QSpinBox::valueChanged ), this, &QgsSpinBox::changed ); }
/************************************************* Function Name: CustomComboBox Description: constructor *************************************************/ CustomComboBox::CustomComboBox(QWidget *parent): QComboBox(parent), m_isMousePress(false) { MonthLineEdit *lineEdit = new MonthLineEdit(); lineEdit->setStyleSheet("Color:#ffffff;"); lineEdit->setReadOnly(true); lineEdit->setAlignment(Qt::AlignCenter); lineEdit->setFixedWidth(100); setLineEdit(lineEdit); connect(lineEdit, SIGNAL(mousePress(bool)), this, SLOT(setIsMousePress(bool))); }
SpinBox::SpinBox(int minValue, int maxValue, int step, QWidget* parent) : QSpinBox(parent) { _returnMode = false; SpinBoxLineEdit* le = new SpinBoxLineEdit(this); setLineEdit(le); setRange(minValue, maxValue); setSingleStep(step); setKeyboardTracking(false); connect(le, SIGNAL(doubleClicked()), this, SIGNAL(doubleClicked())); connect(le, SIGNAL(ctrlDoubleClicked()), this, SIGNAL(ctrlDoubleClicked())); //connect(le, SIGNAL(ctrlClicked()), this, SIGNAL(ctrlClicked())); }
DoubleSpinBox::DoubleSpinBox(QWidget *parent) : QDoubleSpinBox(parent), validator(QRegularExpression(QString("[+-]?\\d+(%1\\d+)?").arg(QRegularExpression::escape(locale().decimalPoint()))), this), edit(new LineEdit(this)), multiple(false) { setKeyboardTracking(false); edit->setValidator(&validator); setLineEdit(edit); connect(this, static_cast<void(QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged), [this](double val) { setValue(val, false); }); }
DisplayFilterCombo::DisplayFilterCombo(QWidget *parent) : QComboBox(parent) { 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 DisplayFilterEdit. setAutoCompletion(false); setLineEdit(new DisplayFilterEdit(this, false)); setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed); setAccessibleName(tr("Display filter selector")); cur_display_filter_combo = this; 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;" "}" ); #ifndef QT_NO_TOOLTIP setToolTip(tr("Select from previously used filters")); #endif // QT_NO_TOOLTIP connect(wsApp, SIGNAL(preferencesChanged()), this, SLOT(updateMaxCount())); }
DisplayFilterCombo::DisplayFilterCombo(QWidget *parent) : QComboBox(parent) { 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 DisplayFilterEdit. setAutoCompletion(false); setLineEdit(new DisplayFilterEdit(this, DisplayFilterToApply)); // Default is Preferred. setSizePolicy(QSizePolicy::MinimumExpanding, sizePolicy().verticalPolicy()); setAccessibleName(tr("Display filter selector")); cur_display_filter_combo = this; 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: 14px;" " border-left-width: 0px;" " }" "QComboBox::down-arrow {" " image: url(:/stock_icons/14x14/x-filter-dropdown.png);" " }" "QComboBox::down-arrow:on { /* shift the arrow when popup is open */" " top: 1px;" " left: 1px;" "}" ); setToolTip(tr("Select from previously used filters.")); connect(wsApp, &WiresharkApplication::preferencesChanged, this, &DisplayFilterCombo::updateMaxCount); }
QgsDoubleSpinBox::QgsDoubleSpinBox( QWidget *parent ) : QDoubleSpinBox( parent ) , mShowClearButton( true ) , mClearValueMode( MinimumValue ) , mCustomClearValue( 0.0 ) , mExpressionsEnabled( true ) { mLineEdit = new QgsSpinBoxLineEdit(); setLineEdit( mLineEdit ); QSize msz = minimumSizeHint(); setMinimumSize( msz.width() + CLEAR_ICON_SIZE + 9 + frameWidth() * 2 + 2, qMax( msz.height(), CLEAR_ICON_SIZE + frameWidth() * 2 + 2 ) ); connect( mLineEdit, SIGNAL( cleared() ), this, SLOT( clear() ) ); connect( this, SIGNAL( valueChanged( double ) ), this, SLOT( changed( double ) ) ); }
QgsSpinBox::QgsSpinBox( QWidget *parent ) : QSpinBox( parent ) , mShowClearButton( true ) , mClearValueMode( MinimumValue ) , mCustomClearValue( 0 ) , mExpressionsEnabled( true ) { mLineEdit = new QgsSpinBoxLineEdit(); setLineEdit( mLineEdit ); QSize msz = minimumSizeHint(); setMinimumSize( msz.width() + CLEAR_ICON_SIZE + 9 + frameWidth() * 2 + 2, std::max( msz.height(), CLEAR_ICON_SIZE + frameWidth() * 2 + 2 ) ); connect( mLineEdit, &QgsFilterLineEdit::cleared, this, &QgsSpinBox::clear ); connect( this, static_cast < void ( QSpinBox::* )( int ) > ( &QSpinBox::valueChanged ), this, &QgsSpinBox::changed ); }
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()); }
/*! 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(","); }
HPSComboBox::HPSComboBox(QWidget *parent) : QComboBox(parent) { mLineEdit = new QLineEdit(); mLineEdit->setReadOnly(true); setLineEdit(mLineEdit); initPopup(); /* QStandardItem *p = new QStandardItem("root"); p->setData("root",Qt::UserRole); mPopup->model()->appendRow(p); for (int var = 0; var < 20; ++var) { QStandardItem *child = new QStandardItem("muh "+QString::number(var)+p->text()); child->setData("muh "+QString::number(var)+p->text(),Qt::UserRole); p->appendRow(child); if(var==3){ child->setEnabled(false); } p =child; } mPopup->setView(HPSPopupWidget::TreeView); setItemByText("muh "+QString::number(0)+"root");*/ }
QgsFeatureListComboBox::QgsFeatureListComboBox( QWidget *parent ) : QComboBox( parent ) , mModel( new QgsFeatureFilterModel( this ) ) , mCompleter( new QCompleter( mModel ) ) { mCompleter->setCaseSensitivity( Qt::CaseInsensitive ); mCompleter->setFilterMode( Qt::MatchContains ); setCompleter( mCompleter ); mCompleter->setWidget( this ); connect( mModel, &QgsFeatureFilterModel::sourceLayerChanged, this, &QgsFeatureListComboBox::sourceLayerChanged ); connect( mModel, &QgsFeatureFilterModel::displayExpressionChanged, this, &QgsFeatureListComboBox::displayExpressionChanged ); connect( mModel, &QgsFeatureFilterModel::filterExpressionChanged, this, &QgsFeatureListComboBox::filterExpressionChanged ); connect( mModel, &QgsFeatureFilterModel::isLoadingChanged, this, &QgsFeatureListComboBox::onLoadingChanged ); connect( mModel, &QgsFeatureFilterModel::filterJobCompleted, this, &QgsFeatureListComboBox::onFilterUpdateCompleted ); connect( mModel, &QgsFeatureFilterModel::allowNullChanged, this, &QgsFeatureListComboBox::allowNullChanged ); connect( mModel, &QgsFeatureFilterModel::extraIdentifierValueChanged, this, &QgsFeatureListComboBox::identifierValueChanged ); connect( mModel, &QgsFeatureFilterModel::extraIdentifierValueIndexChanged, this, &QgsFeatureListComboBox::setCurrentIndex ); connect( mModel, &QgsFeatureFilterModel::identifierFieldChanged, this, &QgsFeatureListComboBox::identifierFieldChanged ); connect( mCompleter, static_cast<void( QCompleter::* )( const QModelIndex & )>( &QCompleter::highlighted ), this, &QgsFeatureListComboBox::onItemSelected ); connect( mCompleter, static_cast<void( QCompleter::* )( const QModelIndex & )>( &QCompleter::activated ), this, &QgsFeatureListComboBox::onActivated ); connect( mModel, &QgsFeatureFilterModel::beginUpdate, this, &QgsFeatureListComboBox::storeLineEditState ); connect( mModel, &QgsFeatureFilterModel::endUpdate, this, &QgsFeatureListComboBox::restoreLineEditState ); connect( mModel, &QgsFeatureFilterModel::endUpdate, this, &QgsFeatureListComboBox::modelUpdated ); connect( mModel, &QgsFeatureFilterModel::dataChanged, this, &QgsFeatureListComboBox::onDataChanged ); connect( this, static_cast<void( QgsFeatureListComboBox::* )( int )>( &QgsFeatureListComboBox::currentIndexChanged ), this, &QgsFeatureListComboBox::onCurrentIndexChanged ); mLineEdit = new QgsFilterLineEdit(); mLineEdit->setSelectOnFocus( true ); setEditable( true ); setLineEdit( mLineEdit ); setModel( mModel ); connect( mLineEdit, &QgsFilterLineEdit::textEdited, this, &QgsFeatureListComboBox::onCurrentTextChanged ); setToolTip( tr( "Just start typing what you are looking for." ) ); }
DisplayFilterCombo::DisplayFilterCombo(QWidget *parent) : QComboBox(parent) { setEditable(true); setLineEdit(new DisplayFilterEdit()); setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed); setAccessibleName(tr("Display filter selector")); cur_display_filter_combo = this; setStyleSheet( "QComboBox {" " border: 1px solid gray;" " border-radius: 3px;" " padding: 0px 0px 0px 0px;" " margin-left: 0px;" " min-width: 20em;" // " background: #ccccff;" " }" "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); }
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); }