Пример #1
0
void Stripbit::mousePressEvent(QGraphicsSceneMouseEvent *event) 
{
	InfoGraphicsView * infoGraphicsView = InfoGraphicsView::getInfoGraphicsView(this);
	if (infoGraphicsView != NULL && infoGraphicsView->spaceBarIsPressed()) {
		event->ignore();
		return;
	}
		
	if (!event->buttons() && Qt::LeftButton) {
		event->ignore();
		return;
	}

	if (dynamic_cast<ItemBase *>(this->parentItem())->moveLock()) {
		event->ignore();
		return;
	}

	if (event->modifiers() & Qt::ShiftModifier) {
		ShiftDown = true;
        ShiftX = ShiftY = false;
		OriginalShiftPos = event->scenePos();
	}

	event->accept();
	dynamic_cast<Stripboard *>(this->parentItem())->initCutting(this);
	m_removed = !m_removed;
	m_inHover = false;
	m_changed = true;
	update();


	//DebugDialog::debug("got press");
}
Пример #2
0
void NoteGraphicsTextItem::focusOutEvent(QFocusEvent * event) {
	InfoGraphicsView * igv = InfoGraphicsView::getInfoGraphicsView(this);
	if (igv != NULL) {
		igv->setNoteFocus(this, false);
	}
	QApplication::instance()->removeEventFilter((Note *) this->parentItem());
	QGraphicsTextItem::focusOutEvent(event);
	DebugDialog::debug("note focus out");
}
Пример #3
0
void Perfboard::changeBoardSize() 
{

	QString newSize = QString("%1.%2").arg(m_xEdit->text()).arg(m_yEdit->text());
    m_propsMap.insert("size", newSize);

    InfoGraphicsView * infoGraphicsView = InfoGraphicsView::getInfoGraphicsView(this);
    if (infoGraphicsView != NULL) {
        infoGraphicsView->swap(modelPart()->properties().value("family"), "size", m_propsMap, this);
    }
}
Пример #4
0
void Note::mousePressEvent(QGraphicsSceneMouseEvent * event) {
	InfoGraphicsView *infographics = InfoGraphicsView::getInfoGraphicsView(this);
	if (infographics != NULL && infographics->spaceBarIsPressed()) {
		m_spaceBarWasPressed = true;
		event->ignore();
		return;
	}

	m_spaceBarWasPressed = false;
	m_inResize = NULL;
	ItemBase::mousePressEvent(event);
}
Пример #5
0
void Note::mouseReleaseEvent(QGraphicsSceneMouseEvent * event) {
	if (m_spaceBarWasPressed) {
		event->ignore();
		return;
	}

	if (m_inResize) {
		this->ungrabMouse();
		m_inResize = NULL;
		InfoGraphicsView *infoGraphicsView = InfoGraphicsView::getInfoGraphicsView(this);
		if (infoGraphicsView != NULL) {
			infoGraphicsView->noteSizeChanged(this, m_viewGeometry.rect(), m_rect);
		}
		event->accept();
		return;
	}

	ItemBase::mouseReleaseEvent(event);
}
Пример #6
0
void Note::contentsChangedSlot() {
	if (m_charsAdded > 0) {
		forceFormat(m_charsPosition, m_charsAdded);
	}

	InfoGraphicsView *infoGraphicsView = InfoGraphicsView::getInfoGraphicsView(this);
	if (infoGraphicsView != NULL) {
		QString oldText;
		if (m_modelPart) {
			oldText = m_modelPart->instanceText();
		}

		QSizeF oldSize = m_rect.size();
		QSizeF newSize = oldSize;
		checkSize(newSize);

		infoGraphicsView->noteChanged(this, oldText, m_graphicsTextItem->document()->toHtml(), oldSize, newSize);
	}
	if (m_modelPart) {
		m_modelPart->setInstanceText(m_graphicsTextItem->document()->toHtml());
	}
}
Пример #7
0
void Perfboard::changeBoardSize() 
{
	if (!m_gotWarning) {
		int x = m_xEdit->text().toInt();
		int y = m_yEdit->text().toInt();
		if (x * y >= WarningSize) {
			m_gotWarning = true;
			QMessageBox messageBox(NULL);
			messageBox.setWindowTitle(tr("Performance Warning"));
			messageBox.setText(tr("Performance of perfboards and stripboards with more than approximately 2000 holes can be slow. Are you sure ?\n"
				"\nNote: this warning will not be repeated during this session."
				));
			messageBox.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel);
			messageBox.setDefaultButton(QMessageBox::Cancel);
			messageBox.setIcon(QMessageBox::Warning);
			messageBox.setWindowModality(Qt::WindowModal);
			messageBox.setButtonText(QMessageBox::Ok, tr("Set new size"));
			messageBox.setButtonText(QMessageBox::Cancel, tr("Cancel"));
			QMessageBox::StandardButton answer = (QMessageBox::StandardButton) messageBox.exec();

			if (answer != QMessageBox::Ok) {
				getXY(x, y, m_size);
				m_xEdit->setText(QString::number(x));
				m_yEdit->setText(QString::number(y));
				return;
			}
		}
	}


	QString newSize = QString("%1.%2").arg(m_xEdit->text()).arg(m_yEdit->text());
    m_propsMap.insert("size", newSize);

    InfoGraphicsView * infoGraphicsView = InfoGraphicsView::getInfoGraphicsView(this);
    if (infoGraphicsView != NULL) {
        infoGraphicsView->swap(family(), "size", m_propsMap, this);
    }
}