Change margins to be a minimum instead of adding them

* The style itself may have added some margins and we don't want to add
  extra margins, just set a minimum.
This commit is contained in:
baldurk
2017-06-01 18:47:42 +01:00
parent 49243c0878
commit b311e65dbd
3 changed files with 7 additions and 10 deletions
+3 -3
View File
@@ -53,9 +53,9 @@ QSize RDTreeViewDelegate::sizeHint(const QStyleOptionViewItem &option, const QMo
ret.setHeight(ret.height() + 1);
}
// expand by the margins
ret.setWidth(ret.width() + m_View->m_HorizMargin);
ret.setHeight(ret.height() + m_View->m_VertMargin);
// ensure we have at least the margin on top of font size. If the style applied more, don't add to
// it.
ret.setHeight(qMax(ret.height(), option.fontMetrics.height() + m_View->m_VertMargin));
return ret;
}
+2 -7
View File
@@ -51,12 +51,7 @@ public:
void hideBranches() { m_VisibleBranches = false; }
void showGridLines() { m_VisibleGridLines = true; }
void hideGridLines() { m_VisibleGridLines = false; }
void setItemMargins(int horizontal, int vertical)
{
m_HorizMargin = horizontal;
m_VertMargin = vertical;
}
int horizontalItemMargin() { return m_HorizMargin; }
void setItemVerticalMargin(int vertical) { m_VertMargin = vertical; }
int verticalItemMargin() { return m_VertMargin; }
protected:
void drawRow(QPainter *painter, const QStyleOptionViewItem &options,
@@ -67,7 +62,7 @@ private:
bool m_VisibleBranches = true;
bool m_VisibleGridLines = true;
int m_HorizMargin = 3, m_VertMargin = 3;
int m_VertMargin = 6;
friend class RDTreeViewDelegate;
};
+2
View File
@@ -85,6 +85,8 @@ EventBrowser::EventBrowser(ICaptureContext &ctx, QWidget *parent)
// becomes quickly infuriating to rearrange, just disable until that can be fixed.
ui->events->header()->setSectionsMovable(false);
ui->events->setItemVerticalMargin(3);
UpdateDurationColumn();
m_FindHighlight = new QTimer(this);