33 #include <QFileDialog>
34 #include <QGridLayout>
36 #include <QPushButton>
45 this->setWindowTitle(tr(
"Choose configuration"));
46 this->setWindowFlags(Qt::Window | Qt::WindowCloseButtonHint |
47 Qt::WindowStaysOnTopHint | Qt::CustomizeWindowHint);
50 QLabel* file_label =
new QLabel(
"File path");
51 file_label->setToolTip(
"Full path to file");
56 QPushButton* browse_button =
new QPushButton(tr(
"Browse"));
57 connect(browse_button, SIGNAL(clicked()),
this, SLOT(
OnBrowse()));
60 QLabel* hide_label =
new QLabel(
"Hide menu");
61 hide_label->setToolTip(
"Check to hide RViz's top menu bar");
66 QPushButton* cancel_button =
new QPushButton(tr(
"&Cancel"));
67 this->connect(cancel_button, SIGNAL(clicked()),
this, SLOT(close()));
69 QPushButton* apply_button =
new QPushButton(tr(
"&Apply"));
70 apply_button->setDefault(
true);
71 this->connect(apply_button, SIGNAL(clicked()),
this, SLOT(accept()));
73 QHBoxLayout* buttons_layout =
new QHBoxLayout;
74 buttons_layout->addWidget(cancel_button);
75 buttons_layout->addWidget(apply_button);
78 QGridLayout* main_layout =
new QGridLayout();
80 main_layout->addWidget(file_label, 0, 0);
82 main_layout->addWidget(browse_button, 0, 2);
84 main_layout->addWidget(hide_label, 1, 0);
86 main_layout->setAlignment(
hide_box_, Qt::AlignLeft);
88 main_layout->addLayout(buttons_layout, 2, 0, 1, 3);
89 main_layout->setColumnStretch(1, 2);
91 this->setLayout(main_layout);
100 QString filename = QFileDialog::getOpenFileName(0,
101 tr(
"Choose config file:"),
"", tr(
"Rviz config file (*.rviz)"));
113 file_edit_->setText(QString::fromStdString(file));