/** Constructor */ GxsIdChooser::GxsIdChooser(QWidget *parent) : QComboBox(parent), mFlags(IDCHOOSER_ANON_DEFAULT) { mBase = new RsGxsUpdateBroadcastBase(rsIdentity, this); connect(mBase, SIGNAL(fillDisplay(bool)), this, SLOT(fillDisplay(bool))); /* Initialize ui */ setSizeAdjustPolicy(QComboBox::AdjustToContents); mFirstLoad = true; mAllowedCount = 0 ; mDefaultId.clear() ; /* Enable sort with own role */ QSortFilterProxyModel *proxy = new QSortFilterProxyModel(this); proxy->setSourceModel(model()); proxy->setDynamicSortFilter(false); model()->setParent(proxy); setModel(proxy); proxy->setSortRole(ROLE_SORT); /* Connect signals */ connect(this, SIGNAL(currentIndexChanged(int)), this, SLOT(myCurrentIndexChanged(int))); connect(this, SIGNAL(activated(int)), this, SLOT(indexActivated(int))); }
ActionView::ActionView(QWidget * parent /*= nullptr*/) : QListView(parent) , mModel{new QStandardItemModel{this}} , mProxy{new QSortFilterProxyModel{this}} , mMaxItemsToShow(10) { setEditTriggers(QAbstractItemView::NoEditTriggers); setSizeAdjustPolicy(AdjustToContents); setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); setSelectionBehavior(SelectRows); setSelectionMode(SingleSelection); SingleActivateStyle * s = new SingleActivateStyle; s->setParent(this); setStyle(s); mProxy->setSourceModel(mModel); mProxy->setDynamicSortFilter(true); mProxy->setFilterRole(FilterRole); mProxy->setFilterCaseSensitivity(Qt::CaseInsensitive); mProxy->sort(0); { QScopedPointer<QItemSelectionModel> guard{selectionModel()}; setModel(mProxy); } { QScopedPointer<QAbstractItemDelegate> guard{itemDelegate()}; setItemDelegate(new DelayedIconDelegate{this}); } connect(this, &QAbstractItemView::activated, this, &ActionView::onActivated); }
KNMusicStoreAlbumTreeView::KNMusicStoreAlbumTreeView(QWidget *parent) : QTreeView(parent), m_mouseAnime(new QTimeLine(200, this)) { //Set properties. setAllColumnsShowFocus(true); setAlternatingRowColors(false); //We will use our own alternating drawing. setContentsMargins(0, 0, 0, 0); setFrameShape(QFrame::NoFrame); setIndentation(0); setSizeAdjustPolicy(QAbstractScrollArea::AdjustToContents); setSelectionBehavior(QAbstractItemView::SelectRows); setSelectionMode(QAbstractItemView::ExtendedSelection); setUniformRowHeights(true); setVerticalScrollMode(QAbstractItemView::ScrollPerPixel); //Configure the time line. m_mouseAnime->setEasingCurve(QEasingCurve::OutCubic); m_mouseAnime->setUpdateInterval(10); //Link the time line. connect(m_mouseAnime, &QTimeLine::frameChanged, this, &KNMusicStoreAlbumTreeView::onActionMouseInOut); //Initial the sense header. KNMouseSenseHeader *header=new KNMouseSenseHeader(this); header->setSectionsMovable(false); header->setSectionsClickable(false); header->setFixedHeight(38); setHeader(header); //Link with theme manager. connect(knTheme, &KNThemeManager::themeChange, this, &KNMusicStoreAlbumTreeView::onActionThemeUpdate); }
Scrollarea::Scrollarea( QWidget* parent, QWidget* hijo):QScrollArea( parent ) { setWindowTitle(hijo->windowTitle()); hij = hijo; WidthMax = this->maximumWidth(); HeightMax = this->maximumHeight(); setSizeAdjustPolicy(QAbstractScrollArea::AdjustToContents); connect(this, SIGNAL(miSignal()), hij, SLOT(ajustarSize())); }
KNMusicTreeViewBase::KNMusicTreeViewBase(QWidget *parent) : QTreeView(parent) { //Set properties. setAllColumnsShowFocus(true); setAlternatingRowColors(true); setContentsMargins(0,0,0,0); setDragDropMode(QAbstractItemView::DragOnly); setDropIndicatorShown(true); setFrameShape(QFrame::NoFrame); setIndentation(0); setMouseTracking(true); setSizeAdjustPolicy(QAbstractScrollArea::AdjustToContents); setSelectionBehavior(QAbstractItemView::SelectRows); setSelectionMode(QAbstractItemView::ExtendedSelection); setUniformRowHeights(true); setVerticalScrollMode(QAbstractItemView::ScrollPerPixel); //Set scroll bar properties. horizontalScrollBar()->setSingleStep(5); horizontalScrollBar()->setPageStep(5); verticalScrollBar()->setSingleStep(4); verticalScrollBar()->setPageStep(4); //Using frame updater to set palette. onActionMouseInOut(0); //Set animation header. KNMusicTreeViewHeader *header=new KNMusicTreeViewHeader(this); connect(header, &KNMusicTreeViewHeader::requireResizeColumnToContents, this, &KNMusicTreeViewBase::resizeColumnToContents); setHeader(header); //Set delegate. setItemDelegateForColumn(Rating, new KNMusicRatingDelegate(this)); setItemDelegateForColumn(AlbumRating, new KNMusicRatingDelegate(this)); //Initial menu connections. m_soloConnections=new KNConnectionHandler(this); m_multiConnections=new KNConnectionHandler(this); //Initial mouse sense animation. m_mouseIn=new QTimeLine(200, this); configureTimeLine(m_mouseIn); m_mouseIn->setEndFrame(m_maxOpacity); m_mouseOut=new QTimeLine(200, this); configureTimeLine(m_mouseOut); m_mouseOut->setEndFrame(0); //Initial reacts. connect(this, &KNMusicTreeViewBase::activated, this, &KNMusicTreeViewBase::playIndex); //Initial actions. initialActions(); }
QFLightSourceComboBox::QFLightSourceComboBox(QFExtensionManager* extManager, QWidget* parent): QFEnhancedComboBox(parent) { m_extManager=extManager; setSizeAdjustPolicy(QComboBox::AdjustToContents); findExtensions(); connect(this, SIGNAL(currentIndexChanged(int)), this, SLOT(comboIndexChanged(int))); }
toResultCombo::toResultCombo(QWidget *parent, const char *name) : QComboBox(parent) , SelectionPolicy(None) , SelectedFound(false) , Query(NULL) { setObjectName(name); connect(this, SIGNAL(activated(int)), this, SLOT(slotChangeSelected(void))); setSizeAdjustPolicy(QComboBox::AdjustToContents); //queryingUserlist = false; }
QFESPIMB040ConfigComboBox::QFESPIMB040ConfigComboBox(QWidget *parent) : QFEnhancedComboBox(parent) { updating=false; connect(this, SIGNAL(activated(int)), this, SLOT(cmbCurrentIndexChanged(int))); baseDir=QApplication::applicationDirPath(); baseDirAux=""; m_ext="ini"; icon=QIcon(":/spimb040/lightpath.png"); clear(); setSizeAdjustPolicy(QComboBox::AdjustToContents); }
KrunnerHistoryComboBox::KrunnerHistoryComboBox(bool useCompletion, QWidget * parent) : KHistoryComboBox(useCompletion, parent), m_addingToHistory(false) { setPalette(QApplication::palette()); setDuplicatesEnabled(false); setSizeAdjustPolicy(QComboBox::AdjustToMinimumContentsLengthWithIcon); // in theory, the widget should detect the direction from the content // but this is not available in Qt4.4/KDE 4.2, so the best default for this widget // is LTR: as it's more or less a "command line interface" // FIXME remove this code when KLineEdit has automatic direction detection of the "paragraph" setLayoutDirection(Qt::LeftToRight); }
MultilineTextEdit::MultilineTextEdit(QWidget *parent) : QPlainTextEdit(parent), minLineCount_(2), maxLineCount_(10), showContextMenu_(false) { QFontMetrics fontMetric(font()); lineHeight_ = fontMetric.lineSpacing(); // enable focus switch by tab (leaving the editor and committing the changes) setTabChangesFocus(true); setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn); #if (QT_VERSION >= QT_VERSION_CHECK(5, 2, 0)) // need to enable the scrollbar for adjusting to its contents setSizeAdjustPolicy(QAbstractScrollArea::AdjustToContents); #endif // make the text edit show at least n lines of text setMinimumHeight(minLineCount_ * lineHeight_); setMaximumHeight(maxLineCount_ * lineHeight_); }
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)) ); }
/****************************************************************************** * 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); }
CWizToolComboBoxFont(QWidget* parent = 0) : QFontComboBox(parent) { setSizeAdjustPolicy(QComboBox::QComboBox::AdjustToMinimumContentsLength); setEditable(false); }
CWizToolComboBox(QWidget* parent = 0) : QComboBox(parent) { setFocusPolicy(Qt::NoFocus); setSizeAdjustPolicy(QComboBox::AdjustToMinimumContentsLength); }
KNMusicTreeViewBase::KNMusicTreeViewBase(QWidget *parent, KNMusicTab *tab) : QTreeView(parent), m_musicTab(tab), m_mouseAnime(new QTimeLine(200, this)), m_proxyModel(nullptr), m_hScrollBar(new QScrollBar(Qt::Horizontal, this)), m_vScrollBar(new QScrollBar(Qt::Vertical, this)), m_dragMoveRow(-1), m_dragIndicatorPos(QAbstractItemView::OnViewport), m_initialLoad(true), m_pressed(false), m_notAcceptDragMove(false) { //Set properties. setAllColumnsShowFocus(true); setAlternatingRowColors(false); //We will use our own alternating drawing. setContentsMargins(0, 0, 0, 0); setDragDropMode(QAbstractItemView::InternalMove); setDragEnabled(true); setDropIndicatorShown(true); setFrameShape(QFrame::NoFrame); setIndentation(0); setMouseTracking(true); setSizeAdjustPolicy(QAbstractScrollArea::AdjustToContents); setSelectionBehavior(QAbstractItemView::SelectRows); setSelectionMode(QAbstractItemView::ExtendedSelection); setUniformRowHeights(true); setVerticalScrollMode(QAbstractItemView::ScrollPerPixel); setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); //Set scroll bar policies. horizontalScrollBar()->setSingleStep(5); horizontalScrollBar()->setPageStep(5); verticalScrollBar()->setSingleStep(4); verticalScrollBar()->setPageStep(4); //Configure the horizontal scroll bar. m_hScrollBar->setObjectName("MusicScrollBar"); m_hScrollBar->setStyle(KNSaoStyle::instance()); m_hScrollBar->hide(); m_hScrollBar->setFixedHeight(ScrollBarWidth); knTheme->registerWidget(m_hScrollBar); setHorizontalScrollBar(m_hScrollBar); //Configure the vertical scroll bar. m_vScrollBar->setObjectName("MusicScrollBar"); m_vScrollBar->setStyle(KNSaoStyle::instance()); m_vScrollBar->hide(); knTheme->registerWidget(m_vScrollBar); connect(verticalScrollBar(), &QScrollBar::rangeChanged, [=](int min, int max) { //Update the range first. m_vScrollBar->setRange(min, max); //Check whether the scroll bar is still valid. m_vScrollBar->setVisible(min!=max); //Update scrollbar state parameters. m_vScrollBar->setPageStep(verticalScrollBar()->pageStep()); m_vScrollBar->setSingleStep(verticalScrollBar()->singleStep()); //Update the geometry. updateVerticalScrollBarGeometry(); }); connect(verticalScrollBar(), &QScrollBar::valueChanged, [=](int value) { //Block the signal. m_vScrollBar->blockSignals(true); //Reset the value. m_vScrollBar->setValue(value); //Release the block m_vScrollBar->blockSignals(false); }); connect(m_vScrollBar, &QScrollBar::valueChanged, verticalScrollBar(), &QScrollBar::setValue); //Configure the time line. m_mouseAnime->setEasingCurve(QEasingCurve::OutCubic); m_mouseAnime->setUpdateInterval(10); //Link the time line. connect(m_mouseAnime, &QTimeLine::frameChanged, this, &KNMusicTreeViewBase::onActionMouseInOut); //Generate the music tree view animation header. KNMusicTreeViewHeader *header=new KNMusicTreeViewHeader(this); //Link the reqirement. connect(header, &KNMusicTreeViewHeader::requireResizeColumnToContents, this, &KNMusicTreeViewBase::resizeColumnToContents); //Set the header view. setHeader(header); //Set the rating delegate for Rating and AlbumRating row. setItemDelegateForColumn(Rating, new KNMusicRatingDelegate(this)); setItemDelegateForColumn(AlbumRating, new KNMusicRatingDelegate(this)); //Set the search shortcut. QAction *searchAction=new QAction(this); searchAction->setShortcut(QKeySequence(Qt::CTRL+Qt::Key_F)); searchAction->setShortcutContext(Qt::WidgetWithChildrenShortcut); connect(searchAction, &QAction::triggered, [=] { //Check whether the search plugin is loaded. if(knMusicGlobal->search()) { knMusicGlobal->search()->onActionSearchShortcut(this); } }); addAction(searchAction); //Link the tree view signal and slot. connect(this, &KNMusicTreeViewBase::activated, this, &KNMusicTreeViewBase::onActionActivate); //Link with theme manager. connect(knTheme, &KNThemeManager::themeChange, this, &KNMusicTreeViewBase::onActionThemeUpdate); }
FunctionComboBox::FunctionComboBox(QWidget *parent) : QComboBox(parent) { //setInsertPolicy(QComboBox::InsertAlphabetically); setMinimumContentsLength(50); setSizeAdjustPolicy(QComboBox::AdjustToMinimumContentsLength); }
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; }