MCPcopy Create free account
hub / github.com/PlotJuggler/PlotJuggler / repositionToasts

Method repositionToasts

pj_widgets/src/ToastManager.cpp:68–100  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

66}
67
68void ToastManager::repositionToasts() {
69 if (toasts_.isEmpty()) {
70 return;
71 }
72
73 const int container_width = container_->width();
74 const int container_height = container_->height();
75 const int toast_width = max_width_;
76 const int x = container_width - toast_width - margin_right_;
77
78 // Newest toast (last in the list) sits at the bottom; stack upward from there.
79 int current_y = container_height - margin_bottom_;
80
81 for (int i = toasts_.size() - 1; i >= 0; --i) {
82 ToastNotification* toast = toasts_[i];
83
84 toast->setFixedWidth(toast_width);
85 toast->layout()->activate(); // Recompute height for the fixed width.
86
87 int toast_height = toast->heightForWidth(toast_width);
88 if (toast_height < 0) {
89 toast_height = toast->sizeHint().height();
90 }
91 toast_height = qMax(toast_height, toast->minimumHeight());
92 toast->setFixedHeight(toast_height);
93
94 current_y -= toast_height;
95 toast->updateTargetPosition(QPoint(x, current_y));
96 toast->show();
97
98 current_y -= spacing_;
99 }
100}
101
102} // namespace PJ

Callers

nothing calls this directly

Calls 10

heightMethod · 0.80
updateTargetPositionMethod · 0.80
QPointClass · 0.50
isEmptyMethod · 0.45
widthMethod · 0.45
sizeMethod · 0.45
activateMethod · 0.45
heightForWidthMethod · 0.45
sizeHintMethod · 0.45
showMethod · 0.45

Tested by

no test coverage detected