2019-02-22 16:50:45 +00:00
|
|
|
#include "core/MainWindow.h"
|
2019-01-24 17:13:04 +00:00
|
|
|
#include "OverviewWidget.h"
|
|
|
|
#include "OverviewView.h"
|
|
|
|
|
|
|
|
OverviewWidget::OverviewWidget(MainWindow *main, QAction *action) :
|
|
|
|
CutterDockWidget(main, action)
|
|
|
|
{
|
2019-03-18 06:44:14 +00:00
|
|
|
setWindowTitle("Graph Overview");
|
|
|
|
setObjectName("Graph Overview");
|
|
|
|
setAllowedAreas(Qt::AllDockWidgetAreas);
|
|
|
|
graphView = new OverviewView(this);
|
|
|
|
setWidget(graphView);
|
2019-01-24 17:13:04 +00:00
|
|
|
refreshDeferrer = createRefreshDeferrer([this]() {
|
|
|
|
updateContents();
|
|
|
|
});
|
|
|
|
|
|
|
|
connect(this, &QDockWidget::visibilityChanged, this, [ = ](bool visibility) {
|
|
|
|
if (visibility) {
|
|
|
|
updateContents();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
OverviewWidget::~OverviewWidget() {}
|
|
|
|
|
2019-01-24 18:04:39 +00:00
|
|
|
void OverviewWidget::resizeEvent(QResizeEvent *event)
|
|
|
|
{
|
|
|
|
graphView->refreshView();
|
|
|
|
QDockWidget::resizeEvent(event);
|
2019-02-07 20:39:37 +00:00
|
|
|
emit resized();
|
2019-01-24 18:04:39 +00:00
|
|
|
}
|
|
|
|
|
2019-01-24 17:13:04 +00:00
|
|
|
void OverviewWidget::updateContents()
|
|
|
|
{
|
|
|
|
if (!refreshDeferrer->attemptRefresh(nullptr)) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
graphView->refreshView();
|
|
|
|
}
|
2019-03-08 18:57:57 +00:00
|
|
|
|
|
|
|
void OverviewWidget::closeEvent(QCloseEvent *event)
|
|
|
|
{
|
|
|
|
CutterDockWidget::closeEvent(event);
|
|
|
|
emit graphClose();
|
|
|
|
}
|
2019-03-27 08:24:54 +00:00
|
|
|
|
|
|
|
void OverviewWidget::setUserClosed(bool value)
|
|
|
|
{
|
|
|
|
userClosed = value;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool OverviewWidget::getUserClosed() const
|
|
|
|
{
|
|
|
|
return userClosed;
|
|
|
|
}
|
|
|
|
|
|
|
|
OverviewView *OverviewWidget::getGraphView() const
|
|
|
|
{
|
|
|
|
return graphView;
|
|
|
|
}
|