Example #1
0
void FeatureClassDlg::removeFeatureClass()
{
    QList<QListWidgetItem*> items = mpClassList->selectedItems();
    for (int i = 0; i < items.count(); ++i)
    {
        QListWidgetItem* pItem = items[i];
        if (pItem != NULL)
        {
            QString className = pItem->text();

            // Remove the feature class from the member dynamic object
            mpFeatureClasses->removeAttribute(className.toStdString());

            // Remove the item from the list widget
            delete pItem;
        }
    }

    // The selected item was deleted, so just select the first item in the list
    QListWidgetItem* pItem = mpClassList->item(0);
    if (pItem != NULL)
    {
        pItem->setSelected(true);
    }
}
Example #2
0
void NewGameTab::filterImages(const QStringList& filter)
{
	// Filter items
	QListWidgetItem* item;
	int count = m_images->count();
	for (int i = 0; i < count; ++i) {
		item = m_images->item(i);
		item->setHidden(!filter.contains(item->data(ImageRole).toString()));
	}

	// Select next item if current item was hidden
	item = m_images->currentItem();
	if (!item || item->isHidden()) {
		int count = m_images->count();
		for (int i = 0; i < count; ++i) {
			item = m_images->item(i);
			if (!item->isHidden()) {
				item->setSelected(true);
				m_images->setCurrentItem(item);
				break;
			}
		}
	}

	// Disable tag button if no images are visible
	item = m_images->currentItem();
	m_tag_action->setEnabled(item && !item->isHidden());
}
Example #3
0
void FeatureClassDlg::loadFromSettings()
{
    mpClassList->clear();

    Service<ConfigurationSettings> pSettings;
    const DataVariant& classes = pSettings->getSetting(FEATURE_CLASS_SETTING);

    const DynamicObject* pClasses = classes.getPointerToValue<DynamicObject>();
    if (pClasses == NULL)
    {
        return;
    }

    mpFeatureClasses->merge(pClasses);

    std::vector<std::string> classNames;
    mpFeatureClasses->getAttributeNames(classNames);
    for (std::vector<std::string>::const_iterator iter = classNames.begin(); iter != classNames.end(); ++iter)
    {
        QString className = QString::fromStdString(*iter);
        if (className.isEmpty() == false)
        {
            QListWidgetItem* pItem = new QListWidgetItem(className, mpClassList);
            pItem->setData(Qt::UserRole, QVariant(className));
            pItem->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsEditable);
            mpClassList->addItem(pItem);
        }
    }

    QListWidgetItem* pItem = mpClassList->item(0);
    if (pItem != NULL)
    {
        pItem->setSelected(true);
    }
}
Example #4
0
void TrendingTopicsWidget::refreshList() {
	QList<TrendingTopic> topics=currentTrends;
	if (mode==TrendingTopicsFetcher::Daily)
		topics=dailyTrends;
	else if (mode==TrendingTopicsFetcher::Weekly)
		topics=weeklyTrends;

	int height=0;
	ui.topics->clear();
	for(int x=0;x<topics.size();x++) {
		TrendingTopic topic = topics.at(x);
		QString name = QString::number(x+1)+". ";
		QListWidgetItem *item = new QListWidgetItem();
		name+=topic.name;
		item->setText(name);
		if (topic.prevPos==-1)
			item->setIcon(QIcon(":/trendstates/newentry.png"));
		else if (topic.prevPos==x)
			item->setIcon(QIcon(":/trendstates/stick.png"));
		else if (topic.prevPos>x)
			item->setIcon(QIcon(":/trendstates/up.png"));
		else
			item->setIcon(QIcon(":/trendstates/down.png"));

		ui.topics->addItem(item);

		if (currentName==topic.name) {
			item->setSelected(true);
			ui.topics->setCurrentItem(item);
		}
		height += ui.topics->visualItemRect(item).height();
	}
	ui.topics->setMinimumHeight(height);
	ui.topics->setMaximumHeight(height);
}
void KPrPageLayoutDocker::slotActivePageChanged()
{
    Q_ASSERT( m_view );

    KPrPage * page = dynamic_cast<KPrPage*>( m_view->activePage() );
    if ( page ) {
        KPrPageLayout * layout = page->layout();
        QListWidgetItem * item = m_layout2item.value( layout, 0 );
        if ( item == 0 && layout != 0 && layout->type() == KPrPageLayout::Page ) {
            item = addLayout( layout );
        }

        if ( item ) {
            m_layoutsView->blockSignals( true );
            item->setSelected( true );
            m_layoutsView->blockSignals( false );
            m_layoutsView->scrollToItem( item );
        }
        else {
            QList<QListWidgetItem*> items = m_layoutsView->selectedItems();
            foreach ( QListWidgetItem * i, items ) {
                m_layoutsView->blockSignals( true );
                i->setSelected( false );
                m_layoutsView->blockSignals( false );
            }
        }
    }
OptionsDialog::OptionsDialog(QWidget *parent)
    : QDialog(parent)
    , ui(new Ui::OptionsDialog)
    , m_httpProxyForm(new HttpProxyOptionPage(this))
    , m_importPathsForm(new ImportPathOptionPage(this))
    , m_hostsForm(new HostsOptionsPage(this))
{
    ui->setupUi(this);

    QListWidgetItem *item = new QListWidgetItem("HTTP Proxy");
    int index = ui->optionsStack->addWidget(m_httpProxyForm);
    item->setSelected(true);
    item->setData(Qt::UserRole, index);
    ui->optionsView->addItem(item);

    item = new QListWidgetItem("Import Paths");
    index = ui->optionsStack->addWidget(m_importPathsForm);
    item->setData(Qt::UserRole, index);
    ui->optionsView->addItem(item);

    item = new QListWidgetItem("Hosts");
    index = ui->optionsStack->addWidget(m_hostsForm);
    item->setData(Qt::UserRole, index);
    ui->optionsView->addItem(item);

    connect(ui->optionsView, &QListWidget::currentItemChanged,
            this, &OptionsDialog::optionSelected);
}
Example #7
0
void SettingsDialog::addHostButton_clicked()
{
    QIcon hostIcon = fileIconProvider->icon(QFileIconProvider::Computer);
    const QString hostname = hostComboBox->currentText();
    bool found = false;

    for (int i = 0; i < savedHostsListWidget->count(); i++) {
	QListWidgetItem *item = savedHostsListWidget->item(i);
	if (item->text() != hostname) {
	    item->setSelected(false);
	} else {
	    savedHostsListWidget->setCurrentItem(item);
	    found = true;
	}
    }
    if (!found) {
	QListWidgetItem *item = new QListWidgetItem(hostIcon, hostname);
	savedHostsListWidget->addItem(item);
	savedHostsListWidget->setCurrentItem(item);
	globalSettings.savedHostsModified = true;
	globalSettings.savedHosts << hostname;
    }
    removeHostButton->setEnabled(true);
    writeSettings();
}
void AddCourseDialog::selectItem()
{
	QPushButton *button = qobject_cast<QPushButton *>( sender() );
	if( !button )
		return;

	int row = listWidget->currentRow();
	if( button->objectName() == "upButton" )
	{
		if( --row <= 0 )
			row = 0;
	}
	else if( button->objectName() == "downButton" )
	{
		if( ++row >= listWidget->count() )
		{
			row = listWidget->count() - 1;
			if( row <= 0 )
				row = 0;
		}
	}

	QListWidgetItem *item = listWidget->item(row);
	if( !item )
		return;
	
	listWidget->setCurrentItem( item );
	item->setSelected( true );

	listWidget->setFocus();
}
Example #9
0
void VNotebookSelector::popupListContextMenuRequested(QPoint p_pos)
{
    QListWidgetItem *item = m_listWidget->itemAt(p_pos);
    if (!item) {
        return;
    }

    const VNotebook *nb = getNotebook(item);
    if (!nb) {
        return;
    }

    m_listWidget->clearSelection();
    item->setSelected(true);

    QMenu menu(this);
    menu.setToolTipsVisible(true);
    menu.addAction(m_deleteNotebookAct);
    if (nb->isValid()) {
        menu.addSeparator();
        menu.addAction(m_recycleBinAct);
        menu.addAction(m_emptyRecycleBinAct);
    }

    menu.addSeparator();
    menu.addAction(m_openLocationAct);

    if (nb->isValid()) {
        menu.addAction(m_notebookInfoAct);
    }

    menu.exec(m_listWidget->mapToGlobal(p_pos));
}
void Popup::populateList()
{
    QListWidgetItem* listItem;
    for (int i = 0; i < m_data.itemCount(); ++i) {
        if (m_data.itemType(i) == QWebSelectData::Option) {
            listItem = new QListWidgetItem(m_data.itemText(i));
            m_list->addItem(listItem);
            listItem->setSelected(m_data.itemIsSelected(i));
        } else if (m_data.itemType(i) == QWebSelectData::Group) {
            listItem = new QListWidgetItem(m_data.itemText(i));
            m_list->addItem(listItem);
            listItem->setSelected(false);
            listItem->setFlags(Qt::NoItemFlags);
        }
    }
    connect(m_list, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(onItemSelected(QListWidgetItem*)));
}
Example #11
0
	//-------------------------------------------------------------------------
	void HandleRootsDialog::_invertSelection()
	{
		for( int i = 0; i < _ui->rootFolders->count(); i++ )
		{
			QListWidgetItem* item = _ui->rootFolders->item( i );
			item->setSelected( !item->isSelected() );
		}
	}
Example #12
0
void QcListWidget::setSelection( const QVariantList & list )
{
    clearSelection();
    Q_FOREACH( const QVariant & var, list )
    {
        int row = var.toInt();
        QListWidgetItem *item = QListWidget::item(row);
        if (item)
            item->setSelected(true);
    }
Example #13
0
void LASOpenDlg::addEVLR(QString description)
{
	QListWidgetItem* item = new QListWidgetItem(description);
	evlrListWidget->addItem(item);
	//auto select the entry
	item->setSelected(true);
	//auto enable the extraFieldGroupBox
	extraFieldGroupBox->setEnabled(true);
	extraFieldGroupBox->setChecked(true);
}
Example #14
0
void DifferentiateCurvesDialog::upButtonClicked() {
  int i = _selectedListBox->currentRow();
  if (i != -1) {
    QListWidgetItem *item = _selectedListBox->takeItem(i);
    _selectedListBox->insertItem(i-1, item);
    _selectedListBox->clearSelection();
    item->setSelected(true);
    updateButtons();
  }
}
void LegendTab::downButtonClicked() {

  for (int i=_displayedRelationList->count()-2; i>=0; --i) {
    if (_displayedRelationList->item(i) && _displayedRelationList->item(i)->isSelected()) {
      QListWidgetItem *item = _displayedRelationList->takeItem(i);
      _displayedRelationList->insertItem(i+1, item);
      item->setSelected(true);
    }
  }
  updateButtons();

}
void LegendTab::upButtonClicked() {
  //_displayedRelationList->setFocus();

  for (int i=1; i<_displayedRelationList->count(); i++) {
    if (_displayedRelationList->item(i) && _displayedRelationList->item(i)->isSelected()) {
      QListWidgetItem *item = _displayedRelationList->takeItem(i);
      _displayedRelationList->insertItem(i-1, item);
      item->setSelected(true);
    }
  }
  updateButtons();
}
void PartsBinListView::showContextMenu(const QPoint& pos) {
	QListWidgetItem *it = itemAt(pos);

	QMenu *menu;
	if(it) {
		clearSelection();
		it->setSelected(true);
		menu = m_parent->partContextMenu();
	} else {
		menu = m_parent->combinedMenu();
	}
    menu->exec(mapToGlobal(pos));
}
Example #18
0
// Right Click Mouse Events on the Desktop & Desktop Icon
void QDesktopViewWidget::mousePressEvent(QMouseEvent *event)
{
    // Position of the Mouse Cursor when it receved the click event
    startPos = event->globalPos();

    //
    QListWidgetItem *item = 0;
    item = this->itemAt(startPos);

    //
    if (event->button() == Qt::RightButton)
    {
        if (item == 0)
        {
            menu->exec(startPos);
            //qDebug() << "Desktop Right Clicked" << "\n";
        } else {
            int numSelectedItems = this->selectedItems().size();

            if(numSelectedItems == 0) {
                item->setSelected(true);
            } else if(numSelectedItems == 1) {
                this->clearSelection();
                item->setSelected(true);
            } else if(!this->isSelected(item)) {
                this->clearSelection();
                item->setSelected(true);
            }

            iconMenu->exec(startPos);

            qDebug() << item->data(Qt::UserRole).toString() << "\n";
            //qDebug() << "Icon Right Clicked" << "\n";
        }
    }

    QListWidget::mousePressEvent(event); // Note: sure if this is needed
}
void BlackBerryDeviceConfigurationWizardSetupPage::refreshDeviceList()
{
    m_ui->deviceListWidget->clear();

    QListWidgetItem *manual = createDeviceListItem(tr("Specify device manually"), SpecifyManually);
    m_ui->deviceListWidget->addItem(manual);
    manual->setSelected(true);

    QListWidgetItem *pleaseWait =
            createDeviceListItem(tr("Auto-detecting devices - please wait..."), PleaseWait);
    m_ui->deviceListWidget->addItem(pleaseWait);

    m_deviceListDetector->detectDeviceList();
}
void SessionSelection::initializePage()
{
    SessionList sessions = Session::allSessions();
    QListWidget* widget = ui->listWidgetSession;

    Q_FOREACH (Session * session, sessions) {
        if (session->isCompleted()) {
            const QString name = session->name();
            QListWidgetItem* item = new QListWidgetItem (name, widget);
            item->setData (Qt::UserRole, session->id());
            item->setSelected (m_listSession.contains (session));
        }
    }
}
Example #21
0
void ItemOrderList::setSelectedRows(const QList<int> &selectedRows)
{
    ui->listWidgetItems->clearSelection();
    ui->listWidgetItems->setCurrentItem(NULL);

    foreach (int row, selectedRows) {
        if (row >= 0 && row < rowCount()) {
            QListWidgetItem *item = ui->listWidgetItems->item(row);
            if ( ui->listWidgetItems->currentItem() == NULL )
                ui->listWidgetItems->setCurrentItem(item);
            else
                item->setSelected(true);
        }
    }
}
void ConfigureSkillSubsets::on_bAddSubset_clicked()
{
	QListWidgetItem *item = new QListWidgetItem(QString("%1: Untitled").arg(ProjectData::skillSubsets.size(), 2, 10, QChar(' ')));
	ProjectData::SkillSubset *subset = new ProjectData::SkillSubset;
	subset->name = "Untitled";
	subset->type = ProjectData::SKILLTYPE_NORMAL;
	ProjectData::skillSubsets.append(subset);
	ProjectData::saved = false;
	item->setFlags(Qt::ItemIsEnabled|Qt::ItemIsSelectable);
	lwSkillSubsets->addItem(item);
	lwSkillSubsets->setCurrentRow(lwSkillSubsets->count() - 1);
	item->setSelected(true);
	bDeleteSubset->setEnabled(true);
	leName->selectAll();
	leName->setFocus();
}
Example #23
0
void QuickToolConfigWidget::up()
{
	QList<QListWidgetItem*> selectedItems = m_lstbSeq->selectedItems();
	if(selectedItems.isEmpty()) {
		return;
	}
	QListWidgetItem *selectedItem = selectedItems.first();
	int row = m_lstbSeq->row(selectedItem);
	if(row > 0) {
		QListWidgetItem *previousItem = m_lstbSeq->item(row - 1);
		QString text = selectedItem->text();
		selectedItem->setText(previousItem->text());
		previousItem->setText(text);
		previousItem->setSelected(true);
		changed();
	}
}
Example #24
0
void QMplayer::encode(QString filename)
{
    QString dstFile = getEncFilename(filename, ".encoded.mp4");
    if(startMencoder(filename, dstFile))
    {
#ifdef QTOPIA
     QtopiaApplication::setPowerConstraint(QtopiaApplication::DisableSuspend);
#endif
        showScreen(QMplayer::ScreenEncodingInProgress);
        QListWidgetItem *item = new QListWidgetItem(dstFile, lw);
        item->setSelected(true);
    }
    else
    {
        QMessageBox::warning(this, tr("qmplayer"), tr("Failed to start mencoder"));
    }
}
Example #25
0
void TaskFeaturePick::onSelectionChanged(const Gui::SelectionChanges& /*msg*/)
{
    if (doSelection)
        return;
    doSelection = true;
    ui->listWidget->clearSelection();
    for (Gui::SelectionSingleton::SelObj obj :  Gui::Selection().getSelection()) {
        for (int row = 0; row < ui->listWidget->count(); row++) {
            QListWidgetItem *item = ui->listWidget->item(row);
            QString t = item->data(Qt::UserRole).toString();
            if (t.compare(QString::fromLatin1(obj.FeatName))==0) {
                item->setSelected(true);
            }
        }
    }
    doSelection = false;
}
Example #26
0
void QuickToolConfigWidget::down()
{
	QList<QListWidgetItem*> selectedItems = m_lstbSeq->selectedItems();
	if(selectedItems.isEmpty()) {
		return;
	}
	QListWidgetItem *selectedItem = selectedItems.first();
	int row = m_lstbSeq->row(selectedItem);
	if(row < m_lstbSeq->count() - 1) {
		QListWidgetItem *nextItem = m_lstbSeq->item(row + 1);
		QString text = selectedItem->text();
		selectedItem->setText(nextItem->text());
		nextItem->setText(text);
		nextItem->setSelected(true);
		changed();
	}
}
ImagePropertiesDialog::ImagePropertiesDialog(const QIcon& icon, const QString& name, TagManager* manager, const QString& image, QWidget* parent)
	: QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint),
	m_image(image),
	m_manager(manager)
{
	setWindowTitle(tr("Image Properties"));

	QLabel* preview = new QLabel(this);
	preview->setAlignment(Qt::AlignCenter);
	preview->setPixmap(icon.pixmap(74,74));
	preview->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);

	// Add name
	m_name = new QLineEdit(name, this);

	// Add tags
	m_tags = new QListWidget(this);
	m_tags->setSortingEnabled(true);
	QStringList tags = m_manager->tags();
	for (const QString& tag : tags) {
		QListWidgetItem* item = new QListWidgetItem(tag, m_tags);
		item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsUserCheckable | Qt::ItemIsSelectable);
		item->setCheckState(m_manager->images(tag).contains(image) ? Qt::Checked : Qt::Unchecked);
	}
	if (m_tags->count() > 0) {
		QListWidgetItem* item = m_tags->item(0);
		item->setSelected(true);
		m_tags->setCurrentItem(item);
	}

	// Add dialog buttons
	QDialogButtonBox* buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, this);
	connect(buttons, &QDialogButtonBox::accepted, this, &ImagePropertiesDialog::accept);
	connect(buttons, &QDialogButtonBox::rejected, this, &ImagePropertiesDialog::reject);

	// Layout dialog
	QFormLayout* layout = new QFormLayout(this);
	layout->addRow(preview);
	layout->addRow(tr("Name:"), m_name);
	layout->addRow(tr("Tags:"), m_tags);
	layout->addRow(buttons);

	// Resize dialog
	resize(QSettings().value("ImageProperties/Size", sizeHint()).toSize());
}
Example #28
0
void PropertiesDock::fillMultiUiSelectionBox()
{
    if (NowShowing == MultiShowing)
    {
        // to prevent on_SelectionList_itemSelectionChanged to kick in
        NowShowing = NoUiShowing;
        Main->setUpdatesEnabled(false);
        MultiUi.SelectionList->clear();
        for (int i=0; i<FullSelection.size(); ++i)
        {
            QListWidgetItem* it = new QListWidgetItem(FullSelection[i]->description(),MultiUi.SelectionList);
            it->setData(Qt::UserRole,QVariant(i));
            it->setSelected(true);
        }
        MultiUi.lbStatus->setText(tr("%1/%1 selected item(s)").arg(FullSelection.size()));
        Main->setUpdatesEnabled(true);
        NowShowing = MultiShowing;
    }
}
void GetConvolveParametersDialog::setBandSelectionIndices(const std::vector<unsigned int>& indices)
{
    if (mpBandSelect->count() < 0)
    {
        return;
    }
    mpBandSelect->clearSelection();
    for (std::vector<unsigned int>::const_iterator iter = indices.begin();
            iter != indices.end(); ++iter)
    {
        if (*iter < static_cast<unsigned int>(mpBandSelect->count()))
        {
            QListWidgetItem* pItem = mpBandSelect->item(*iter);
            if (pItem != NULL)
            {
                pItem->setSelected(true);
            }
        }
    }
}
Example #30
0
void AlbumInfoWidget::addUser(const QVariantMap &user)
{
    AlbumTaskWidget *task = m_container->getCurrTask();
    if (!task || user.isEmpty())
    {
        return;
    }

    //qDebug() << __FILE__ << __LINE__ << user;

    UserInfoWidget *widget = NULL;
    QListWidgetItem *item = NULL;
    int num = ui->usersListWidgets1->count();
    int uid = user["id"].toInt();
    QString base = tr(" 手机号码:%1").arg(user["telephone"].toString());
    QString info = tr("%1\t\t姓名:%2\t\t初始密码:%3").arg(base).arg(user["realname"].toString()).arg(user["initpassword"].toString());

    for (int i = 0; i < num; i++)
    {
        if ((item = ui->usersListWidgets1->item(i)) &&
            (widget = static_cast<UserInfoWidget *>(ui->usersListWidgets1->itemWidget(item))))
        {
            QString data = widget->getInfo();
            if (info == data)
            {
                item->setSelected(true);
                return;
            }
            else if (data.startsWith(base))
            {
                removeUser(i);
                break;
            }
        }
    }

    widget = new UserInfoWidget(ui->usersListWidgets1->count(), uid, info, *this);
    item = new QListWidgetItem(ui->usersListWidgets1);
    item->setSizeHint(widget->sizeHint());
    ui->usersListWidgets1->setItemWidget(item, widget);
}