GUI: tighter row heights
This commit is contained in:
parent
c3ae35a649
commit
dec91c621e
|
@ -85,7 +85,7 @@ void AbstractTableView::updateFonts()
|
|||
{
|
||||
setFont(ConfigFont("AbstractTableView"));
|
||||
invalidateCachedFont();
|
||||
mHeader.height = QFontMetrics(font()).height() + 4;
|
||||
mHeader.height = mFontMetrics->height() + 4;
|
||||
}
|
||||
|
||||
void AbstractTableView::invalidateCachedFont()
|
||||
|
@ -1019,10 +1019,7 @@ int AbstractTableView::getColumnCount() const
|
|||
|
||||
int AbstractTableView::getRowHeight()
|
||||
{
|
||||
int wRowsHeight = QFontMetrics(this->font()).height();
|
||||
wRowsHeight = (wRowsHeight * 105) / 100;
|
||||
wRowsHeight = (wRowsHeight % 2) == 0 ? wRowsHeight : wRowsHeight + 1;
|
||||
return wRowsHeight;
|
||||
return mFontMetrics->height() | 1;
|
||||
}
|
||||
|
||||
int AbstractTableView::getColumnWidth(int index)
|
||||
|
|
|
@ -965,15 +965,16 @@ int Disassembly::paintJumpsGraphic(QPainter* painter, int x, int y, dsint addr,
|
|||
}
|
||||
}
|
||||
|
||||
int halfRow = getRowHeight() / 2 + 1;
|
||||
|
||||
painter->setPen(mConditionalTruePen);
|
||||
if(curInstDir == GJD_Up)
|
||||
{
|
||||
QPoint wPoints[] =
|
||||
{
|
||||
QPoint(x , y + getRowHeight() / 2 + 1),
|
||||
QPoint(x + 2, y + getRowHeight() / 2 - 1),
|
||||
QPoint(x + 4, y + getRowHeight() / 2 + 1),
|
||||
QPoint(x , y + halfRow + 1),
|
||||
QPoint(x + 2, y + halfRow - 1),
|
||||
QPoint(x + 4, y + halfRow + 1),
|
||||
};
|
||||
|
||||
painter->drawPolyline(wPoints, 3);
|
||||
|
@ -982,9 +983,9 @@ int Disassembly::paintJumpsGraphic(QPainter* painter, int x, int y, dsint addr,
|
|||
{
|
||||
QPoint wPoints[] =
|
||||
{
|
||||
QPoint(x , y + getRowHeight() / 2 - 1),
|
||||
QPoint(x + 2, y + getRowHeight() / 2 + 1),
|
||||
QPoint(x + 4, y + getRowHeight() / 2 - 1),
|
||||
QPoint(x , y + halfRow - 1),
|
||||
QPoint(x + 2, y + halfRow + 1),
|
||||
QPoint(x + 4, y + halfRow - 1),
|
||||
};
|
||||
|
||||
painter->drawPolyline(wPoints, 3);
|
||||
|
@ -1022,56 +1023,56 @@ int Disassembly::paintJumpsGraphic(QPainter* painter, int x, int y, dsint addr,
|
|||
}
|
||||
else if(wPict == GD_FootToBottom)
|
||||
{
|
||||
painter->drawLine(x, y + getRowHeight() / 2, x + 5, y + getRowHeight() / 2);
|
||||
painter->drawLine(x, y + getRowHeight() / 2, x, y + getRowHeight());
|
||||
painter->drawLine(x, y + halfRow, x + 5, y + halfRow);
|
||||
painter->drawLine(x, y + halfRow, x, y + getRowHeight());
|
||||
}
|
||||
else if(wPict == GD_FootToTop)
|
||||
{
|
||||
painter->drawLine(x, y + getRowHeight() / 2, x + 5, y + getRowHeight() / 2);
|
||||
painter->drawLine(x, y, x, y + getRowHeight() / 2);
|
||||
painter->drawLine(x, y + halfRow, x + 5, y + halfRow);
|
||||
painter->drawLine(x, y, x, y + halfRow);
|
||||
}
|
||||
else if(wPict == GD_HeadFromBottom)
|
||||
{
|
||||
QPoint wPoints[] =
|
||||
{
|
||||
QPoint(x + 3, y + getRowHeight() / 2 - 2),
|
||||
QPoint(x + 5, y + getRowHeight() / 2),
|
||||
QPoint(x + 3, y + getRowHeight() / 2 + 2),
|
||||
QPoint(x + 3, y + halfRow - 2),
|
||||
QPoint(x + 5, y + halfRow),
|
||||
QPoint(x + 3, y + halfRow + 2),
|
||||
};
|
||||
|
||||
painter->drawLine(x, y + getRowHeight() / 2, x + 5, y + getRowHeight() / 2);
|
||||
painter->drawLine(x, y + getRowHeight() / 2, x, y + getRowHeight());
|
||||
painter->drawLine(x, y + halfRow, x + 5, y + halfRow);
|
||||
painter->drawLine(x, y + halfRow, x, y + getRowHeight());
|
||||
painter->drawPolyline(wPoints, 3);
|
||||
}
|
||||
else if(wPict == GD_HeadFromTop)
|
||||
{
|
||||
QPoint wPoints[] =
|
||||
{
|
||||
QPoint(x + 3, y + getRowHeight() / 2 - 2),
|
||||
QPoint(x + 5, y + getRowHeight() / 2),
|
||||
QPoint(x + 3, y + getRowHeight() / 2 + 2),
|
||||
QPoint(x + 3, y + halfRow - 2),
|
||||
QPoint(x + 5, y + halfRow),
|
||||
QPoint(x + 3, y + halfRow + 2),
|
||||
};
|
||||
|
||||
painter->drawLine(x, y + getRowHeight() / 2, x + 5, y + getRowHeight() / 2);
|
||||
painter->drawLine(x, y, x, y + getRowHeight() / 2);
|
||||
painter->drawLine(x, y + halfRow, x + 5, y + halfRow);
|
||||
painter->drawLine(x, y, x, y + halfRow);
|
||||
painter->drawPolyline(wPoints, 3);
|
||||
}
|
||||
else if(wPict == GD_HeadFromBoth)
|
||||
{
|
||||
QPoint wPoints[] =
|
||||
{
|
||||
QPoint(x + 3, y + getRowHeight() / 2 - 2),
|
||||
QPoint(x + 5, y + getRowHeight() / 2),
|
||||
QPoint(x + 3, y + getRowHeight() / 2 + 2),
|
||||
QPoint(x + 3, y + halfRow - 2),
|
||||
QPoint(x + 5, y + halfRow),
|
||||
QPoint(x + 3, y + halfRow + 2),
|
||||
};
|
||||
|
||||
painter->drawLine(x, y + getRowHeight() / 2, x + 5, y + getRowHeight() / 2);
|
||||
painter->drawLine(x, y + halfRow, x + 5, y + halfRow);
|
||||
painter->drawLine(x, y, x, y + getRowHeight());
|
||||
painter->drawPolyline(wPoints, 3);
|
||||
}
|
||||
else if(wPict == GD_VertHori)
|
||||
{
|
||||
painter->drawLine(x, y + getRowHeight() / 2, x + 5, y + getRowHeight() / 2);
|
||||
painter->drawLine(x, y + halfRow, x + 5, y + halfRow);
|
||||
painter->drawLine(x, y, x, y + getRowHeight());
|
||||
}
|
||||
|
||||
|
|
|
@ -145,7 +145,6 @@ void CPUSideBar::paintEvent(QPaintEvent* event)
|
|||
if(mInstrBuffer->size() == 0)
|
||||
return;
|
||||
|
||||
|
||||
if(mCodeFoldingManager.isFolded(regDump.regcontext.cip))
|
||||
{
|
||||
mCodeFoldingManager.expandFoldSegment(regDump.regcontext.cip);
|
||||
|
@ -310,7 +309,7 @@ void CPUSideBar::mouseReleaseEvent(QMouseEvent* e)
|
|||
const int line = y / fontHeight;
|
||||
const int width = viewport()->width();
|
||||
|
||||
const int bulletRadius = fontHeight / 2; //14/2=7
|
||||
const int bulletRadius = fontHeight / 2 + 1; //14/2=7
|
||||
const int bulletX = width - mBulletXOffset;
|
||||
//const int bulletY = line * fontHeight + mBulletYOffset;
|
||||
|
||||
|
@ -432,7 +431,7 @@ void CPUSideBar::drawJump(QPainter* painter, int startLine, int endLine, int jum
|
|||
painter->setPen(mUnconditionalPen); //JMP
|
||||
|
||||
// Pixel adjustment to make drawing lines even
|
||||
int pixel_y_offs = 1;
|
||||
int pixel_y_offs = 0;
|
||||
|
||||
if(isactive) //selected
|
||||
{
|
||||
|
|
|
@ -14,6 +14,7 @@ public:
|
|||
mFontMetrics(font)
|
||||
{
|
||||
memset(mWidths, 0, sizeof(mWidths));
|
||||
mHeight = mFontMetrics.height();
|
||||
}
|
||||
|
||||
int width(const QChar & ch)
|
||||
|
@ -48,9 +49,15 @@ public:
|
|||
return result;
|
||||
}
|
||||
|
||||
int height()
|
||||
{
|
||||
return mHeight;
|
||||
}
|
||||
|
||||
private:
|
||||
QFontMetrics mFontMetrics;
|
||||
uchar mWidths[0x10000 - 0xE000 + 0xD800];
|
||||
int mHeight;
|
||||
};
|
||||
|
||||
#endif // CACHEDFONTMETRICS_H
|
||||
|
|
Loading…
Reference in New Issue