QSize Header::sizeHint() const
{
- int max_width = 0;
-
+ QRectF max_rect(-Padding, 0, Padding, 0);
for (auto &i : _view)
if (i->enabled())
- max_width = max(max_width, (int)i->label_rect(0).width());
-
- return QSize(max_width + Padding + BaselineOffset, 0);
+ max_rect = max_rect.united(i->label_rect(0));
+ return QSize(max_rect.width() + Padding + BaselineOffset, 0);
}
shared_ptr<RowItem> Header::get_mouse_over_row_item(const QPoint &pt)
namespace pv {
namespace view {
+const int TraceGroup::Padding = 8;
+const int TraceGroup::Width = 12;
+
TraceGroup::~TraceGroup()
{
_owner = nullptr;
QRectF TraceGroup::label_rect(int right) const
{
- (void)right;
- return QRectF();
+ QRectF rect;
+ for (const shared_ptr<RowItem> r : child_items())
+ if (r)
+ rect = rect.united(r->label_rect(right));
+
+ return QRectF(rect.x() - Width - Padding, rect.y(),
+ Width, rect.height());
}
bool TraceGroup::pt_in_label_rect(int left, int right, const QPoint &point)
{
Q_OBJECT
+private:
+ static const int Padding;
+ static const int Width;
+
public:
/**
* Virtual destructor