change: UI and migrate to gtest
This commit is contained in:
@@ -45,6 +45,22 @@ NodeViewToolBar::NodeViewToolBar(QWidget *parent)
|
||||
&NodeViewToolBar::mini_map_enabled_toggled);
|
||||
layout->addWidget(minimap_btn_);
|
||||
|
||||
// Zoom controls per the UI design reference: [+] [-] [Fit]
|
||||
zoom_out_btn_ = new QPushButton();
|
||||
connect(zoom_out_btn_, &QPushButton::clicked, this,
|
||||
&NodeViewToolBar::zoom_out_clicked);
|
||||
layout->addWidget(zoom_out_btn_);
|
||||
|
||||
zoom_in_btn_ = new QPushButton();
|
||||
connect(zoom_in_btn_, &QPushButton::clicked, this,
|
||||
&NodeViewToolBar::zoom_in_clicked);
|
||||
layout->addWidget(zoom_in_btn_);
|
||||
|
||||
fit_btn_ = new QPushButton();
|
||||
connect(fit_btn_, &QPushButton::clicked, this,
|
||||
&NodeViewToolBar::fit_clicked);
|
||||
layout->addWidget(fit_btn_);
|
||||
|
||||
layout->addStretch();
|
||||
|
||||
retranslate();
|
||||
@@ -65,12 +81,18 @@ void NodeViewToolBar::retranslate()
|
||||
{
|
||||
add_node_btn_->setToolTip(tr("Add Node"));
|
||||
minimap_btn_->setToolTip(tr("Toggle Mini-Map"));
|
||||
zoom_in_btn_->setToolTip(tr("Zoom In"));
|
||||
zoom_out_btn_->setToolTip(tr("Zoom Out"));
|
||||
fit_btn_->setToolTip(tr("Fit to Content"));
|
||||
fit_btn_->setText(tr("Fit"));
|
||||
}
|
||||
|
||||
void NodeViewToolBar::update_icons()
|
||||
{
|
||||
add_node_btn_->setIcon(icon::add);
|
||||
minimap_btn_->setIcon(icon::mini_map);
|
||||
zoom_in_btn_->setIcon(icon::zoom_in);
|
||||
zoom_out_btn_->setIcon(icon::zoom_out);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -41,6 +41,12 @@ signals:
|
||||
|
||||
void mini_map_enabled_toggled(bool e);
|
||||
|
||||
void zoom_in_clicked();
|
||||
|
||||
void zoom_out_clicked();
|
||||
|
||||
void fit_clicked();
|
||||
|
||||
protected:
|
||||
virtual void changeEvent(QEvent *e) override;
|
||||
|
||||
@@ -52,6 +58,12 @@ private:
|
||||
QPushButton *add_node_btn_;
|
||||
|
||||
QPushButton *minimap_btn_;
|
||||
|
||||
QPushButton *zoom_in_btn_;
|
||||
|
||||
QPushButton *zoom_out_btn_;
|
||||
|
||||
QPushButton *fit_btn_;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -44,6 +44,12 @@ NodeWidget::NodeWidget(QWidget *parent)
|
||||
&NodeView::set_mini_map_enabled);
|
||||
connect(toolbar_, &NodeViewToolBar::add_node_clicked, node_view_,
|
||||
&NodeView::show_add_menu);
|
||||
connect(toolbar_, &NodeViewToolBar::zoom_in_clicked, node_view_,
|
||||
&NodeView::zoom_in);
|
||||
connect(toolbar_, &NodeViewToolBar::zoom_out_clicked, node_view_,
|
||||
&NodeView::zoom_out);
|
||||
connect(toolbar_, &NodeViewToolBar::fit_clicked, node_view_,
|
||||
&NodeView::center_on_items_bounding_rect);
|
||||
|
||||
// Set defaults
|
||||
toolbar_->set_mini_map_enabled(true);
|
||||
|
||||
Reference in New Issue
Block a user