Skip to content

Commit 458c274

Browse files
committed
style: clickable rects
1 parent ecd6dc4 commit 458c274

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

src/qt/mempoolstats.cpp

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ static const char *LABEL_FONT = "Roboto Mono";
1313
static int LABEL_TITLE_SIZE = 22;
1414
static int LABEL_KV_SIZE = 12;
1515

16-
static const int LABEL_LEFT_SIZE = 30;
16+
static const int LABEL_LEFT_SIZE = 100;//30;
1717
static const int LABEL_RIGHT_SIZE = 30;
1818
static const int GRAPH_PADDING_LEFT = 30+LABEL_LEFT_SIZE;
1919
static const int GRAPH_PADDING_RIGHT = 30+LABEL_RIGHT_SIZE;
@@ -116,11 +116,14 @@ void MempoolStats::drawChart()
116116

117117
m_scene->clear();
118118

119-
std::vector<QPainterPath> fee_paths;
120-
std::vector<size_t> fee_subtotal_txcount;
119+
//
121120
qreal current_x = GRAPH_PADDING_LEFT;
122121
const qreal bottom = m_gfx_view->scene()->sceneRect().height()-GRAPH_PADDING_BOTTOM;
123122
const qreal maxheight_g = (m_gfx_view->scene()->sceneRect().height()-GRAPH_PADDING_TOP-GRAPH_PADDING_TOP_LABEL-GRAPH_PADDING_BOTTOM);
123+
124+
125+
std::vector<QPainterPath> fee_paths;
126+
std::vector<size_t> fee_subtotal_txcount;
124127
size_t max_txcount=0;
125128
QFont gridFont;
126129
gridFont.setPointSize(12);
@@ -167,7 +170,7 @@ void MempoolStats::drawChart()
167170
}
168171

169172
// make a nice y-axis scale
170-
const int amount_of_h_lines = 5;
173+
const int amount_of_h_lines = 10;
171174
if (max_txcount > 0) {
172175
int val = qFloor(log10(1.0*max_txcount/amount_of_h_lines));
173176
int stepbase = qPow(10.0f, val);
@@ -203,7 +206,7 @@ void MempoolStats::drawChart()
203206

204207
qreal c_y = bottom;
205208
const qreal c_w = 10;
206-
const qreal c_h = 10;
209+
const qreal c_h = 20;//10;
207210
const qreal c_margin = 2;
208211
c_y-=c_margin;
209212
int i = 0;
@@ -212,7 +215,8 @@ void MempoolStats::drawChart()
212215
continue;
213216
}
214217
ClickableRectItem *fee_rect = new ClickableRectItem();
215-
fee_rect->setRect(4, c_y, c_w, c_h);
218+
//(L, B, R, Top)
219+
fee_rect->setRect(10, c_y-7, c_w+100, c_h);
216220

217221
QColor brush_color = colors[(i < static_cast<int>(colors.size()) ? i : static_cast<int>(colors.size())-1)];
218222
brush_color.setAlpha(85);
@@ -222,6 +226,7 @@ void MempoolStats::drawChart()
222226
}
223227

224228
fee_rect->setBrush(QBrush(brush_color));
229+
fee_rect->setPen(Qt::NoPen);//no outline only fill with QBrush
225230
fee_rect->setCursor(Qt::PointingHandCursor);
226231
connect(fee_rect, &ClickableRectItem::objectClicked, [this, i](QGraphicsItem*item) {
227232
// if clicked, we select or deselect if selected
@@ -242,14 +247,15 @@ void MempoolStats::drawChart()
242247
});
243248
m_scene->addItem(fee_rect);
244249

250+
//TODO: fix bug/crash on click
245251
ClickableTextItem *fee_text = new ClickableTextItem();
246252
fee_text->setText(QString::number(list_entry.fee_from)+"-"+QString::number(list_entry.fee_to));
247253
if (i+1 == static_cast<int>(m_clientmodel->m_mempool_feehist[0].second.size())) {
248254
fee_text->setText(QString::number(list_entry.fee_from)+"+");
249255
}
250256
fee_text->setFont(gridFont);
251257
fee_text->setPos(4+c_w+2, c_y);
252-
m_scene->addItem(fee_text);
258+
//m_scene->addItem(fee_text);
253259
connect(fee_text, &ClickableTextItem::objectClicked, [&fee_rect](QGraphicsItem*item) {
254260
fee_rect->objectClicked(item);
255261
});
@@ -281,7 +287,7 @@ void MempoolStats::drawChart()
281287
}
282288
first = false;
283289
}
284-
} // release lock for the acctual drawing
290+
} // release lock for the actual drawing
285291

286292
int i = 0;
287293
QString total_text = tr("Last %1 hours").arg(QString::number(m_clientmodel->m_mempool_max_samples*m_clientmodel->m_mempool_collect_intervall/3600));

0 commit comments

Comments
 (0)