smart_plot::smart_plot(QWidget *parent) : QMainWindow(parent) { myUrlHandler *myHandler = new myUrlHandler(); QDesktopServices::setUrlHandler("file", myHandler, "files"); connect(myHandler, SIGNAL(openFile(const QString&)), this, SLOT( iosOpen(const QString &))); setWindowTitle(tr("Smartplot Ver 2.02.001")); QCoreApplication::setOrganizationName("bgodding"); QCoreApplication::setApplicationName("smartplot"); this->setMinimumSize(320,240); this->resize(1024, 600); this->installEventFilter(this); plots.append(new QCustomPlot(this)); //Setup the main menu QMenu *fileMenu = menuBar()->addMenu(tr("&File")); //Data Handlers: Add menu calls here csvHandler.addToSystemMenu(fileMenu, activePlot()); gitClocHandler.addToSystemMenu(fileMenu, activePlot()); //influxdbHandler.addToSystemMenu(fileMenu, activePlot()); fileMenu->addSeparator(); fileMenu->addAction( QIcon(":/graphics/savePlot.png"), tr("&SaveImage"), this, SLOT(savePlotAsImage()) ); activePlot()->setOpenGl(true,16); setCentralWidget(activePlot()); initGraph(activePlot()); initLegend(activePlot()); #ifdef MOBILE setAttribute( Qt::WA_AcceptTouchEvents ); grabGesture( Qt::TapAndHoldGesture ); // //TODO: Only use these on mobile in lou of pinch to zoom on crappy hardware? QPushButton *zoomIn = new QPushButton("+", this); zoomIn->setObjectName("+"); connect(zoomIn, SIGNAL(released()), this, SLOT(zoomInButtonPressed())); QPushButton *zoomOut = new QPushButton("-", this); zoomOut->setObjectName("-"); connect(zoomOut, SIGNAL(released()), this, SLOT(zoomOutButtonPressed())); #endif contextMenu = new QMenu(this); this->installEventFilter(this); }
void Graph::showLegend(bool show) { if(show == (legend() != NULL)) return; if(show) initLegend(); else delete legend(); updateLayout(); }
TestRegressionWindow::TestRegressionWindow(QWidget *parent) : QMainWindow(parent), m_flags(None), m_runCounter(0), m_testCounter(0), m_totalTests(0), m_totalTestsJS(0), m_totalTestsDOMTS(0), m_lastResult(Unknown), m_browserPart(0), m_activeProcess(0), m_activeTreeItem(0), m_suspended(false), m_justProcessingQueue(false) { m_ui.setupUi(this); // Setup actions/connections connect(m_ui.actionOnly_run_JS_tests, SIGNAL(toggled(bool)), SLOT(toggleJSTests(bool))); connect(m_ui.actionOnly_run_HTML_tests, SIGNAL(toggled(bool)), SLOT(toggleHTMLTests(bool))); connect(m_ui.actionDo_not_suppress_debug_output, SIGNAL(toggled(bool)), SLOT(toggleDebugOutput(bool))); connect(m_ui.actionDo_not_use_Xvfb, SIGNAL(toggled(bool)), SLOT(toggleNoXvfbUse(bool))); connect(m_ui.actionSpecify_tests_directory, SIGNAL(triggered(bool)), SLOT(setTestsDirectory())); connect(m_ui.actionSpecify_khtml_directory, SIGNAL(triggered(bool)), SLOT(setKHTMLDirectory())); connect(m_ui.actionSpecify_output_directory, SIGNAL(triggered(bool)), SLOT(setOutputDirectory())); connect(m_ui.actionRun_tests, SIGNAL(triggered(bool)), SLOT(runTests())); connect(m_ui.pauseContinueButton, SIGNAL(clicked(bool)), SLOT(pauseContinueButtonClicked())); connect(m_ui.saveLogButton, SIGNAL(clicked(bool)), SLOT(saveLogButtonClicked())); connect(m_ui.treeWidget, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(treeWidgetContextMenuRequested(const QPoint &))); // Setup actions' default state m_ui.progressBar->setValue(0); m_ui.textEdit->setReadOnly(true); m_ui.actionRun_tests->setEnabled(false); m_ui.pauseContinueButton->setEnabled(false); m_ui.treeWidget->headerItem()->setTextAlignment(0, Qt::AlignLeft); m_ui.treeWidget->headerItem()->setText(0, i18n("Available Tests: 0")); // Load default values for tests directory/khtml directory... KConfig config("testregressiongui", KConfig::SimpleConfig); KConfigGroup grp = config.group("<default>"); m_testsUrl = KUrl::fromPath(grp.readPathEntry("TestsDirectory", QString())); m_khtmlUrl = KUrl::fromPath(grp.readPathEntry("KHTMLDirectory", QString())); initTestsDirectory(); // Init early visible items in the text edit... initLegend(); initOutputBrowser(); }
Graph::Graph(QWidget *parent) : QwtPlot(parent) { // zoom in/out with the wheel Magnifier *magnifier = new Magnifier( canvas() ); magnifier->setMouseButton(Qt::NoButton); // panning with the left mouse button Panner *panner = new Panner( canvas() ); panner->setMouseButton(Qt::LeftButton); // zooming with middle button QwtPlotZoomer *zoomer = new QwtPlotZoomer(canvas()); { QVector<QwtEventPattern::MousePattern> pattern(6); pattern[0].button = Qt::MiddleButton; zoomer->setMousePattern(pattern); } m_grid = new QwtPlotGrid(); m_grid->setMinorPen(QPen(Qt::gray, 0.0, Qt::DotLine)); m_grid->setMajorPen(QPen(Qt::black, 0.0, Qt::DotLine)); m_grid->enableX(true); m_grid->enableXMin(true); m_grid->enableY(true); m_grid->enableYMin(true); m_grid->attach(this); initLegend(); connect(axisWidget(QwtPlot::xBottom), SIGNAL(scaleDivChanged()), SIGNAL(updateSampleSize())); setAxisScale(QwtPlot::xBottom, -20, 20); setAxisScale(QwtPlot::yRight, -20, 20); setAxisScale(QwtPlot::yLeft, -20, 20); axisWidget(QwtPlot::xBottom)->setToolTip(tr("Double-click to add marker")); axisWidget(QwtPlot::yLeft)->setToolTip(tr("Double-click to add marker")); axisWidget(QwtPlot::yRight)->setToolTip(tr("Double-click to add marker")); // to show graph appearance while dragging from add button to widget area replot(); }