bool QScrollView::qt_emit( int _id, QUObject* _o )
{
    switch ( _id - staticMetaObject()->signalOffset() ) {
    case 0: contentsMoving((int)static_QUType_int.get(_o+1),(int)static_QUType_int.get(_o+2)); break;
    case 1: horizontalSliderPressed(); break;
    case 2: horizontalSliderReleased(); break;
    case 3: verticalSliderPressed(); break;
    case 4: verticalSliderReleased(); break;
    default:
	return QFrame::qt_emit(_id,_o);
    }
    return TRUE;
}
示例#2
0
//BEGIN class ItemView
ItemView::ItemView(ItemDocument * itemDocument, ViewContainer *viewContainer, uint viewAreaId, const char *name)
		: View(itemDocument, viewContainer, viewAreaId, name) {
	KActionCollection * ac = actionCollection();

	KStdAction::selectAll(itemDocument,	SLOT(selectAll()),	ac);
	KStdAction::zoomIn(this,		SLOT(zoomIn()),		ac);
	KStdAction::zoomOut(this,		SLOT(zoomOut()),	ac);
	KStdAction::actualSize(this,		SLOT(actualSize()),	ac)->setEnabled(false);


	KAccel *pAccel = new KAccel(this);
	pAccel->insert("Cancel", i18n("Cancel"), i18n("Cancel the current operation"), Qt::Key_Escape, itemDocument, SLOT(cancelCurrentOperation()));
	pAccel->readSettings();

	new KAction(i18n("Delete"), "editdelete", Qt::Key_Delete, itemDocument, SLOT(deleteSelection()), ac, "edit_delete");
	new KAction(i18n("Export as Image..."), 0, 0, itemDocument, SLOT(exportToImage()), ac, "file_export_image");

	//BEGIN Item Alignment actions
	new KAction(i18n("Align Horizontally"), 0, 0, itemDocument, SLOT(alignHorizontally()), ac, "align_horizontally");
	new KAction(i18n("Align Vertically"), 0, 0, itemDocument, SLOT(alignVertically()), ac, "align_vertically");
	new KAction(i18n("Distribute Horizontally"), 0, 0, itemDocument, SLOT(distributeHorizontally()), ac, "distribute_horizontally");
	new KAction(i18n("Distribute Vertically"), 0, 0, itemDocument, SLOT(distributeVertically()), ac, "distribute_vertically");
	//END Item Alignment actions


	//BEGIN Draw actions
	KToolBarPopupAction * pa = new KToolBarPopupAction(i18n("Draw"), "paintbrush", 0, 0, 0, ac, "edit_draw");
	pa->setDelayed(false);

	KPopupMenu * m = pa->popupMenu();
	m->insertTitle(i18n("Draw"));

	m->insertItem(KGlobal::iconLoader()->loadIcon("tool_text",	KIcon::Small), i18n("Text"),		DrawPart::da_text);
	m->insertItem(KGlobal::iconLoader()->loadIcon("tool_line",	KIcon::Small), i18n("Line"),		DrawPart::da_line);
	m->insertItem(KGlobal::iconLoader()->loadIcon("tool_arrow",	KIcon::Small), i18n("Arrow"),		DrawPart::da_arrow);
	m->insertItem(KGlobal::iconLoader()->loadIcon("tool_ellipse",	KIcon::Small), i18n("Ellipse"),	DrawPart::da_ellipse);
	m->insertItem(KGlobal::iconLoader()->loadIcon("tool_rectangle", KIcon::Small), i18n("Rectangle"),	DrawPart::da_rectangle);
	m->insertItem(KGlobal::iconLoader()->loadIcon("imagegallery",	KIcon::Small), i18n("Image"),		DrawPart::da_image);
	connect(m, SIGNAL(activated(int)), itemDocument, SLOT(slotSetDrawAction(int)));
	//END Draw actions


	//BEGIN Item Control actions
	new KAction(i18n("Raise Selection"), "bring_forward", Qt::Key_PageUp,   itemDocument, SLOT(raiseZ()), ac, "edit_raise");
	new KAction(i18n("Lower Selection"), "send_backward", Qt::Key_PageDown, itemDocument, SLOT(lowerZ()), ac, "edit_lower");
	//END Item Control actions


	KAction * na = new KAction("", 0, 0, 0, 0, ac, "null_action");
	na->setEnabled(false);

	setXMLFile("ktechlabitemviewui.rc");

	m_pUpdateStatusTmr = new QTimer(this);
	connect(m_pUpdateStatusTmr, SIGNAL(timeout()), this, SLOT(updateStatus()));
	connect(this, SIGNAL(unfocused()), this, SLOT(stopUpdatingStatus()));

	m_pDragItem = 0l;
	p_itemDocument = itemDocument;
	m_zoomLevel = 1.;
	m_CVBEditor = new CVBEditor(p_itemDocument->canvas(), this, "cvbEditor");
	m_CVBEditor->setLineWidth(1);

	connect(m_CVBEditor, SIGNAL(horizontalSliderReleased()), itemDocument, SLOT(requestCanvasResize()));
	connect(m_CVBEditor, SIGNAL(verticalSliderReleased()), itemDocument, SLOT(requestCanvasResize()));

	m_layout->insertWidget(0, m_CVBEditor);

	setAcceptDrops(true);

	setFocusWidget(m_CVBEditor->viewport());
}