Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated GUI to use QMainWindow #184

Merged
merged 1 commit into from
Jun 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

#include <boost_plugin_loader/plugin_loader.h>
#include <memory>
#include <QWidget>
#include <QMainWindow>
#include <QDialog>

class QTreeWidgetItem;
Expand All @@ -19,7 +19,7 @@ namespace industrial_calibration
class ExtrinsicHandEyeResult;
class ExtrinsicHandEyeCalibrationConfigurationWidget;

class ExtrinsicHandEyeCalibrationWidget : public QWidget
class ExtrinsicHandEyeCalibrationWidget : public QMainWindow
{
public:
explicit ExtrinsicHandEyeCalibrationWidget(QWidget* parent = nullptr);
Expand Down
11 changes: 2 additions & 9 deletions gui/src/app/extrinsic_hand_eye_calibration_app.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#include <industrial_calibration/gui/extrinsic_hand_eye_calibration_widget.h>
#include <QApplication>
#include <QMainWindow>
#include <signal.h>

void handleSignal(int /*sig*/) { QApplication::instance()->quit(); }
Expand All @@ -12,16 +11,10 @@ int main(int argc, char** argv)
signal(SIGINT, handleSignal);
signal(SIGTERM, handleSignal);

// Create the main window
QMainWindow w;

// Create the IC widget
auto* widget = new industrial_calibration::ExtrinsicHandEyeCalibrationWidget(&w);
// Create the calibration main widget
industrial_calibration::ExtrinsicHandEyeCalibrationWidget w;
w.setWindowTitle("Extrinsic Hand Eye Calibration");
w.setWindowIcon(QIcon(":/icons/icon.jpg"));

// Set the IC widget as the central widget and show
w.setCentralWidget(widget);
w.showMaximized();

return app.exec();
Expand Down
15 changes: 6 additions & 9 deletions gui/src/extrinsic_hand_eye_calibration_widget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ void error(QTreeWidgetItem* item, const QString& message)
}

ExtrinsicHandEyeCalibrationWidget::ExtrinsicHandEyeCalibrationWidget(QWidget* parent)
: QWidget(parent)
: QMainWindow(parent)
, ui_(new Ui::ExtrinsicHandEyeCalibration())
, configuration_widget_(new ExtrinsicHandEyeCalibrationConfigurationWidget(this))
{
Expand All @@ -67,7 +67,7 @@ ExtrinsicHandEyeCalibrationWidget::ExtrinsicHandEyeCalibrationWidget(QWidget* pa
layout->addWidget(configuration_widget_);
dialog->setWindowTitle("Configuration Settings");

connect(ui_->push_button_edit_config, &QAbstractButton::clicked, dialog, &QWidget::show);
connect(ui_->action_edit_configuration, &QAction::triggered, dialog, &QWidget::show);
}

// Set the stretch factors of the horizontal splitter to make the proportions reasonable
Expand All @@ -81,12 +81,11 @@ ExtrinsicHandEyeCalibrationWidget::ExtrinsicHandEyeCalibrationWidget(QWidget* pa
});

// Set up push buttons
connect(ui_->push_button_load_config, &QPushButton::clicked, this, &ExtrinsicHandEyeCalibrationWidget::loadConfig);
connect(ui_->push_button_calibrate, &QPushButton::clicked, this, &ExtrinsicHandEyeCalibrationWidget::calibrate);
connect(ui_->push_button_save, &QPushButton::clicked, this, &ExtrinsicHandEyeCalibrationWidget::saveResults);
connect(ui_->action_load_configuration, &QAction::triggered, this, &ExtrinsicHandEyeCalibrationWidget::loadConfig);
connect(ui_->action_calibrate, &QAction::triggered, this, &ExtrinsicHandEyeCalibrationWidget::calibrate);
connect(ui_->action_save, &QAction::triggered, this, &ExtrinsicHandEyeCalibrationWidget::saveResults);

connect(ui_->push_button_load_observations, &QAbstractButton::clicked, this,
&ExtrinsicHandEyeCalibrationWidget::loadObservations);
connect(ui_->action_load_data, &QAction::triggered, this, &ExtrinsicHandEyeCalibrationWidget::loadObservations);
connect(ui_->tree_widget_observations, &QTreeWidget::itemClicked, this,
&ExtrinsicHandEyeCalibrationWidget::drawImage);

Expand All @@ -107,7 +106,6 @@ void ExtrinsicHandEyeCalibrationWidget::loadConfig()
if (config_file.isNull()) return;

configuration_widget_->load(config_file);
ui_->line_edit_config->setText(config_file);

QMessageBox::information(this, "Success", "Successfully loaded calibration configuration");
}
Expand Down Expand Up @@ -169,7 +167,6 @@ void ExtrinsicHandEyeCalibrationWidget::loadObservations()
ui_->tree_widget_observations->addTopLevelItem(item);
}

ui_->line_edit_observations->setText(observations_file);
ui_->tree_widget_observations->resizeColumnToContents(0);
}
catch (const std::exception& ex)
Expand Down
Loading