本文整理汇总了C++中QListWidgetItem::isSelected方法的典型用法代码示例。如果您正苦于以下问题:C++ QListWidgetItem::isSelected方法的具体用法?C++ QListWidgetItem::isSelected怎么用?C++ QListWidgetItem::isSelected使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QListWidgetItem
的用法示例。
在下文中一共展示了QListWidgetItem::isSelected方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setEnabledMoveButtons
void BGMultiWallpaperDialog::setEnabledMoveButtons()
{
bool hasSelection = dlg->m_listImages->hasSelection();
QListWidgetItem * item;
item = dlg->m_listImages->item(0);
dlg->m_buttonMoveUp->setEnabled( hasSelection && item && !item->isSelected() );
item = dlg->m_listImages->item( dlg->m_listImages->count() - 1 );
dlg->m_buttonMoveDown->setEnabled( hasSelection && item && !item->isSelected() );
}
示例2: on_action_EditPassword_triggered
void MainWindow::on_action_EditPassword_triggered()
{
int row = ui->listWidget->currentRow();
QListWidgetItem *widgetItem = ui->listWidget->currentItem();
if(row >= 0 && widgetItem && widgetItem->isSelected())
{
QList<PasswordItem> list = this->accountFile->getPasswordList();
PasswordDialog dialog;
dialog.setWindowTitle("编辑密码项");
dialog.setPasswordItem(list.at(row));
if(dialog.exec() == QDialog::Accepted)
{
PasswordItem item = dialog.getPasswordItem();
bool ok;
list[row].name = item.name;
list[row].password = item.password;
this->accountFile->setPasswordList(list);
ok = this->accountFile->save(this->accountFileName);
if(ok)
ui->listWidget->item(row)->setText(item.name);
}
}
}
示例3: if
std::vector<App::DocumentObject*> TaskFeaturePick::buildFeatures() {
int index = 0;
std::vector<App::DocumentObject*> result;
auto activeBody = PartDesignGui::getBody(false);
if (!activeBody)
return result;
auto activePart = PartDesignGui::getPartFor(activeBody, false);
for (std::vector<featureStatus>::const_iterator st = statuses.begin(); st != statuses.end(); st++) {
QListWidgetItem* item = ui->listWidget->item(index);
if(item->isSelected() && !item->isHidden()) {
QString t = item->text();
t = t.left(t.indexOf(QString::fromLatin1("(")) - 1);
auto obj = App::GetApplication().getActiveDocument()->getObject(t.toLatin1().data());
//build the dependend copy or reference if wanted by the user
if(*st == otherBody ||
*st == otherPart ||
*st == notInBody ) {
if(!ui->radioXRef->isChecked()) {
auto copy = makeCopy(obj, "", ui->radioIndependent->isChecked());
if(*st == otherBody)
activeBody->addFeature(copy);
else if(*st == otherPart) {
auto oBody = PartDesignGui::getBodyFor(obj, false);
if(!oBody)
activePart->addObject(copy);
else
activeBody->addFeature(copy);
}
else if(*st == notInBody) {
activeBody->addFeature(copy);
// doesn't supposed to get here anything but sketch but to be on the safe side better to check
if (copy->getTypeId().isDerivedFrom(Sketcher::SketchObject::getClassTypeId())) {
Sketcher::SketchObject *sketch = static_cast<Sketcher::SketchObject*>(copy);
PartDesignGui::fixSketchSupport(sketch);
}
}
result.push_back(copy);
}
else
result.push_back(obj);
}
else
result.push_back(obj);
break;
}
index++;
}
return result;
}
示例4: doLoadEVLR
bool LASOpenDlg::doLoadEVLR(size_t index) const
{
if (!extraFieldGroupBox->isChecked())
return false;
QListWidgetItem* item = evlrListWidget->item(static_cast<int>(index));
return item && item->isSelected();
}
示例5: _invertSelection
//-------------------------------------------------------------------------
void HandleRootsDialog::_invertSelection()
{
for( int i = 0; i < _ui->rootFolders->count(); i++ )
{
QListWidgetItem* item = _ui->rootFolders->item( i );
item->setSelected( !item->isSelected() );
}
}
示例6: listerSelected
void BaseForm::listerSelected(QStringList& output)
{
qint32 i = m_cnlist->count();
while (i--)
{
QListWidgetItem* itm = m_cnlist->item(i);
if (itm && itm->isSelected())
output << itm->text();
}
}
示例7: slotDeleteItem
void ClsQSAList::slotDeleteItem() {
int iCount = qlbox->count();
for(int ii=(iCount-1); ii>=0; ii--) {
QListWidgetItem *item = qlbox->item(ii);
if(item!=NULL) {
if(item->isSelected()) {
qlbox->takeItem(ii);
}
}
}
}
示例8: removeFilesClicked
void MosaicForm::removeFilesClicked() {
std::vector<std::string> lst;
for (int i = 0; i < lstFiles->count(); ++i) {
QListWidgetItem *item = lstFiles->item(i);
if (!item->isSelected())
lst.push_back(m_tifFiles[i]);
}
m_tifFiles.clear();
m_tifFiles.assign(lst.begin(), lst.end());
updateFileList();
checkRun();
}
示例9: removeSelectedFilesClicked
void FileList::removeSelectedFilesClicked() {
std::vector<std::string> lst;
size_t i = 0;
for (const std::string &file : m_files) {
QListWidgetItem *item = m_lstFiles->item(i);
if (!item->isSelected())
lst.push_back(file);
++i;
}
m_files.clear();
m_files.assign(lst.begin(), lst.end());
updateFileList();
}
示例10:
/**
* \brief Retrieve a list of selected task ids
*
* This method scans the task list and constructs a list of tasks that
* are selected.
*/
std::list<long> TaskMainWindow::selectedTaskids() {
debug(LOG_DEBUG, DEBUG_LOG, 0, "retrieve a list of selected items");
std::list<long> taskids;
for (int i = 0; i < ui->tasklistWidget->count(); i++) {
QListWidgetItem *item = ui->tasklistWidget->item(i);
if (item->isSelected()) {
TaskItem *ti = (TaskItem *)ui->tasklistWidget->itemWidget(item);
taskids.push_back(ti->id());
}
}
debug(LOG_DEBUG, DEBUG_LOG, 0, "%d selected task ids", taskids.size());
return taskids;
}
示例11: slotMoveDown
void BGMultiWallpaperDialog::slotMoveDown()
{
for ( int i = dlg->m_listImages->count() - 1; i > 0; i--)
{
QListWidgetItem * item = dlg->m_listImages->item( i - 1 );
if ( item && item->isSelected())
{
dlg->m_listImages->takeItem( i - 1 );
dlg->m_listImages->insertItem( i , item );
}
}
dlg->m_listImages->ensureSelectionVisible();
setEnabledMoveButtons();
}
示例12:
std::vector<unsigned int> GetConvolveParametersDialog::getBandSelectionIndices() const
{
std::vector<unsigned int> bands;
bands.reserve(mpBandSelect->count());
for (int i = 0; i < mpBandSelect->count(); ++i)
{
QListWidgetItem* pItem = mpBandSelect->item(i);
if (pItem != NULL && pItem->isSelected())
{
bands.push_back(i);
}
}
return bands;
}
示例13: icon
QString LancelotAppletConfig::icon() const
{
foreach (const QString & id, icons.keys()) //krazy:exclude=foreach
{
QListWidgetItem * item = icons[id];
if (item->isSelected()) {
if (id == "custom") {
return customIcon;
}
return id;
}
}
return "lancelot";
}
示例14: on_action_CopyPassword_triggered
void MainWindow::on_action_CopyPassword_triggered()
{
int row = ui->listWidget->currentRow();
QListWidgetItem *widgetItem = ui->listWidget->currentItem();
if(row >= 0 && widgetItem && widgetItem->isSelected())
{
QClipboard *clipboard = QApplication::clipboard();
QList<PasswordItem> list = this->accountFile->getPasswordList();
QString password = list.at(row).password;
clipboard->setText(password);
QTimer::singleShot(60 * 1000, this, SLOT(on_action_ClearClipboard_triggered()));
}
}
示例15: slotChangeVisibleItems
//=============================================================================
void DialogMeteotableOptions::slotChangeVisibleItems()
{
// copy visible items order from widget
for (int i=0; i<listVisibleData->count(); i++)
{
QListWidgetItem *widgitem = listVisibleData->item(i);
MeteotableOptionItem *item = getOptionItemByCode (widgitem->type());
item->pos = i;
}
// change visibility of selected items
QListWidget *listWidgetSource;
if (sender() == btAddVisibleItem) {
listWidgetSource = listHiddenData;
}
else {
listWidgetSource = listVisibleData;
}
for (int i=0; i<listWidgetSource->count(); i++)
{
QListWidgetItem *widgitem = listWidgetSource->item(i);
if (widgitem->isSelected())
{
// put all selected items at the end of the other list
MeteotableOptionItem *item = getOptionItemByCode (widgitem->type());
if (item) {
item->visible = ! item->visible; // reverse visibility
item->pos = nbOptionItems(item->visible)-1; // to the end of his category
}
}
}
// update positions after movings (numerate from 0)
qSort (listAllOptionItems.begin(), listAllOptionItems.end(),
MeteotableOptionItem::lessThan_byPos);
int posVis = 0;
int posNotVis = 0;
for (int i = 0; i < listAllOptionItems.size(); ++i) {
MeteotableOptionItem *item = listAllOptionItems.at(i);
if (item->visible) {
item->pos = posVis++;
}
else {
item->pos = posNotVis++;
}
}
updateListWidgetsItems ();
}