tweak displays
This commit is contained in:
parent
b485e18e04
commit
79274d786a
|
@ -781,17 +781,6 @@ void Editor::keyPressEvent(QKeyEvent *event)
|
|||
insertString.append(QString(" * @return ")+USER_CODE_IN_INSERT_POS);
|
||||
}
|
||||
insertString.append(" */");
|
||||
// } else if (caretY()==1) { /* file header */
|
||||
// insertString.append(QString(" * @file %1<SOURCEPATH>%2")
|
||||
// .arg(USER_CODE_IN_REPL_POS_BEGIN)
|
||||
// .arg(USER_CODE_IN_REPL_POS_END));
|
||||
// insertString.append(QString(" * @brief: ")+ USER_CODE_IN_INSERT_POS);
|
||||
// insertString.append(QString(" * @version: ")+ USER_CODE_IN_INSERT_POS);
|
||||
// insertString.append(QString(" * @copyright: ")+ USER_CODE_IN_INSERT_POS);
|
||||
// insertString.append(QString(" * @author: ")+ USER_CODE_IN_INSERT_POS);
|
||||
// insertString.append(" * @date: <DATETIME>");
|
||||
// insertString.append(" * ");
|
||||
// insertString.append(" **/");
|
||||
} else {
|
||||
insertString.append(QString(" * ")+USER_CODE_IN_INSERT_POS);
|
||||
insertString.append(" */");
|
||||
|
|
|
@ -520,6 +520,9 @@ void QSynEditPainter::paintEditAreas(const EditingAreaList &areaList)
|
|||
pen.setWidth(penWidth);
|
||||
mPainter->setPen(pen);
|
||||
mPainter->setBrush(Qt::NoBrush);
|
||||
int lineHeight = rc.height();
|
||||
int fontHeight = mPainter->fontMetrics().descent() + mPainter->fontMetrics().ascent();
|
||||
int linePadding = (lineHeight - fontHeight) / 2;
|
||||
switch(p->type) {
|
||||
case EditingAreaType::eatRectangleBorder:
|
||||
rc.setTop(rc.top()+penWidth/2);
|
||||
|
@ -527,17 +530,14 @@ void QSynEditPainter::paintEditAreas(const EditingAreaList &areaList)
|
|||
rc.setBottom(rc.bottom()-penWidth/2);
|
||||
mPainter->drawRect(rc);
|
||||
break;
|
||||
case EditingAreaType::eatUnderLine: {
|
||||
int lineHeight = rc.height();
|
||||
int fontHeight = mPainter->fontMetrics().descent() + mPainter->fontMetrics().ascent();
|
||||
int linePadding = (lineHeight - fontHeight) / 2;
|
||||
case EditingAreaType::eatUnderLine:
|
||||
mPainter->drawLine(rc.left(),rc.bottom()-linePadding-pen.width(),rc.right(),rc.bottom()-linePadding-pen.width());
|
||||
}
|
||||
break;
|
||||
case EditingAreaType::eatWaveUnderLine: {
|
||||
int lineHeight = rc.height();
|
||||
int fontHeight = mPainter->fontMetrics().descent() + mPainter->fontMetrics().ascent();
|
||||
int linePadding = (lineHeight - fontHeight) / 2;
|
||||
if (linePadding>mPainter->fontMetrics().descent())
|
||||
linePadding -= mPainter->fontMetrics().descent();
|
||||
else
|
||||
linePadding = 0;
|
||||
int maxOffset = std::min(3*penWidth, mPainter->fontMetrics().descent());
|
||||
maxOffset = std::max(3, maxOffset);
|
||||
int offset = maxOffset;
|
||||
|
|
|
@ -6069,6 +6069,7 @@ void QSynEdit::mousePressEvent(QMouseEvent *event)
|
|||
bool bStartDrag = false;
|
||||
mMouseMoved = false;
|
||||
mMouseOrigin = event->pos();
|
||||
mMouseScrollOldTop = topPos();
|
||||
Qt::MouseButton button = event->button();
|
||||
int X=event->pos().x();
|
||||
int Y=event->pos().y();
|
||||
|
@ -6143,6 +6144,13 @@ void QSynEdit::mouseReleaseEvent(QMouseEvent *event)
|
|||
mStateFlags.setFlag(StateFlag::sfWaitForDragging, false);
|
||||
}
|
||||
mStateFlags.setFlag(StateFlag::sfDblClicked,false);
|
||||
if (mMouseScrollOldTop > topPos()) {
|
||||
if (topPos() % mTextHeight !=0)
|
||||
setTopPos(topPos()/mTextHeight * mTextHeight);
|
||||
} else if (mMouseScrollOldTop < topPos()) {
|
||||
if (topPos() % mTextHeight !=0)
|
||||
setTopPos( (topPos()/mTextHeight + 1) * mTextHeight);
|
||||
}
|
||||
if (oldCaret!=caretXY()) {
|
||||
if (mOptions.testFlag(EditorOption::eoGroupUndo))
|
||||
mUndoList->addGroupBreak();
|
||||
|
|
|
@ -689,6 +689,7 @@ private:
|
|||
QFont mFontForNonAscii;
|
||||
bool mMouseMoved;
|
||||
QPoint mMouseOrigin;
|
||||
int mMouseScrollOldTop;
|
||||
|
||||
bool mInserting;
|
||||
bool mPainting;
|
||||
|
|
Loading…
Reference in New Issue