Example #1
0
void QTodoList::sort()
{
	QTodoSortDialog sort_dialog;

	deselectAll();

	if(sort_dialog.exec() == QDialog::Accepted)
	{
		preserveContentsYPos();
		const QTodoSortCriteriaMap* criterias = sort_dialog.getCriterias();

		QPtrList<QWidget> list_widgets;
		list_widgets.append(0);
		QTodoListIterator it(this);
		for(;it.current();++it)
			list_widgets.append(it.current());

		QTodoListItemsSorter sorter(&list_widgets,criterias);
		QPtrList<QWidget>* sorted = sorter.get();

		QTUM::get()->startRecording();
		takeAll();
		for(unsigned int i = 0; i < sorted->count(); ++i)
		{
			if(QTodoItem* item = dynamic_cast<QTodoItem*>(sorted->at(i)))
			{
				insertTodo(item,i);
				item->setDepth(item->getDepth());
			}
		}
		QTUM::get()->stopRecording();
		restoreContentsYPos();
	}
}
void HbXmlLoaderBaseActions::deleteAll()
{
    QList<QObject *> list = takeAll();
    
    qDeleteAll( list );
    
    reset();
}
Example #3
0
void gauss(int n, ll p) { // nx(n+1)-Matrix, Körper F_p.
	for (int line = 0; line < n; line++) {
		int swappee = line;
		while (mat[swappee][line] == 0) swappee++;
		swapLines(n, line, swappee);
		normalLine(n, line, p);
		takeAll(n, line, p);
}}
Example #4
0
void Hero::handleStateInGame(bool pressed, int key)
{
    // only when alive
    if (!getHp() || !pressed)
    {
        return;
    }

    switch (key)
    {
    case (int)Key::UP:
        setDisplacement(0, -1);
        break;

    case (int)Key::DOWN:
        setDisplacement(0, 1);
        break;

    case (int)Key::LEFT:
        setDisplacement(-1, 0);
        break;

    case (int)Key::RIGHT:
        setDisplacement(1, 0);
        break;

    case 't':
    case 'T':
        takeAll();
        break;

    case 'a':
    case 'A':
        hit(Direction::LEFT);
        break;

    case 'd':
    case 'D':
        hit(Direction::RIGHT);
        break;

    case 's':
    case 'S':
        hit(Direction::DOWN);
        break;

    case 'w':
    case 'W':
        hit(Direction::UP);
        break;

    case ' ':
        m_state = State::Status;
        break;
    }
}