QTM_BEGIN_NAMESPACE QGeoTiledMapCustomObjectInfo::QGeoTiledMapCustomObjectInfo(QGeoTiledMapData *mapData, QGeoMapObject *mapObject) : QGeoTiledMapObjectInfo(mapData, mapObject) { custom = static_cast<QGeoMapCustomObject*>(mapObject); connect(custom, SIGNAL(triggerUpdate()), this, SLOT(updateTriggered())); connect(custom, SIGNAL(graphicsItemChanged(QGraphicsItem*)), this, SLOT(graphicsItemChanged(QGraphicsItem*))); connect(custom, SIGNAL(offsetChanged(QPoint)), this, SLOT(offsetChanged(QPoint))); graphicsItem = 0; graphicsItemChanged(this->custom->graphicsItem()); offsetChanged(this->custom->offset()); }
void MainWindow::init() { /* MenuBar */ setMenuBar(new MenuBar(addToolBar(tr("")), this)); connect(menuBar(), SIGNAL(newTabTriggered()), this, SLOT(newTab())); connect(menuBar(), SIGNAL(openTriggered()), this, SLOT(openTriggered())); connect(menuBar(), SIGNAL(openClipboardTriggered()), this, SLOT(openClipboardTriggered())); connect(menuBar(), SIGNAL(saveAsTriggered()), this, SLOT(saveAsTriggered())); connect(menuBar(), SIGNAL(saveHtmlTriggered()), this, SLOT(saveHtmlTriggered())); connect(menuBar(), SIGNAL(printTriggered()), this, SLOT(printTriggered())); connect(menuBar(), SIGNAL(closeTabTriggered()), this, SLOT(closeTabTriggered())); connect(menuBar(), SIGNAL(quitTriggered()), this, SLOT(close())); connect(menuBar(), SIGNAL(findNextTriggered()), this, SLOT(findNextTriggered())); connect(menuBar(), SIGNAL(findPreviousTriggered()), this, SLOT(findPreviousTriggered())); connect(menuBar(), SIGNAL(gotoLineTriggered()), this, SLOT(gotoLineTriggered())); connect(menuBar(), SIGNAL(reloadTriggered()), this, SLOT(reloadTriggered())); connect(menuBar(), SIGNAL(zoomInTriggered()), this, SLOT(zoomInTriggered())); connect(menuBar(), SIGNAL(zoomOutTriggered()), this, SLOT(zoomOutTriggered())); connect(menuBar(), SIGNAL(zoomNormalTriggered()), this, SLOT(zoomNormalTriggered())); connect(menuBar(), SIGNAL(lineWrapTriggered()), this, SLOT(lineWrapTriggered())); connect(menuBar(), SIGNAL(optionTriggered()), this, SLOT(optionTriggered())); connect(menuBar(), SIGNAL(updateTriggered()), this, SLOT(updateTriggered())); connect(menuBar(), SIGNAL(reportBugTriggered()), this, SLOT(reportBugTriggered())); connect(menuBar(), SIGNAL(requestFeatureTriggered()), this, SLOT(requestFeatureTriggered())); connect(menuBar(), SIGNAL(aboutTriggered()), this, SLOT(aboutTriggered())); connect(menuBar(), SIGNAL(openRecentFiles(QAction*)), this, SLOT(openRecentFiles(QAction*))); connect(menuBar(), SIGNAL(fileBrowserVisibleChanged(bool)), this, SLOT(fileBrowserVisibleChanged(bool))); connect(menuBar(), SIGNAL(resultViewVisibleChanged(bool)), this, SLOT(resultViewVisibleChanged(bool))); connect(menuBar(), SIGNAL(chartViewVisibleChanged(bool)), this, SLOT(chartViewVisibleChanged(bool))); connect(static_cast<MenuBar*>(menuBar())->searchLineEdit(), SIGNAL(returnPressed()), this, SLOT(findNextTriggered())); /* StatusBar */ setStatusBar(new StatusBar(this)); connect(static_cast<StatusBar*>(statusBar()), SIGNAL(textEncodingChanged(QString)), this, SLOT(textEncodingChanged(QString))); /* TabWidget */ m_tabWidget = new TabWidget(this); connect(m_tabWidget, SIGNAL(newTab()), this, SLOT(newTab())); connect(m_tabWidget, SIGNAL(closeAll()), this, SLOT(closeAll())); connect(m_tabWidget, SIGNAL(closeOthers(int)), this, SLOT(closeOthers(int))); connect(m_tabWidget, SIGNAL(tabCloseRequested(int)), this, SLOT(closeTab(int))); connect(m_tabWidget, SIGNAL(currentChanged(int)), this, SLOT(tabChanged(int))); newTab(); setCentralWidget(m_tabWidget); /* DockWidget */ createDockWidget(); /* Keyword Button Group */ connect(keywordButtonGroup(), SIGNAL(buttonReloaded()), LOGVIEWERMANAGER(), SLOT(keywordButtonGroupReloaded())); connect(keywordButtonGroup(), SIGNAL(buttonClicked(QWidget*,QButtonGroup*)), LOGVIEWERMANAGER(), SLOT(keywordButtonGroupClicked(QWidget*,QButtonGroup*))); connect(keywordButtonGroup(), SIGNAL(buttonAdded(QStringList&)), LOGVIEWERMANAGER(), SLOT(keywordButtonGroupAdded(QStringList&))); connect(keywordButtonGroup(), SIGNAL(buttonRemoved(QStringList&)), LOGVIEWERMANAGER(), SLOT(keywordButtonGroupRemoved(QStringList&))); /* File Load Manager */ connect(FILELOADMANAGER(), SIGNAL(loadStarted(QWidget*)), this, SLOT(fileLoadStarted(QWidget*))); connect(FILELOADMANAGER(), SIGNAL(loadProgress(QWidget*,QString*,int)), this, SLOT(fileLoadProgress(QWidget*,QString*,int))); connect(FILELOADMANAGER(), SIGNAL(loadFinished(QWidget*,QString*)), this, SLOT(fileLoadProgress(QWidget*,QString*))); connect(FILELOADMANAGER(), SIGNAL(codecDected(QString)), this, SLOT(codecDected(QString))); connect(FILELOADMANAGER(), SIGNAL(loadStarted(QWidget*)), m_tabWidget, SLOT(fileLoadStarted(QWidget*))); connect(FILELOADMANAGER(), SIGNAL(loadFinished(QWidget*,QString*)), m_tabWidget, SLOT(fileLoadFinished(QWidget*))); connect(FILELOADMANAGER(), SIGNAL(loadStarted(QWidget*)), LOGVIEWERMANAGER(), SLOT(fileLoadStarted(QWidget*))); connect(FILELOADMANAGER(), SIGNAL(loadFinished(QWidget*,QString*)), LOGVIEWERMANAGER(), SLOT(fileLoadFinished(QWidget*))); connect(FILELOADMANAGER(), SIGNAL(fileSizeNotify(QWidget*,long)), LOGVIEWERMANAGER(), SLOT(fileSizeNotified(QWidget*,long))); connect(FILELOADMANAGER(), SIGNAL(fileNameNotify(QWidget*,QString)), LOGVIEWERMANAGER(), SLOT(fileNameNotified(QWidget*,QString))); /* Log Viewer */ connect(LOGVIEWERMANAGER(), SIGNAL(selectionChanged(QWidget*)), this, SLOT(selectionChanged(QWidget*))); connect(LOGVIEWERMANAGER(), SIGNAL(cursorPositionChanged(QWidget*)), this, SLOT(cursorPositionChanged(QWidget*))); connect(LOGVIEWERMANAGER(), SIGNAL(fileDropped(QString)), this, SLOT(fileDropped(QString))); connect(LOGVIEWERMANAGER(), SIGNAL(modelCreated(QWidget*, QStandardItemModel*)), this, SLOT(modelCreated(QWidget*, QStandardItemModel*))); connect(LOGVIEWERMANAGER(), SIGNAL(chartLoaded(QWidget*, QPixmap*)), this, SLOT(chartLoaded(QWidget*, QPixmap*))); }
void LinePlotCanvas::paint(QPainter *painter) { if (!updateTriggered()) return; resetTrigger(); LinePlot *plot = qobject_cast<LinePlot*>(parent()); if (!plot) return; Axis2DBase *monAxis = plot->axis2d(); NDArray &xArray = plot->xData(), &yArray = plot->yData(); bool emptyX = (plot->xSize() == 0); int N = (emptyX) ? plot->ySize() : qMin( plot->xSize(), plot->ySize() ); if (!monAxis || N == 0 || yArray.type() == NDArray::Unknown) return; // Nothing to do NDArrayTyped<qreal> yData = yArray.convert<qreal>(); QRectF lim = monAxis->limits(); // Get the transform params QTransform tran = Util::plotToView(QSizeF(plot->width(), plot->height()), lim, monAxis->xAxis()->inverted(), monAxis->yAxis()->inverted()); qreal tx, ty, sx, sy, limx, limy; Util::plotToView(plot->width(), plot->height(), lim, monAxis->xAxis()->inverted(), monAxis->yAxis()->inverted(), tx, ty, sx, sy); limx = lim.x(); limy = lim.y(); bool is_lines = (plot->line()->style() != "."); if (is_lines && N < 2) return; // Nothing to draw // Allow the printer state to be restored painter->save(); // painter->setTransform(QTransform()); preparePainter(painter, plot); if (is_lines) { QPainterPath path; int starty = plot->startIndexY(); auto y = yData.begin() + starty; if (emptyX) { // Get the first point int startx = 0; qreal x = 0; DRAW_LINES(x, *y); } else { auto xData = xArray.convert<qreal>(); // Get the first point int startx = plot->startIndexX(); auto x = xData.begin() + startx; DRAW_LINES(*x, *y); } // qDebug() << "Path:" << path; painter->drawPath(path); } else { // Just drawing markers, therefore no need to "cut" lines, etc qreal radius = painter->pen().widthF() * 0.5; qreal px, py; if (emptyX) { int x = 0; auto y = yData.begin(); DRAW_DOTS(x, *y); } else { auto xData = xArray.convert<qreal>(); auto x = xData.begin(), y = yData.begin(); DRAW_DOTS(*x, *y); } } // Restore the painter to its former glory painter->restore(); }