cutter/src/widgets/OverviewWidget.h

96 lines
2.2 KiB
C
Raw Normal View History

#ifndef OVERVIEWWIDGET_H
#define OVERVIEWWIDGET_H
#include "CutterDockWidget.h"
class MainWindow;
class OverviewView;
class GraphWidget;
class OverviewWidget : public CutterDockWidget
{
Q_OBJECT
public:
explicit OverviewWidget(MainWindow *main);
~OverviewWidget();
private:
OverviewView *graphView;
bool isAvailable = false;
bool userOpened = false;
GraphWidget *targetGraphWidget;
RefreshDeferrer *graphDataRefreshDeferrer;
2019-03-06 20:30:39 +00:00
/**
* @brief this takes care of scaling the overview when the widget is resized
2019-01-24 18:04:39 +00:00
*/
void resizeEvent(QResizeEvent *event) override;
void setIsAvailable(bool isAvailable);
void setUserOpened(bool userOpened);
void zoomTarget(int d);
private slots:
void showEvent(QShowEvent *event) override;
void closeEvent(QCloseEvent *event) override;
2019-03-06 20:30:39 +00:00
/**
* @brief update the view in the target widget when the range rect in the overview is moved
*/
void updateTargetView();
/**
2021-01-24 14:50:13 +00:00
* @brief update the content of the graph (blocks, edges) in the contained graphView from the
* target widget
*/
void updateGraphData();
/**
* @brief update the rect to show the current view in the target widget
*/
void updateRangeRect();
void targetClosed();
signals:
2019-03-06 20:30:39 +00:00
/**
* @brief emit signal to update the rect
*/
void resized();
/**
* @sa getIsAvailable()
*/
void isAvailableChanged(bool isAvailable);
/**
* @sa getUserOpened()
*/
void userOpenedChanged(bool userOpened);
public:
GraphWidget *getTargetGraphWidget() { return targetGraphWidget; }
void setTargetGraphWidget(GraphWidget *widget);
/**
* @brief whether this widget makes sense to be show, i.e. the menu entry should be enabled
*/
2021-01-24 14:50:13 +00:00
bool getIsAvailable() const { return isAvailable; }
/**
* @brief whether this widget is desired to be shown in general
*
* Will be false when the user closed the overview explicitly.
* Also corresponds to the checked state of the menu entry for this widget.
*/
2021-01-24 14:50:13 +00:00
bool getUserOpened() const { return userOpened; }
2021-01-24 14:50:13 +00:00
OverviewView *getGraphView() const { return graphView; }
void wheelEvent(QWheelEvent *event) override;
};
#endif // OverviewWIDGET_H