void KHistoryComboBox::setHistoryItems( const QStringList &items, bool setCompletionList ) { QStringList insertingItems = items; KComboBox::clear(); // limit to maxCount() const int itemCount = insertingItems.count(); const int toRemove = itemCount - maxCount(); if (toRemove >= itemCount) { insertingItems.clear(); } else { for (int i = 0; i < toRemove; ++i) insertingItems.pop_front(); } insertItems( insertingItems ); if ( setCompletionList && useCompletion() ) { // we don't have any weighting information here ;( KCompletion *comp = completionObject(); comp->setOrder( KCompletion::Insertion ); comp->setItems( insertingItems ); comp->setOrder( KCompletion::Weighted ); } clearEditText(); }
void QGalleryTrackerResultSetPrivate::syncFinish(const int rIndex, const int iIndex) { const int rCount = rCache.count - rIndex; const int iCount = iCache.count - iIndex; bool itemChanged = false; if (rCount > 0) removeItems(rIndex, iIndex, rCount); else rCache.offset = rCache.count; if (currentIndex >= iCache.cutoff && currentIndex < iCache.count) { currentRow = iCache.values.constBegin() + (currentIndex * tableWidth); itemChanged = true; } if (iCount > 0) insertItems(rIndex + rCount, iIndex, iCount); else iCache.cutoff = iCache.count; if (itemChanged) emit q_func()->currentItemChanged(); flags |= SyncFinished; }
void WindowSelectComboBox::refreshWindowList() { model()->setData(model()->index(0, 0), lineEdit()->text()); while (count() > 1) { removeItem(1); } insertItems(1, autoType()->windowTitles()); }
QueueManager::QueueManager( QWidget *parent, const char *name ) : KDialogBase( KDialogBase::Swallow, 0, parent, name, false, 0, Ok|Cancel ) { s_instance = this; // Gives the window a small title bar, and skips a taskbar entry KWin::setType( winId(), NET::Utility ); KWin::setState( winId(), NET::SkipTaskbar ); kapp->setTopWidget( this ); setCaption( kapp->makeStdCaption( i18n("Queue Manager") ) ); setInitialSize( QSize( 400, 260 ) ); QVBox *mainBox = new QVBox( this ); setMainWidget( mainBox ); QHBox *box = new QHBox( mainWidget() ); box->setSpacing( 5 ); m_listview = new QueueList( box ); QVBox *buttonBox = new QVBox( box ); m_up = new KPushButton( KGuiItem( QString::null, "up" ), buttonBox ); m_down = new KPushButton( KGuiItem( QString::null, "down" ), buttonBox ); m_remove = new KPushButton( KGuiItem( QString::null, "edit_remove" ), buttonBox ); m_add = new KPushButton( KGuiItem( QString::null, "edit_add" ), buttonBox ); m_clear = new KPushButton( KGuiItem( QString::null, amaroK::icon( "playlist_clear" ) ), buttonBox ); QToolTip::add( m_up, i18n( "Move up" ) ); QToolTip::add( m_down, i18n( "Move down" ) ); QToolTip::add( m_remove, i18n( "Remove" ) ); QToolTip::add( m_add, i18n( "Enqueue track" ) ); QToolTip::add( m_clear, i18n( "Clear queue" ) ); m_up->setEnabled( false ); m_down->setEnabled( false ); m_remove->setEnabled( false ); m_add->setEnabled( false ); m_clear->setEnabled( false ); connect( m_up, SIGNAL( clicked() ), m_listview, SLOT( moveSelectedUp() ) ); connect( m_down, SIGNAL( clicked() ), m_listview, SLOT( moveSelectedDown() ) ); connect( m_remove, SIGNAL( clicked() ), this, SLOT( removeSelected() ) ); connect( m_add, SIGNAL( clicked() ), this, SLOT( addItems() ) ); connect( m_clear, SIGNAL( clicked() ), m_listview, SLOT( clear() ) ); Playlist *pl = Playlist::instance(); connect( pl, SIGNAL( selectionChanged() ), SLOT( updateButtons() ) ); connect( m_listview, SIGNAL( selectionChanged() ), SLOT( updateButtons() ) ); connect( pl, SIGNAL( queueChanged(const PLItemList &, const PLItemList &) ), SLOT( addQueuedItems(const PLItemList &, const PLItemList &) ) ); insertItems(); }
/** Creates and sets up list widget. * \return Poiter to created list widget. * \sa insertItem() */ QListWidget *OptionsDialog::createListWidget() { QListWidget *listWidget = new QListWidget(this); insertItems(listWidget); listWidget->setObjectName(QString::fromUtf8("listWidget")); listWidget->setMaximumWidth(120); listWidget->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding); listWidget->setSelectionBehavior(QAbstractItemView::SelectRows); listWidget->setFlow(QListView::LeftToRight); listWidget->setGridSize(QSize(110, 60)); listWidget->setViewMode(QListView::IconMode); return listWidget; }
void KHistoryComboBox::setPixmapProvider( KPixmapProvider *prov ) { if ( d->myPixProvider == prov ) return; delete d->myPixProvider; d->myPixProvider = prov; // re-insert all the items with/without pixmap // I would prefer to use changeItem(), but that doesn't honor the pixmap // when using an editable combobox (what we do) if ( count() > 0 ) { QStringList items( historyItems() ); clear(); insertItems( items ); } }
/** * Initialisation (called manually and only once). */ void QG_PatternBox::init() { QStringList patterns; QListIterator<RS_Pattern *> f = RS_PATTERNLIST->getIteretor(); while (f.hasNext()) { patterns.append( f.next()->getFileName() ); } patterns.sort(); insertItems(0, patterns); connect(this, SIGNAL(activated(int)), this, SLOT(slotPatternChanged(int))); setCurrentIndex(0); slotPatternChanged(currentIndex()); }
void ResourceTree::insertItemsFromArchive(Archive &archive, const ResourceTreeItem &item, const QModelIndex &parentIndex) { QList<ResourceTreeItem *> items; if (item.getFileType() == Aurora::kFileTypeBIF) { const QString localArchivePath = item.getParent()->getName() + "/" + item.getName(); auto resList = static_cast<Aurora::KEYFile *>(archive.data)->getResourceListForDataFile(localArchivePath.toStdString().c_str()); for (auto res : resList) { items.push_back(new ResourceTreeItem(archive.data, localArchivePath, *res)); } } else { auto &resources = archive.data->getResources(); for (auto r = resources.begin(); r != resources.end(); ++r) { items.push_back(new ResourceTreeItem(archive.data, item.getPath(), *r)); } } archive.addedMembers = true; insertItems(0, items, parentIndex); }
void QGalleryTrackerResultSetPrivate::syncReplace( const int rIndex, const int rCount, const int iIndex, const int iCount) { bool itemChanged = false; if (rCount > 0) removeItems(rIndex, iIndex, rCount); if (currentIndex >= iCache.cutoff && currentIndex < iCache.cutoff + iCount) { currentRow = iCache.values.constBegin() + (currentIndex * tableWidth); itemChanged = true; } if (iCount > 0) insertItems(rIndex + rCount, iIndex, iCount); if (itemChanged) emit q_func()->currentItemChanged(); }
//////////////////////////////////////////////////////////////////////////////// // // Application Tab // //////////////////////////////////////////////////////////////////////////////// ApplicationTab::ApplicationTab(const QFileInfo& fileInfo, QWidget* parent) { auto topLabel = new QLabel(tr("Open with:")); QStringList apps; for (int i = 0; i < 30; ++i) apps.append(tr("Application %1").arg(i)); auto appListBox = new QListWidget; appListBox->insertItems(0, apps); auto alwaysCheckBox = fileInfo.suffix().isEmpty() ? new QCheckBox(tr("Always use this app to open this type of file")) : new QCheckBox(tr("Always use this app to open files with the rxtension '%1'").arg(fileInfo.suffix())); auto layout = new QVBoxLayout; layout->addWidget(topLabel); layout->addWidget(appListBox); layout->addWidget(alwaysCheckBox); this->setLayout(layout); }
void ListData::appendItems(QList<SingleData *> data) { insertItems(m_source.count(),data); }
void OCompletion::setItems( const QStringList& items ) { clear(); insertItems( items ); }
void ColorListBox::updateBox(ColorList& list, ColorListBox::PixmapType type) { clear(); reset(); insertItems(list, type); }
void MyComboBox::insertStringList( const QStringList & list, int index ) { insertItems((index < 0 ? count() : index), list); }
void IEC61850Tree::insertItems(const QString &text) { insertItems(root, text); }
void ListData::insertItem(int index, SingleData *data) { QList<SingleData*> temp; temp.append(data); insertItems(index,temp); }
/*! @beta Adds each of the strings in the given \a texts to combobox. Each item is appended to the list of existing items in turn. \sa insertItem */ void HbComboBox::addItems( const QStringList &texts ) { insertItems( count( ), texts ); }
void ListData::appendOne(SingleData *data) { QList<SingleData*> temp; temp.append(data); insertItems(m_source.count(),temp); }