revamp and improve some code

git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@4214 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
blacksun
2015-09-19 13:27:06 +00:00
parent ca426d5fe2
commit d0d79ecf2d
12 changed files with 275 additions and 378 deletions

View File

@@ -28,11 +28,15 @@ DVEventAddText::DVEventAddText(DiagramView *dv) :
DVEventAddText::~DVEventAddText() {}
bool DVEventAddText::mousePressEvent(QMouseEvent *event) {
if (event->button() == Qt::LeftButton) {
m_diagram -> undoStack().push(new AddItemCommand<IndependentTextItem *>(new IndependentTextItem("_"),
m_diagram,
m_dv -> mapToScene(event -> pos())));
bool DVEventAddText::mousePressEvent(QMouseEvent *event)
{
if (event->button() == Qt::LeftButton)
{
IndependentTextItem *text = new IndependentTextItem();
m_diagram -> undoStack().push(new AddItemCommand<IndependentTextItem *>(text, m_diagram, m_dv -> mapToScene(event -> pos())));
text->setTextInteractionFlags(Qt::TextEditorInteraction);
text->setFocus(Qt::MouseFocusReason);
emit finish();
return true;
}
return false;