Skip to content

Commit

Permalink
QEScratchPad: Update widget to behave better when scaled; and to pass on
Browse files Browse the repository at this point in the history
key events (including ctrl+"+", ctrl+"-") to allow scaling to occur.
  • Loading branch information
Andrew Starritt committed Sep 9, 2017
1 parent c74a079 commit 0677b52
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions qeframeworkSup/project/widgets/QEScratchPad/QEScratchPad.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -317,15 +317,20 @@ void QEScratchPad::resizeEvent (QResizeEvent*)

geo = item->value->geometry ();
geo.translate (horOffset, verOffset);
geo.setWidth (geo.width() - 44);
this->titleValue->setGeometry (geo);

left = geo.right() + 8;
// Locate load and save buttons at right hand side of the parent frame.
// These locations are dependent on button sizes and the frame width.
//
const int tfw = this->titleFrame->geometry().width();
const int bw = this->loadButton->geometry().width();

left = tfw - (18*bw)/8;
geo = this->loadButton->geometry();
geo.moveLeft (left); // absolute (as opposed to relative) move.
this->loadButton->setGeometry (geo);

left = geo.right() + 4;
left = tfw - (9*bw)/8;
geo = this->saveButton->geometry();
geo.moveLeft (left); // absolute (as opposed to relative) move.
this->saveButton->setGeometry (geo);
Expand Down Expand Up @@ -633,7 +638,7 @@ void QEScratchPad::showEvent (QShowEvent* /*event*/ )

//---------------------------------------------------------------------------------
//
void QEScratchPad::keyPressEvent (QKeyEvent * event)
void QEScratchPad::keyPressEvent (QKeyEvent* event)
{
const int key = event->key ();
const Qt::KeyboardModifiers modifier = event->modifiers();
Expand All @@ -659,6 +664,12 @@ void QEScratchPad::keyPressEvent (QKeyEvent * event)
this->setSelectItem (this->selectedItem + 1, false);
}
break;

default:
// Otherwise call parent function.
//
QEAbstractDynamicWidget::keyPressEvent (event);
break;
}
}

Expand Down

0 comments on commit 0677b52

Please sign in to comment.