Skip to content

Commit 97caa6f

Browse files
author
KhalilSelyan
committed
correcting position of icon+label / margin on slider+speedlimit
Signed-off-by: KhalilSelyan <khalil@leodrive.ai>
1 parent c43119a commit 97caa6f

File tree

1 file changed

+50
-12
lines changed

1 file changed

+50
-12
lines changed

common/tier4_state_rviz_plugin/src/autoware_state_panel.cpp

+50-12
Original file line numberDiff line numberDiff line change
@@ -192,10 +192,16 @@ QVBoxLayout * AutowareStatePanel::makeOperationModeGroup()
192192

193193
CustomContainer * group1 = new CustomContainer(this);
194194

195+
auto * horizontal_layout = new QHBoxLayout;
196+
horizontal_layout->setSpacing(10);
197+
horizontal_layout->setContentsMargins(0, 0, 0, 0);
198+
199+
horizontal_layout->addWidget(control_mode_switch_ptr_);
200+
horizontal_layout->addWidget(control_mode_label_ptr_);
201+
195202
// add switch and label to the container
196203
group1->setContentsMargins(0, 0, 0, 10);
197-
group1->getLayout()->addWidget(control_mode_switch_ptr_, 0, 0, 1, 1, Qt::AlignLeft);
198-
group1->getLayout()->addWidget(control_mode_label_ptr_, 0, 1, 1, 4, Qt::AlignLeft);
204+
group1->getLayout()->addLayout(horizontal_layout, 0, 0, 1, 1, Qt::AlignLeft);
199205

200206
// Create the CustomSegmentedButton
201207
segmented_button = new CustomSegmentedButton(this);
@@ -230,8 +236,14 @@ QVBoxLayout * AutowareStatePanel::makeRoutingGroup()
230236
QLabel * routing_label = new QLabel("Routing");
231237
routing_label->setStyleSheet("color: #d0e6f2; font-weight: bold;");
232238

233-
custom_container->getLayout()->addWidget(routing_icon, 0, 0, 1, 1, Qt::AlignLeft);
234-
custom_container->getLayout()->addWidget(routing_label, 0, 1, 1, 1, Qt::AlignLeft);
239+
auto * horizontal_layout = new QHBoxLayout;
240+
horizontal_layout->setSpacing(10);
241+
horizontal_layout->setContentsMargins(0, 0, 0, 0);
242+
243+
horizontal_layout->addWidget(routing_icon);
244+
horizontal_layout->addWidget(routing_label);
245+
246+
custom_container->getLayout()->addLayout(horizontal_layout, 0, 0, 1, 1, Qt::AlignLeft);
235247
custom_container->getLayout()->addWidget(clear_route_button_ptr_, 0, 2, 1, 4, Qt::AlignRight);
236248

237249
custom_container->setContentsMargins(10, 0, 0, 0);
@@ -254,8 +266,14 @@ QVBoxLayout * AutowareStatePanel::makeLocalizationGroup()
254266
QLabel * localization_label = new QLabel(" Localization");
255267
localization_label->setStyleSheet("color: #d0e6f2; font-weight: bold;");
256268

257-
custom_container->getLayout()->addWidget(localization_icon, 0, 0, 1, 1, Qt::AlignLeft);
258-
custom_container->getLayout()->addWidget(localization_label, 0, 1, 1, 1, Qt::AlignLeft);
269+
auto * horizontal_layout = new QHBoxLayout;
270+
horizontal_layout->setSpacing(10);
271+
horizontal_layout->setContentsMargins(0, 0, 0, 0);
272+
273+
horizontal_layout->addWidget(localization_icon);
274+
horizontal_layout->addWidget(localization_label);
275+
276+
custom_container->getLayout()->addLayout(horizontal_layout, 0, 0, 1, 1, Qt::AlignLeft);
259277
custom_container->getLayout()->addWidget(init_by_gnss_button_ptr_, 0, 2, 1, 4, Qt::AlignRight);
260278

261279
custom_container->setContentsMargins(10, 0, 0, 0);
@@ -278,8 +296,15 @@ QVBoxLayout * AutowareStatePanel::makeMotionGroup()
278296
QLabel * motion_label = new QLabel("Motion");
279297
motion_label->setStyleSheet("color: #d0e6f2; font-weight: bold;");
280298

281-
custom_container->getLayout()->addWidget(motion_icon, 0, 0, 1, 1, Qt::AlignLeft);
282-
custom_container->getLayout()->addWidget(motion_label, 0, 1, 1, 1, Qt::AlignLeft);
299+
auto * horizontal_layout = new QHBoxLayout;
300+
horizontal_layout->setSpacing(10);
301+
horizontal_layout->setContentsMargins(0, 0, 0, 0);
302+
horizontal_layout->setAlignment(Qt::AlignLeft);
303+
304+
horizontal_layout->addWidget(motion_icon);
305+
horizontal_layout->addWidget(motion_label);
306+
307+
custom_container->getLayout()->addLayout(horizontal_layout, 0, 0, 1, 1, Qt::AlignLeft);
283308
custom_container->getLayout()->addWidget(accept_start_button_ptr_, 0, 2, 1, 4, Qt::AlignRight);
284309

285310
custom_container->setContentsMargins(10, 0, 0, 0);
@@ -306,11 +331,23 @@ QVBoxLayout * AutowareStatePanel::makeFailSafeGroup()
306331
mrm_state_label_ptr_->setStyleSheet("color: #d0e6f2; font-weight: bold;");
307332
mrm_behavior_label_ptr_->setStyleSheet("color: #d0e6f2; font-weight: bold;");
308333

309-
custom_container1->getLayout()->addWidget(mrm_state_icon, 0, 0, 1, 1, Qt::AlignLeft);
310-
custom_container1->getLayout()->addWidget(mrm_state_label_ptr_, 0, 1, 1, 5, Qt::AlignLeft);
334+
auto * horizontal_layout = new QHBoxLayout;
335+
horizontal_layout->setSpacing(10);
336+
horizontal_layout->setContentsMargins(0, 0, 0, 0);
337+
338+
horizontal_layout->addWidget(mrm_state_icon);
339+
horizontal_layout->addWidget(mrm_state_label_ptr_);
340+
341+
custom_container1->getLayout()->addLayout(horizontal_layout, 0, 0, 1, 1, Qt::AlignLeft);
342+
343+
auto * horizontal_layout2 = new QHBoxLayout;
344+
horizontal_layout2->setSpacing(10);
345+
horizontal_layout2->setContentsMargins(0, 0, 0, 0);
346+
347+
horizontal_layout2->addWidget(mrm_behavior_icon);
348+
horizontal_layout2->addWidget(mrm_behavior_label_ptr_);
311349

312-
custom_container2->getLayout()->addWidget(mrm_behavior_icon, 0, 0, 1, 1, Qt::AlignLeft);
313-
custom_container2->getLayout()->addWidget(mrm_behavior_label_ptr_, 0, 1, 1, 5, Qt::AlignLeft);
350+
custom_container2->getLayout()->addLayout(horizontal_layout2, 0, 0, 1, 1, Qt::AlignLeft);
314351

315352
v_layout->addWidget(custom_container1);
316353
// v_layout->addSpacing(5);
@@ -400,6 +437,7 @@ QVBoxLayout * AutowareStatePanel::makeVelocityLimitGroup()
400437
QLabel * velocity_limit_label = new QLabel("km/h");
401438

402439
velocity_limit_layout->addWidget(pub_velocity_limit_slider_);
440+
velocity_limit_layout->addSpacing(5);
403441
velocity_limit_layout->addWidget(velocity_limit_value_label_);
404442
velocity_limit_layout->addWidget(velocity_limit_label);
405443

0 commit comments

Comments
 (0)