bool SessionManager::parseSiItem(QTreeWidgetItem *item, QString fromJid)
{
    int count = item->childCount();
    QMap<QString,QString> siAtt = getAttrList(item);
    QString sid = siAtt["id"];
    for(int i=0; i<count; i++)
    {
        QTreeWidgetItem *child = item->child(i);
        if(child->text(0)=="file")
        {
            QMap<QString, QString> attrs = getAttrList(child);
            QString fileName = attrs["name"];
            QString size = attrs["size"];
            status = READYRECEIVE;
            emit readyReceiveFile(fromJid, fileName, size.toInt(), sid);
            return true;
        }
    }
    status = READYSENT;
    emit readySentFile();
    return true;
}
Example #2
0
void CMYKChoose::selSwatch()
{
	QTreeWidgetItem *c = Swatches->currentItem();
	if (c == hsvSelector)
		TabStack->setCurrentIndex(0);
	else
	{
		CurrSwatch.clear();
		QString pfadC2 = "";
		QString txt = c->data(0, Qt::UserRole).toString() + "/" + c->text(0);
		if (!customColSet.contains(txt))
			pfadC2 = csm.paletteFileFromName(txt);
		else
			pfadC2 = csm.userPaletteFileFromName(txt);
		if (importColorsFromFile(pfadC2, CurrSwatch))
		{
			CurrSwatch.insert("White", ScColor(0, 0, 0, 0));
			CurrSwatch.insert("Black", ScColor(0, 0, 0, 255));
		}
		else
		{
			CurrSwatch.insert("White", ScColor(0, 0, 0, 0));
			CurrSwatch.insert("Black", ScColor(0, 0, 0, 255));
			ScColor cc = ScColor(255, 255, 255, 255);
			cc.setRegistrationColor(true);
			CurrSwatch.insert("Registration", cc);
			CurrSwatch.insert("Blue", ScColor(255, 255, 0, 0));
			CurrSwatch.insert("Cyan", ScColor(255, 0, 0, 0));
			CurrSwatch.insert("Green", ScColor(255, 0, 255, 0));
			CurrSwatch.insert("Red", ScColor(0, 255, 255, 0));
			CurrSwatch.insert("Yellow", ScColor(0, 0, 255, 0));
			CurrSwatch.insert("Magenta", ScColor(0, 255, 0, 0));
		}
		ColorSwatch->clear();
		ColorSwatch->insertFancyPixmapItems(CurrSwatch);
		ColorSwatch->setCurrentRow( 0 );
		TabStack->setCurrentIndex(1);
	}
}
Example #3
0
void ServiceManager::disableSlot()
{
    QTreeWidgetItem *item = listServices->currentItem();
      if (!item)
        return;
	  
    workingTreeWidgetItem = item;	 
	  
    // Disable the buttons until we are done
    setButtonsAllEnabled(false);
    QStringList rcList;
    QString tag = item->text(1);

    // Disable the buttons until we are done
    setButtonsAllEnabled(false);

    pcbsd::Utils::setConfFileValue( wDir + "/etc/rc.conf", tag, tag + "=\"NO\"", -1);

    // Set the service as enabled
    item->setText(4, tr("Disabled"));
    listSelectionChanged();
}
Example #4
0
void IdDialog::chatIdentity()
{
    QTreeWidgetItem *item = ui->treeWidget_IdList->currentItem();
    if (!item)
    {
        std::cerr << "IdDialog::editIdentity() Invalid item";
        std::cerr << std::endl;
        return;
    }

    std::string keyId = item->text(RSID_COL_KEYID).toStdString();

    QAction *action = qobject_cast<QAction *>(QObject::sender());
    if (!action)
        return ;

    RsGxsId from_gxs_id(action->data().toString().toStdString());
    uint32_t error_code ;

    if(!rsMsgs->initiateDistantChatConnexion(RsGxsId(keyId), from_gxs_id, error_code))
        QMessageBox::information(NULL, tr("Distant chat cannot work"), QString("%1 %2: %3").arg(tr("Distant chat refused with this person.")).arg(tr("Error code")).arg(error_code)) ;
}
Example #5
0
bool DisassembleWidget::displayCurrent()
{
    if(address_ < lower_ || address_ > upper_) return false;

    bool bFound=false;
    for (int line=0; line < m_treeWidget->topLevelItemCount(); line++)
    {
        QTreeWidgetItem* item = m_treeWidget->topLevelItem(line);
        unsigned long address = strtoul(item->text(Address).toLatin1(), 0, 0);

        if (address == address_)
        {
            // put cursor at start of line and highlight the line
            m_treeWidget->setCurrentItem(item);
            item->setIcon(Icon, icon_);
            bFound = true;  // need to process all items to clear icons
        }
        else if(!item->icon(Icon).isNull()) item->setIcon(Icon, QIcon());
    }

    return bFound;
}
Example #6
0
void KateBuildView::slotPrev()
{
    const int itemCount = m_buildUi.errTreeWidget->topLevelItemCount();
    if (itemCount == 0) {
        return;
    }

    QTreeWidgetItem *item = m_buildUi.errTreeWidget->currentItem();
    if (item && item->isHidden()) item = 0;

    int i = (item == 0) ? itemCount : m_buildUi.errTreeWidget->indexOfTopLevelItem(item);

    while (--i >= 0) {
        item = m_buildUi.errTreeWidget->topLevelItem(i);
        if (!item->text(1).isEmpty() && !item->isHidden()) {
            m_buildUi.errTreeWidget->setCurrentItem(item);
            m_buildUi.errTreeWidget->scrollToItem(item);
            slotErrorSelected(item);
            return;
        }
    }
}
Example #7
0
void IdDialog::sendMsg()
{
    QTreeWidgetItem *item = ui->treeWidget_IdList->currentItem();
    if (!item)
    {
        return;
    }

    MessageComposer *nMsgDialog = MessageComposer::newMsg();
    if (nMsgDialog == NULL) {
        return;
    }

    std::string keyId = item->text(RSID_COL_KEYID).toStdString();

    nMsgDialog->addRecipient(MessageComposer::TO,  RsGxsId(keyId));
    nMsgDialog->show();
    nMsgDialog->activateWindow();

    /* window will destroy itself! */

}
int ShapeFileOptionsWidget::getColumn(const QString& strField) const
{
   if (strField.isEmpty())
   {
      return -1;
   }

   QTreeWidgetItem* pHeaderItem = mpFeatureTree->headerItem();
   if (pHeaderItem != NULL)
   {
      for (int i = 0; i < pHeaderItem->columnCount(); i++)
      {
         QString strColumn = pHeaderItem->text(i);
         if (strColumn == strField)
         {
            return i;
         }
      }
   }

   return -1;
}
Example #9
0
void RegisteredUsersDialog::editGroup(KviRegisteredUserGroup * group)
{
	bool ok;

	QString text = QInputDialog::getText(this, "Change Group Name - KVIrc",
	    __tr2qs_ctx("Group name:", "register"), QLineEdit::Normal, group->name(), &ok);

	if(ok && !text.isEmpty())
	{
		QString szOldGroup = group->name();
		g_pLocalRegisteredUserDataBase->groupDict()->setAutoDelete(false);
		g_pLocalRegisteredUserDataBase->groupDict()->remove(szOldGroup);
		g_pLocalRegisteredUserDataBase->groupDict()->setAutoDelete(true);
		group->setName(text);
		g_pLocalRegisteredUserDataBase->groupDict()->insert(text, group);

		KviPointerHashTable<QString, KviRegisteredUser> * d = g_pLocalRegisteredUserDataBase->userDict();

		for(KviRegisteredUser * u = d->first(); u; u = d->next())
		{
			if(u->group() == szOldGroup)
				u->setGroup(text);
		}

		fillList();

		// select the last edited item
		for(int c = 0; c < m_pListView->topLevelItemCount(); c++)
		{
			QTreeWidgetItem * pGroup = m_pListView->topLevelItem(c);
			if(KviQString::equalCI(pGroup->text(0), text))
			{
				pGroup->setSelected(true);
				m_pListView->setCurrentItem(pGroup);
				break;
			}
		}
	}
}
Example #10
0
QTreeWidgetItem *EventBrowser::FindNode(QTreeWidgetItem *parent, QString filter, uint32_t after)
{
  for(int i = 0; i < parent->childCount(); i++)
  {
    QTreeWidgetItem *n = parent->child(i);

    uint eid = n->data(COL_EID, Qt::UserRole).toUInt();

    if(eid > after && n->text(COL_NAME).contains(filter, Qt::CaseInsensitive))
      return n;

    if(n->childCount() > 0)
    {
      QTreeWidgetItem *found = FindNode(n, filter, after);

      if(found != NULL)
        return found;
    }
  }

  return NULL;
}
void ManageInterfacesDialog::showRemoteInterfaces()
{
    guint i;
    interface_t device;
    QTreeWidgetItem *item = NULL;

    // We assume that remote interfaces are grouped by host.
    for (i = 0; i < global_capture_opts.all_ifaces->len; i++) {
        QTreeWidgetItem *child;
        device = g_array_index(global_capture_opts.all_ifaces, interface_t, i);
        if (!device.local) {
            if (!item || item->text(col_r_host_dev_).compare(device.remote_opts.remote_host_opts.remote_host) != 0) {
                item = new QTreeWidgetItem(ui->remoteList);
                item->setText(col_r_host_dev_, device.remote_opts.remote_host_opts.remote_host);
                item->setExpanded(true);
            }
            child = new QTreeWidgetItem(item);
            child->setCheckState(col_r_show_, device.hidden ? Qt::Unchecked : Qt::Checked);
            child->setText(col_r_host_dev_, QString(device.name));
        }
    }
}
Example #12
0
void IdDialog::removeIdentity()
{
    QTreeWidgetItem *item = ui->treeWidget_IdList->currentItem();
    if (!item)
    {
#ifdef ID_DEBUG
        std::cerr << "IdDialog::editIdentity() Invalid item";
        std::cerr << std::endl;
#endif
        return;
    }

    if ((QMessageBox::question(this, tr("Really delete?"), tr("Do you really want to delete this identity?"), QMessageBox::Yes|QMessageBox::No, QMessageBox::No))== QMessageBox::Yes)
    {
        std::string keyId = item->text(RSID_COL_KEYID).toStdString();

        uint32_t dummyToken = 0;
        RsGxsIdGroup group;
        group.mMeta.mGroupId=RsGxsGroupId(keyId);
        rsIdentity->deleteIdentity(dummyToken, group);
    }
}
Example #13
0
/*! \brief Called when a resource became avaible
    \param which
*/
void ApplicationViewWidget::onResAvailable(int which)
{

    QTreeWidgetItem *it = ui->resourcesList->topLevelItem(which);
    if(it){
        it->setText(3,"available");
        if(it->text(2) == "computer"){
            it->setIcon(0,QIcon(":/images/computer_ico.png"));
            it->setTextColor(3,QColor("#008C00"));
        }else{
            it->setIcon(0,QIcon(":/images/port_avail_ico.png"));
            it->setTextColor(3,QColor("#008C00"));
        }
        /*if(row[m_resColumns.m_col_type] == Glib::ustring("computer"))
            row.set_value(0, m_refPixAvailable);
        else
            row.set_value(0, m_refPixPortAvaibable);*/
    }


    reportErrors();
}
void ManageInterfacesDialog::on_remoteSettings_clicked()
{
    guint i = 0;
    interface_t device;
    QTreeWidgetItem* item = ui->remoteList->currentItem();
    if (!item) {
        return;
    }

    for (i = 0; i < global_capture_opts.all_ifaces->len; i++) {
        device = g_array_index(global_capture_opts.all_ifaces, interface_t, i);
        if (!device.local) {
            if (item->text(col_r_host_dev_).compare(device.name)) {
               continue;
            } else {
                RemoteSettingsDialog *dlg = new RemoteSettingsDialog(this, &device);
                dlg->show();
                break;
            }
        }
    }
}
void StaffTextProperties::saveChannel(int channel)
      {
      QList<ChannelActions>* ca = _staffText->channelActions();
      int n = ca->size();
      for (int i = 0; i < n; ++i) {
            ChannelActions* a = &(*ca)[i];
            if (a->channel == channel) {
                  ca->removeAt(i);
                  break;
                  }
            }

      ChannelActions a;
      a.channel = channel;

      for (int i = 0; i < actionList->topLevelItemCount(); ++i) {
            QTreeWidgetItem* item = actionList->topLevelItem(i);
            if (item->isSelected())
                  a.midiActionNames.append(item->text(0));
            }
      ca->append(a);
      }
Example #16
0
void InputProfileEditor::slotSensitivitySpinChanged(int value)
{
    QLCInputChannel* channel;
    quint32 chnum;
    QTreeWidgetItem* item;

    QListIterator <QTreeWidgetItem*>
    it(m_tree->selectedItems());
    while (it.hasNext() == true)
    {
        item = it.next();
        Q_ASSERT(item != NULL);

        chnum = item->text(KColumnNumber).toUInt() - 1;
        channel = m_profile->channel(chnum);
        Q_ASSERT(channel != NULL);

        if (channel->type() == QLCInputChannel::Slider &&
            channel->movementType() == QLCInputChannel::Relative)
                channel->setMovementSensitivity(value);
    }
}
// Stabilize form status.
void qtractorMidiControlForm::stabilizeForm (void)
{
	if (m_iUpdating > 0)
		return;

	QTreeWidgetItem *pItem = m_ui.FilesListView->currentItem();
	if (pItem) {
		const int iItem = m_ui.FilesListView->indexOfTopLevelItem(pItem);
		const int iItemCount = m_ui.FilesListView->topLevelItemCount();
		m_ui.RemovePushButton->setEnabled(true);
		m_ui.MoveUpPushButton->setEnabled(iItem > 0);
		m_ui.MoveDownPushButton->setEnabled(iItem < iItemCount - 1);
	} else {
		m_ui.RemovePushButton->setEnabled(false);
		m_ui.MoveUpPushButton->setEnabled(false);
		m_ui.MoveDownPushButton->setEnabled(false);
	}

	pItem = m_ui.ControlMapListView->currentItem();
	if (pItem) {
		++m_iUpdating;
		m_pControlTypeGroup->setControlType(
			qtractorMidiControl::typeFromName(pItem->text(0)));
		m_pControlTypeGroup->setControlParam( // remove non-digits tail...
			pItem->text(2).remove(QRegExp("[\\D]+.*$")).toUShort());
		m_ui.ChannelComboBox->setCurrentIndex(
			m_ui.ChannelComboBox->findText(pItem->text(1)));
		QString sText = pItem->text(3);
		m_ui.TrackCheckBox->setChecked(sText[0] == '+');
		m_ui.TrackSpinBox->setValue( // remove non-digits any...
			sText.remove(QRegExp("[\\D]*")).toInt());
		m_ui.CommandComboBox->setCurrentIndex(
			m_ui.CommandComboBox->findText(pItem->text(4)));
		m_ui.FeedbackCheckBox->setChecked(pItem->text(5) == tr("Yes"));
		--m_iUpdating;
	}

	m_ui.ReloadPushButton->setEnabled(m_iDirtyMap > 0);

	qtractorMidiControl *pMidiControl = qtractorMidiControl::getInstance();
	if (pMidiControl)
		m_ui.ExportPushButton->setEnabled(
			!pMidiControl->controlMap().isEmpty());

	stabilizeKeyChange();
}
Example #18
0
void ModulesDialog::moduleAction(QTreeWidgetItem *)
{
	kdebugf();

	QTreeWidgetItem *selectedItem = getSelected();
	if (!selectedItem)
		return;

	// TODO: OH LOL
	if ((selectedItem->text(2) == tr("Dynamic")) && (selectedItem->text(3) == tr("Loaded")))
		unloadItem(selectedItem->text(0));
	else
		if ((selectedItem->text(2) == tr("Dynamic")) && (selectedItem->text(3) == tr("Not loaded")))
			loadItem(selectedItem->text(0));

	kdebugf2();
}
void GCF::Components::ScriptableObjectExplorer::on_itemDoubleClicked(QTreeWidgetItem* item)
{
    if(!item)
        return;

    int type = item->type();
    QTreeWidgetItem* objItem = item;
    QObject* object = 0;
    QString objectName;

    while(objItem && objItem->type() != OBJECT_ITEM)
        objItem = objItem->parent();

    if(!objItem)
        return;

    object = objItem->data(0, Qt::UserRole).value<QObject*>();
    objectName = objItem->text(1);

    switch(type)
    {
    case OBJECT_ITEM:
        emit objectDoubleClicked(object, objectName);
        break;
    case METHOD_ITEM: {
        QMetaMethod m = item->data(0, Qt::UserRole).value<QMetaMethod>();
        emit methodDoubleClicked(object, objectName, item->text(0), QString(m.signature()) );
        } break;
    case EVENT_ITEM:  {
        QMetaMethod m = item->data(0, Qt::UserRole).value<QMetaMethod>();
        emit signalDoubleClicked(object, objectName, item->text(0), QString(m.signature()) );
        } break;
    case PROPERTY_ITEM:{
        QMetaProperty prop = item->data(0, Qt::UserRole).value<QMetaProperty>();
        emit propertyDoubleClicked(object, objectName, item->text(0), QString(prop.typeName()));
        } break;
    }
}
Example #20
0
//鼠标右键单击列表
void MessageTreeWidget::contextMenuEvent ( QContextMenuEvent * event )
{
	popMenu->clear();//清除原有菜单	
	QString strPName;	
	QTreeWidgetItem *item = NULL;//获得当前双击对象
	QPoint point = event->pos();//等到窗口坐标
	item = this->itemAt(point);//
	
	if(item==NULL)
	{
		return ;
	}
	currentClickItem = item;
	QTreeWidgetItem *parent = item->parent();
	
	if(parent==NULL)
	{
		strPName = currentClickItem->text(0);
		if(QString::compare(strPName,"信息")==0)
		{
			popMenu->addAction(importSmsAction);
			popMenu->exec(QCursor::pos());//菜单出现的位置为当前鼠标的位置
			event->accept();
		}
		 return ;
	}
	popMenu->addAction(readMessageAction);//添加查看菜单,该菜单是每个信息都具有的
	strPName = parent->text(0);//text是获得当前行的第几列的文本
	if(QString::compare(strPName,"垃圾箱")==0)
	{
		popMenu->addAction(recoverAction);	

	}
	popMenu->addAction(deleteMessageAction);		

	popMenu->exec(QCursor::pos());//菜单出现的位置为当前鼠标的位置
	event->accept();
}
QWidget* PathChooserDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const
{
    Q_UNUSED(index)

    QTreeWidgetItem *item = tree_->currentItem();
    if (!item) {
        return NULL;
    }
    path_item_ = item;

    path_editor_ = new QWidget(parent);
    QHBoxLayout *hbox = new QHBoxLayout(path_editor_);
    path_editor_->setLayout(hbox);
    path_le_ = new QLineEdit(path_editor_);
    QPushButton *pb = new QPushButton(path_editor_);

    path_le_->setText(item->text(col_p_pipe_));
    pb->setText(QString(tr("Browse...")));

    hbox->setContentsMargins(0, 0, 0, 0);
    hbox->addWidget(path_le_);
    hbox->addWidget(pb);
    hbox->setSizeConstraint(QLayout::SetMinimumSize);

    // Grow the item to match the editor. According to the QAbstractItemDelegate
    // documenation we're supposed to reimplement sizeHint but this seems to work.
    QSize size = option.rect.size();
    size.setHeight(qMax(option.rect.height(), hbox->sizeHint().height()));
    item->setData(col_p_pipe_, Qt::SizeHintRole, size);

    path_le_->selectAll();
    path_editor_->setFocusProxy(path_le_);
    path_editor_->setFocusPolicy(path_le_->focusPolicy());

    connect(path_le_, SIGNAL(destroyed()), this, SLOT(stopEditor()));
    connect(pb, SIGNAL(pressed()), this, SLOT(browse_button_clicked()));
    return path_editor_;
}
Example #22
0
void CirclesDialog::friend_selected()
{
	/* update circle lists */
	QTreeWidgetItem *item = ui.treeWidget_friends->currentItem();

	if ((!item) || (!item->parent()))
	{
		return;
	}

	set_tree_background(ui.treeWidget_membership, CLEAR_BACKGROUND);
	set_tree_background(ui.treeWidget_friends, CLEAR_BACKGROUND);
	set_tree_background(ui.treeWidget_category, CLEAR_BACKGROUND);

	set_item_background(item, BLUE_BACKGROUND);

	std::string id = item->text(CIRCLEGROUP_FRIEND_COL_ID).toStdString();

	/* update permission lists */
	std::set<std::string> names;
	names.insert(id);
	mark_circle_tree(ui.treeWidget_membership, names);
}
Example #23
0
void FunctionsTreeWidget::slotItemChanged(QTreeWidgetItem *item)
{
    blockSignals(true);
    qDebug() << "TREE item changed";
    if (item->text(COL_PATH).isEmpty())
        return;

    QTreeWidgetItem *parent = item->parent();
    if (parent != NULL)
    {
        QString fullPath = parent->text(COL_PATH);

        if (fullPath.endsWith('/') == false)
            fullPath.append("/");
        fullPath.append(item->text(COL_NAME));

        m_foldersMap.remove(item->text(COL_PATH));
        item->setText(COL_PATH, fullPath);
        m_foldersMap[fullPath] = item;
        slotUpdateChildrenPath(item);
    }
    blockSignals(false);
}
Example #24
0
void FunctionManager::slotBusTriggered(QAction* action)
{
	/* Bus actions are in ascending order in the list so the index of
	   the triggered action is also the ID of the bus represented by
	   the action. */
	t_bus_id busID = m_busActions.indexOf(action);

	/* Set the selected bus to all selected functions */
	QListIterator <QTreeWidgetItem*> it(m_functionTree->selectedItems());
	while (it.hasNext() == true)
	{
		QTreeWidgetItem* item;
		Function* function;

		item = it.next();
		Q_ASSERT(item != NULL);
		function = _app->doc()->function(item->text(KColumnID).toInt());
		Q_ASSERT(function != NULL);

		function->setBus(busID);
		updateFunctionItem(item, function);
	}
}
Example #25
0
bool DisassembleWidget::displayCurrent()
{
    if(address_ < lower_ || address_ > upper_) return false;

    bool bFound=false;
    for (int line=0; line < m_disassembleWindow->topLevelItemCount(); line++)
    {
        QTreeWidgetItem* item = m_disassembleWindow->topLevelItem(line);
        unsigned long address = item->text(Address).toULong(&ok,16);

        if (address == address_)
        {
            // put cursor at start of line and highlight the line
            m_disassembleWindow->setCurrentItem(item);
            static const QIcon icon = QIcon::fromTheme(QStringLiteral("go-next"));
            item->setIcon(Icon, icon);
            bFound = true;  // need to process all items to clear icons
        }
        else if(!item->icon(Icon).isNull()) item->setIcon(Icon, QIcon());
    }

    return bFound;
}
Example #26
0
void SelectOutput::on_searchLE_textChanged(const QString&)
{
	int top = ui->midiOutNames->topLevelItemCount();
	for (int i = 0; i < top; i++) {
		QTreeWidgetItem* curItem = ui->midiOutNames->topLevelItem(i);
		curItem->setHidden(false);
	}
	if (ui->searchLE->text() == "") {
		return;
	}

	QStringList terms = ui->searchLE->text().split(" ");
	QString curTerm;

	for (int i = 0; i < top; i++) {
		QTreeWidgetItem* curItem = ui->midiOutNames->topLevelItem(i);
		foreach (curTerm, terms) {
			if (!curItem->text(1).contains(curTerm, Qt::CaseInsensitive)) {
				curItem->setHidden(true);
			}
		}
	}
}
Example #27
0
void KFFWin_Flightplan::getCurrentList( QStringList & list )
{
	QTreeWidgetItem* item = 0;
	QString buffer;
	int i, j;

	for ( i = 0 ; i < ui_widget.treewidget_navaids->topLevelItemCount() ; i++ )
	{
		item = 0;
		buffer.clear();
		item = ui_widget.treewidget_navaids->topLevelItem( i );

		if ( item )
		{
			for ( j = 0 ; j < ui_widget.treewidget_navaids->columnCount() ; j++ )
			{
				buffer.append( item->text( j ) + "|" );
			}

			list << buffer;
		}
	}
}
Example #28
0
int EventBrowser::SetFindIcons(QTreeWidgetItem *parent, QString filter)
{
  int results = 0;

  for(int i = 0; i < parent->childCount(); i++)
  {
    QTreeWidgetItem *n = parent->child(i);

    if(n->text(COL_NAME).contains(filter, Qt::CaseInsensitive))
    {
      n->setData(COL_FIND, Qt::UserRole, QVariant(true));
      RefreshIcon(n);
      results++;
    }

    if(n->childCount() > 0)
    {
      results += SetFindIcons(n, filter);
    }
  }

  return results;
}
Example #29
0
void FunctionsTreeWidget::slotUpdateChildrenPath(QTreeWidgetItem *root)
{
    if (root->childCount() == 0)
        return;
    for (int i = 0; i < root->childCount(); i++)
    {
        QTreeWidgetItem *child = root->child(i);

        // child can be a function node or another folder
        QString path = child->text(COL_PATH);
        if (path.isEmpty()) // function node
        {
            quint32 fid = child->data(COL_NAME, Qt::UserRole).toUInt();
            Function *func = m_doc->function(fid);
            if (func != NULL)
                func->setPath(root->text(COL_PATH));
        }
        else
        {
            slotItemChanged(child);
        }
    }
}
Example #30
0
void MenuBarTree::contextMenuEvent(QContextMenuEvent * event)
{
	QTreeWidgetItem* item = itemAt(event->pos());
	if (item != currentItem())
		setCurrentItem(item);
	QMenu* menu = new QMenu(this);
	QAction * action;
	if (!item || indexOfTopLevelItem(item) >= 0)
		action = menu->addAction(tr("Insert Menu"));
	else
		action = menu->addAction(tr("Insert Submenu"));

	connect(action, SIGNAL(triggered()), this, SLOT(insertMenu()));

	if (item)
	{
		action = menu->addAction(tr("Remove \"%1\"").arg(item->text(0)));
		connect(action, SIGNAL(triggered()), this, SLOT(removeItem()));
	}

	menu->exec(event->globalPos());
	delete menu;
}