mirror of
https://github.com/epasveer/seer.git
synced 2026-08-30 09:00:42 +08:00
Add print support to Array visualizer.
Plus other comsetic changes.
This commit is contained in:
+24
-1
@@ -3,6 +3,8 @@
|
||||
#include <QtGui/QGuiApplication>
|
||||
#include <QtWidgets/QApplication>
|
||||
#include <QtCore/QDebug>
|
||||
#include <QtPrintSupport/QPrinter>
|
||||
#include <QtPrintSupport/QPrintDialog>
|
||||
|
||||
QZoomChartView::QZoomChartView (QWidget* parent) : QChartView(parent) {
|
||||
|
||||
@@ -18,6 +20,16 @@ QZoomChartView::QZoomChartView (QChart* chart, QWidget* parent) : QChartView(cha
|
||||
setRubberBand(QChartView::RectangleRubberBand);
|
||||
}
|
||||
|
||||
void QZoomChartView::printView () {
|
||||
|
||||
QPrinter printer;
|
||||
if (QPrintDialog(&printer).exec() == QDialog::Accepted) {
|
||||
QPainter painter(&printer);
|
||||
painter.setRenderHint(QPainter::Antialiasing);
|
||||
render(&painter);
|
||||
}
|
||||
}
|
||||
|
||||
bool QZoomChartView::viewportEvent (QEvent* event) {
|
||||
|
||||
// Disable ToolTip events in the ChartView. They interfer with the 'length' arguments
|
||||
@@ -136,7 +148,18 @@ void QZoomChartView::keyPressEvent (QKeyEvent* event) {
|
||||
chart()->update();
|
||||
break;
|
||||
case Qt::Key_R:
|
||||
chart()->update();
|
||||
{
|
||||
if (event->modifiers() == Qt::ControlModifier) {
|
||||
chart()->update();
|
||||
}
|
||||
}
|
||||
break;
|
||||
case Qt::Key_P:
|
||||
{
|
||||
if (event->modifiers() == Qt::ControlModifier) {
|
||||
printView();
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
QGraphicsView::keyPressEvent(event);
|
||||
|
||||
Reference in New Issue
Block a user