ListDialog::ListDialog() : QDialog()
{
    ui.setupUi(this);

    connect(ui.addButton, SIGNAL(clicked()), this, SLOT(addItem()));
    connect(ui.editButton, SIGNAL(clicked()), this, SLOT(editItem()));
    connect(ui.deleteButton, SIGNAL(clicked()), this, SLOT(deleteItem()));
}
void TeethX::lvMain_KeyDown(Win::Event& e)
{
	LPNMLVKEYDOWN p = (LPNMLVKEYDOWN) e.lParam;
	if (p->wVKey == VK_DELETE)
	{
		deleteItem();
	}
}
void CTabbedInt::reset()
{
	deleteItem(activeTab);
	activeTab = createItem(activeID);
	activeTab->moveTo(pos.topLeft());

	if (active)
		redraw();
}
void MusicSongsSummarizied::contextMenuEvent(QContextMenuEvent *event)
{
    QMenu menu(this);
    menu.setStyleSheet(MusicUIObject::MMenuStyle02);
    menu.addAction(QIcon(":/contextMenu/delete"), tr("deleteItem"), this, SLOT(deleteItem()));
    menu.addAction(QIcon(":/contextMenu/add"), tr("addNewItem"), this, SLOT(addNewItem()));
    menu.addAction(tr("changItemName"), this, SLOT(changItemName()));
    menu.exec(event->globalPos());
}
Example #5
0
void
destroyKeyboardInstanceObject (KeyboardInstanceObject *kio) {
  flushKeyEvents(kio);
  if (kio->events.buffer) free(kio->events.buffer);

  deleteItem(kio->kmo->instanceQueue, kio);
  if (kio->kix) destroyKeyboardInstanceExtension(kio->kix);
  free(kio);
}
void JsonDbSortingListModelPrivate::sendNotifications(int partitionIndex, const QVariantMap &v, QJsonDbWatcher::Action action)
{
    if (action == QJsonDbWatcher::Created) {
        addItem(v, partitionIndex);
    } else if (action == QJsonDbWatcher::Removed) {
        deleteItem(v, partitionIndex);
    } else if (action == QJsonDbWatcher::Updated) {
        updateItem(v, partitionIndex);
    }
}
/**
 * Slot for deleting an item called from the popup menu.
 */
void RefactoringAssistant::deleteItem()
{
    QTreeWidgetItem *item = currentItem();
    if (item) {
        UMLObject *o = findUMLObject(item);
        if (o) {
            deleteItem(item, o);
        }
    }
}
void CListBox::reset()
{
	size_t current = first;
	for (std::list<CIntObject*>::iterator it = items.begin(); it!=items.end(); it++)
	{
		deleteItem(*it);
		*it = createItem(current++);
	}
	updatePositions();
}
void WidgetListEditor::addItem(QWidget *item)
{
  WidgetListItem* widgetListItem = new WidgetListItem(this);
  widgetListItem->setItem(item);
  ui->list->addWidget(widgetListItem);

  connect(widgetListItem, SIGNAL(deleteItem()), this, SLOT(on_deleteItem()));
  connect(widgetListItem, SIGNAL(moveUp()), this, SLOT(on_moveUp()));
  connect(widgetListItem, SIGNAL(moveDown()), this, SLOT(on_moveDown()));
}
Example #10
0
/**
 * Xoa tat ca cac item co itemID thuoc list itemIDs.
 * @param itemIDs
 * @return bool
 */
bool ItemDB::deleteAllItem(vector<string> itemIDs, ItemTagDB& itemTagDB) {
    int size = itemIDs.size();
    bool result = true;
    for (int i = 0; i < size; i++) {
        if (!deleteItem(itemIDs[i], itemTagDB)) {
            poco_error_f1(*logger, "deleteAllItem: Error to delete ItemID = %s", itemIDs[i]);
            result = false;
        }
    }
    return result;
}
Example #11
0
void BST::deleteItem(TreeNode *& treePtr,
                                  KeyType searchKey)
                                  throw(TreeException)
// Calls: deleteNodeItem.
{
   if (treePtr == NULL)
      throw TreeException("TreeException: delete failed");  // empty tree

   else if (searchKey == treePtr->item.getKey())
      // item is in the root of some subtree
      deleteNodeItem(treePtr);  // delete the item

   // else search for the item
   else if (searchKey < treePtr->item.getKey())
      // search the left subtree
      deleteItem(treePtr->leftChildPtr, searchKey);

   else  // search the right subtree
      deleteItem(treePtr->rightChildPtr, searchKey);
}  // end deleteItem
Example #12
0
bool Q3GList::removeRef( Q3PtrCollection::Item d )
{
    if ( findRef(d) == -1 )
	return false;
    Q3LNode *n = unlink();
    if ( !n )
	return false;
    deleteItem( n->data );
    delete n;
    return true;
}
Example #13
0
/*!
  Replaces the item at index \a index with \a d.
*/
bool Q3GList::replaceAt( uint index, Q3PtrCollection::Item d )
{
    Q3LNode *n = locate( index );
    if ( !n )
	return false;
    if ( n->data != d ) {
	deleteItem( n->data );
	n->data = newItem( d );
    }
    return true;
}
Example #14
0
bool Q3GList::removeAt( uint index )
{
    if ( !locate(index) )
	return false;
    Q3LNode *n = unlink();
    if ( !n )
	return false;
    deleteItem( n->data );
    delete n;
    return true;
}
Example #15
0
int main(int argc, char *argv[])
{


	FILE *file = initFile();
	init(file);
	if(argc == 1){
		printItems();
	} else {


		if(!strcmp(argv[1],"add")){
			if(argc<3){
				printf("Usage: todo add [<priority>] <text>\n");
			} else {
				insertItem(argv,argc);
			}
		}

		if(!strcmp(argv[1],"del")){
			if(argc<3){
				printf("Usage: todo del <id>\n");
			} else {
				deleteItem(atoi(argv[2]));
			}
		}

		if(!strcmp(argv[1],"swap")){
			if(argc<4){
				printf("Usage: todo swap <id1> <id2>\n");
			} else {
				swapIDs(atoi(argv[2]), atoi(argv[3]));
			}
		}

		/*
		if(!strcmp(argv[1],"prio")){
			if(argc < 4){
				printf("Usage: todo prio <id> <new_prio>\n");
			} else {
				changePrio(atoi(argv[2]), atoi(argv[3]));

			}


		}
		*/
	}
	cleanUp();



	return 0;
}
void UserFunctionListWidget::keyPressEvent(QKeyEvent* event)
{
    if (event->key() == Qt::Key_Delete)
        deleteItem();
    else if (event->key() == Qt::Key_E)
        editItem();
    else {
        QWidget::keyPressEvent(event);
        return;
    }
    event->accept();
}
Example #17
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    ui->progressBar->setVisible(false);
    ui->widthSpinBox->setValue(Settings::instance()->width());
    ui->heightSpinBox->setValue(Settings::instance()->height());

    new QShortcut(QKeySequence(Qt::Key_Delete), this, SLOT(deleteItem()));
}
Example #18
0
void CListBox::moveToNext()
{
	//Remove front item and insert new one to end
	if (first + items.size() < totalSize)
	{
		first++;
		deleteItem(items.front());
		items.pop_front();
		items.push_back(createItem(first+items.size()));
		updatePositions();
	}
}
Example #19
0
void CListBox::moveToPrev()
{
	//Remove last item and insert new one at start
	if (first)
	{
		first--;
		deleteItem(items.back());
		items.pop_back();
		items.push_front(createItem(first));
		updatePositions();
	}
}
Example #20
0
void LoLEngine::updateObjectFlightPosition(FlyingObject *t) {
	if (t->objectType == 0) {
		setItemPosition(t->item, t->x, t->y, t->flyingHeight, (t->flyingHeight == 0) ? 1 : 0);
	} else if (t->objectType == 1) {
		if (t->flyingHeight == 0) {
			deleteItem(t->item);
			checkSceneUpdateNeed(calcBlockIndex(t->x, t->y));
		} else {
			setItemPosition(t->item, t->x, t->y, t->flyingHeight, 0);
		}
	}
}
Example #21
0
void QGVector::clear()				// clear vector
{
    if ( vec ) {
	for ( uint i=0; i<len; i++ ) {		// delete each item
	    if ( vec[i] )
		deleteItem( vec[i] );
	}
	DELETE(vec);
	vec = 0;
	len = numItems = 0;
    }
}
Example #22
0
void AdBlockTreeWidget::removeRule()
{
    QTreeWidgetItem* item = currentItem();
    if (!item || !m_subscription->canEditRules() || item == m_topItem) {
        return;
    }

    int offset = item->data(0, Qt::UserRole + 10).toInt();

    m_subscription->removeRule(offset);
    deleteItem(item);
}
Example #23
0
void ToDoPapers::cleanAndRefresh()
{
    while( !p->items.isEmpty() )
        deleteItem(p->items.first());

    const QString & text = p->text;

    int lastPos = 0;
    int pos = text.indexOf("\n",lastPos);
    while( pos != text.length() )
    {
        if( pos == -1 )
            pos = text.length();

        const QString & str = text.mid(lastPos,pos-lastPos);
        const QString & slc = str.mid(0,2);
        bool checkable = (slc=="* " || slc=="- ");

        if( !checkable && !p->items.isEmpty() )
        {
            p->signal_blocker = true;
            ToDoPapersItem *item = p->items.last();
            item->setText( item->text() + "\n" + str );
            p->signal_blocker = false;
        }
        else
        {
            ToDoPapersItem *item = new ToDoPapersItem(this);
            item->setCheckable(checkable);
            item->setText( checkable? str.mid(2) : str );
            item->setChecked( slc=="* " );

            connect( item, SIGNAL(textChanged())   , SLOT(refreshText()) );
            connect( item, SIGNAL(checkedChanged()), SLOT(refreshText()) );

            connect( item, SIGNAL(accepted(ToDoPapersItem*))  , SLOT(createItemAfter(ToDoPapersItem*)) );
            connect( item, SIGNAL(removed(ToDoPapersItem*))   , SLOT(removeItem(ToDoPapersItem*))      );
            connect( item, SIGNAL(removeNext(ToDoPapersItem*)), SLOT(removeNextItem(ToDoPapersItem*))  );

            connect( item, SIGNAL(upPressed(ToDoPapersItem*))  , SLOT(focusOnUp(ToDoPapersItem*))   );
            connect( item, SIGNAL(downPressed(ToDoPapersItem*)), SLOT(focusOnDown(ToDoPapersItem*)) );

            p->items << item;
            p->base_layout->insertWidget(p->base_layout->count()-1,item);
            item->show();
        }

        lastPos = pos+1;
        if( pos != text.length() )
            pos = text.indexOf("\n",lastPos);
    }
}
Example #24
0
void Column::updatePos(qreal t)
{
    qreal newX = pos().x() + v * t;
    qreal newY = pos().y();
    if (newX + boundingRect().width() < 0)
    {
        emit deleteItem(this);
    }
    else
    {
        setPos(newX, newY);
    }
}
Example #25
0
void* Hashtable::remove(const void* key, size_t len)
{
    void* value = (void*)0;
    List* l = bucket(key, len);
    if (l) {
        Item* i = remove(l, key, len);
        if (i) {
            value = i->value;
            deleteItem(i);
        }
    }
    return value;
}
Example #26
0
dragTarget::dragTarget (dragSource *source, QWidget *parent ) : QTreeWidget ( parent )
{
  //let's initialize the dropIndicator
  indicator = new QWidget(viewport());
  indicator -> setAutoFillBackground(true);
  QPalette pale = indicator -> palette();
  pale.setColor(QPalette::Base, Qt::blue);
  indicator -> setPalette(pale);
  hideIndicator();
  //let's initialize some pointers...
  sourceView = source;
  scrollUpTimer = new QTimer();
  scrollDownTimer = new QTimer();

  indicatorToRestore = NULL;
  //setVerticalScrollMode(QAbstractItemView::ScrollPerPixel);
  //...and some list settings
  subLevel = false;
  setAcceptDrops ( true );
  setDragEnabled ( true );
  setAutoScroll(true);
  setDragDropMode ( QAbstractItemView::DragDrop );
  setColumnCount ( 4 );
  setHeaderLabels ( QStringList() <<tr ( "Item" ) <<tr ( "Path" ) <<tr ( "MimeType" ) <<tr ( "Size" ) );
  header() -> moveSection ( 3,1 );
  setColumnWidth ( 0,170 );
  setDropIndicatorShown ( true );
  //setAnimated ( true );

  newFolder = new QAction ( tr ( "New Folder" ), this );
  newFolder -> setIcon ( KIcon ( "folder-new" ) );
  //newFolder -> setShortcut(QKeySequence(tr("Ctrl+A")));
  //this -> addAction(newFolder);
  delItem = new QAction ( tr ( "Delete Item" ), this );
  delItem -> setIcon ( KIcon ( "edit-delete" ) );
  //delItem -> setShortcut(QKeySequence(tr("Del"))); //TODO check!
  //this -> addAction(delItem);
  //this-> setContextMenuPolicy(Qt::DefaultContextMenu); //se non imposto defaultcontextmenu non posso reimplementare la gestione del contextmenu

  //creo il menu
  menu = new QMenu ( tr ( "Options" ),this );
  menu -> addAction ( newFolder );
  menu -> addAction ( delItem );
  connect ( newFolder, SIGNAL ( triggered() ), this, SLOT ( createNewFolder() ) );
  connect ( delItem, SIGNAL ( triggered() ), this, SLOT ( deleteItem() ) );
  delItem -> setEnabled ( false );
  setItemsExpandable ( true );
  setSelectionMode(QAbstractItemView::ExtendedSelection);
  //setSelectionMode(QAbstractItemView::ExtendedSelection); //inizialmente viene gestita solo la selezione singola

}
Example #27
0
EntryBackup * RelativeResourceModel::removeEntry(const QModelIndex &index)
{
    const QModelIndex prefixIndex = this->prefixIndex(index);
    const bool isPrefixNode = (prefixIndex == index);

    // Create backup, remove, return backup
    if (isPrefixNode) {
        QString dummy;
        QString prefixBackup;
        getItem(index, prefixBackup, dummy);
        const QString languageBackup = lang(index);
        const int childCount = rowCount(index);
        QList<FileEntryBackup> filesBackup;
        for (int i = 0; i < childCount; i++) {
            const QModelIndex childIndex = this->index(i, 0, index);
            const QString fileNameBackup = file(childIndex);
            const QString aliasBackup = alias(childIndex);
            FileEntryBackup entry(*this, index.row(), i, fileNameBackup, aliasBackup);
            filesBackup << entry;
        }
        deleteItem(index);
        return new PrefixEntryBackup(*this, index.row(), prefixBackup, languageBackup, filesBackup);
    } else {
        const QString fileNameBackup = file(index);
        const QString aliasBackup = alias(index);
        if (!QFile::exists(fileNameBackup)) {
            deleteItem(index);
            return new FileEntryBackup(*this, prefixIndex.row(), index.row(), fileNameBackup, aliasBackup);
        }
        Core::RemoveFileDialog removeFileDialog(fileNameBackup, Core::ICore::mainWindow());
        if (removeFileDialog.exec() == QDialog::Accepted) {
            deleteItem(index);
            Core::FileUtils::removeFile(fileNameBackup, removeFileDialog.isDeleteFileChecked());
            return new FileEntryBackup(*this, prefixIndex.row(), index.row(), fileNameBackup, aliasBackup);
        }
        return 0;
    }
}
Example #28
0
void *ListView::processEvent(Event *e)
{
    if (e->type() == EventCommandExec){
        CommandDef *cmd = (CommandDef*)(e->param());
        if ((cmd->id == CmdListDelete) && (cmd->menu_id == MenuListView)){
            QTreeWidgetItem *item = (QTreeWidgetItem*)(cmd->param);
            if (item->treeWidget() == this){
                emit deleteItem(item);
                return e->param();
            }
        }
    }
    return NULL;
}
Example #29
0
bool TreeComboFilterItemWidget::eventFilter(QObject *obj, QEvent *event)
{
    if ((obj == _comboBox || obj==_deleteBtn) && event->type() == QEvent::KeyPress ) {
        QKeyEvent *ke = static_cast<QKeyEvent*>(event);
        if (ke->key() == Qt::Key_Delete && ke->modifiers() == 0) {
            if(_deleteBtn)
                deleteItem();
        }
        else if(ke->key() == Qt::Key_Backspace && ke->modifiers() == 0){
            doReset();
        }
    }
    return FilterItemWidget::eventFilter(obj, event);
}
ParameterProperties::ParameterProperties(QWidget* parent, Qt::WindowFlags fl)
    : QDialog(parent, fl)
{
  setupUi(this);

  connect(_listDelete, SIGNAL(clicked()), this, SLOT(deleteItem()));
  connect(_listDown,   SIGNAL(clicked()), this, SLOT(moveItemDown()));
  connect(_listEdit,   SIGNAL(clicked()), this, SLOT(editItem()));
  connect(_listNew,    SIGNAL(clicked()), this, SLOT(newItem()));
  connect(_listUp,     SIGNAL(clicked()), this, SLOT(moveItemUp()));

  _int->setValidator(new QIntValidator(this));
  _double->setValidator(new QDoubleValidator(this));
}