Exemple #1
0
// Двойное нажатие на элемент дерева
void sTreeWidget::DoubleClickItem(QModelIndex index){
    xmlItem item = this->itemFromIndex_(index)->GetXmlItem();
    if (item.nodeName() == md_document){
        EditDocument();
    }

    if (item.nodeName() == md_field){
        EditElement();
    }
    if (item.nodeName() == md_form){
        EditElement();
    }
}
Exemple #2
0
void frmDocument::DoubleClickItem(QModelIndex index){
    xmlItem item = ((QSListWidget*)sender())->itemFromIndex_(index)->GetXmlItem();
    qDebug() << item.nodeName();
    if (item.nodeName() == md_field){
        EditElement();
    }
}
Exemple #3
0
/*!
 *	\~english
 *	Key press handler.
 *	\~russian
 *	Обрабатывает события при нажатии кнопок клавиатуры.
 *	\~
 */
void
wDBTable::keyPressEvent ( QKeyEvent *e )
{
	qulonglong id;

	aWidget *container = NULL;
	if ( searchMode == FALSE && e->text().at( 0 ).isPrint() )
	{
		searchOpen( e->text() );
	}
	else
	{
		searchClose();
	}

	if(containerType() =="wJournal")
	{
		e->ignore();
	}
	if(containerType() =="wCatalogue")
	{
		switch ( e->key() )
		{
		case Qt::Key_Escape:
			e->ignore();
			break;
		case Qt::Key_Return:
			if(currentRecord())
			{
				id = currentRecord()->value(0).toLongLong();
				if ( e->state() == Qt::ShiftModifier )
				{
					//printf("Shift+Return pressed %Ld\n", id);
					EditElement();
				} else
				{
					//printf("Return pressed %Ld\n", id );
					emit( selected( id ) );
				}
				e->accept();
			}
			else
			{
				aLog::print(aLog::Info, tr("wDBTable: current record not setted"));
			}
			break;
		default:
			e->ignore();
			break;
		}
	}
	Q3DataTable::keyPressEvent( e );
}
Exemple #4
0
QMenu* sTreeWidget::newMenu(xmlItem obj){
    QMenu* menu = new QMenu;
    qDebug() << obj.nodeName();
    if(obj.nodeName() == md_spravochniki){
        QAction *act = new QAction("Новый справочник..",this);
        connect(act,SIGNAL(triggered()),this,SLOT(NewObjMd()));
        menu->addAction(act);
    }

    if(obj.nodeName() == md_documents){
        QAction *act = new QAction("Новый документ..",this);
        connect(act,SIGNAL(triggered()),this,SLOT(NewObjMd()));
        menu->addAction(act);
    }

    if(obj.nodeName() == md_element){
        QAction *act = new QAction("Добавить",this);
        connect(act,SIGNAL(triggered()),this,SLOT(NewElement()));
        menu->addAction(act);
    }

    if(obj.nodeName() == md_forms){
        QAction *act = new QAction("Добавить",this);
        connect(act,SIGNAL(triggered()),this,SLOT(NewForm()));
        menu->addAction(act);
    }


    if(obj.nodeName() == md_field){
        QAction *edit = new QAction("Редактировать",this);
        connect(edit,SIGNAL(triggered()),this,SLOT(EditElement()));
        menu->addAction(edit);

        QAction *del = new QAction("Удалить",this);
        connect(del,SIGNAL(triggered()),this,SLOT(DelElement()));
        menu->addAction(del);
    }

    return menu;
}