- Timestamp:
- 08/26/13 16:11:27 (11 years ago)
- Location:
- fact/Evidence
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
fact/Evidence/GUI.cc
r17037 r17039 339 339 // Horizontal time scale 340 340 setAxisScaleDraw(QwtPlot::xBottom, new EddDateScale()); 341 connect(axisWidget(QwtPlot::xBottom), SIGNAL(scaleDivChanged()), SLOT(ScaleUpdate())); 342 341 343 342 // Additonal context menu items 344 343 QAction* Action = Menu->addAction("Paste service", this, SLOT(MenuPasteService())); … … 424 423 NewData = true; 425 424 } 426 }427 428 // Add text indicating time range to plot429 void EddPlot::ScaleUpdate() {430 431 QwtText Text;432 QFont Font;433 434 // Set footer435 Text = QDateTime::fromMSecsSinceEpoch(axisScaleDiv(QwtPlot::xBottom).lowerBound()).toString("d-MMM-yyyy hh:mm:ss") + " to " + QDateTime::fromMSecsSinceEpoch(axisScaleDiv(QwtPlot::xBottom).upperBound()).toString("d-MMM-yyyy hh:mm:ss");436 437 Font.setPointSize(6);438 Text.setFont(Font);439 setFooter(Text);440 425 } 441 426 … … 702 687 else setCanvasBackground(EddPlotBackgroundColor); 703 688 689 // Set footer 690 QwtText Text; 691 QFont Font; 692 693 Text = QDateTime::fromMSecsSinceEpoch(axisScaleDiv(QwtPlot::xBottom).lowerBound()).toString("d-MMM-yyyy hh:mm:ss") + " to " + 694 QDateTime::fromMSecsSinceEpoch(axisScaleDiv(QwtPlot::xBottom).upperBound()).toString("d-MMM-yyyy hh:mm:ss") + 695 (StripAction->isChecked() ? " (Stripchart)" : ""); 696 697 Font.setPointSize(6); 698 Text.setFont(Font); 699 setFooter(Text); // For EddScope (not a history plot, no time scale) this action is removed 700 701 // Recalculate statistics 704 702 ReDoStats(); 705 703 } … … 836 834 } 837 835 838 // Double clicking hightlights curve 839 void EddBasePlot::mouseDoubleClickEvent (QMouseEvent *Event) { 840 836 // Mouse events: Release click highlights curve if mouse did not move (which is zoom) 837 void EddBasePlot::mousePressEvent(QMouseEvent *) { 838 839 MouseMoved = false; 840 } 841 842 void EddBasePlot::mouseMoveEvent(QMouseEvent *) { 843 844 MouseMoved = true; 845 } 846 847 void EddBasePlot::mouseReleaseEvent(QMouseEvent *Event) { 848 841 849 double Dist, MinDistance = std::numeric_limits<double>::infinity(); 842 850 int Index = -1; 843 851 852 if (Event->button() != Qt::LeftButton || MouseMoved) return; 853 844 854 // Check which curve is closest 845 855 for (int i=0; i<Items.size(); i++) { 846 if (Items[i].Signal->closestPoint( Event->pos(), &Dist) != -1 && Dist < MinDistance) {856 if (Items[i].Signal->closestPoint(canvas()->mapFromGlobal(QCursor::pos()), &Dist) != -1 && Dist < MinDistance) { 847 857 MinDistance = Dist; 848 858 Index = i; … … 943 953 "Pan\tShift and left mouse button\n\n" 944 954 "ESC cancels selection\n" 945 " Double-clicking highlights nearest curve\n"955 "Clicking near a curve or on legend highlights\n" 946 956 "Cursor keys move mouse\n\n" 947 957 "Statistics are calculated over the current x axis extend\n\n" … … 1008 1018 } 1009 1019 1010 // Handling of mouse release event: Open history1020 // Handling of mouse release event: Mark line 1011 1021 void EddLegendLabel::mouseReleaseEvent(QMouseEvent *Event) { 1012 1022 1013 1023 if (Event->button() != Qt::LeftButton) return; 1014 1024 1015 QString D(text().text()); 1016 D.replace(':',' '); 1017 QStringList A = D.split(" "); 1018 1019 OpenHistory(A[0].toAscii().data(), A[1].toInt()); 1020 } 1025 ThickLineAction->toggle(); 1026 } 1021 1027 1022 1028 // Menu: Open history plot -
fact/Evidence/GUI.h
r17037 r17039 78 78 QwtPlotMarker *Stats; 79 79 class EddLegend *Legend; 80 80 bool MouseMoved; 81 81 82 public: 82 83 EddBasePlot(QWidget * = NULL); … … 98 99 void HandleZoom(const QRectF &); 99 100 void MouseSelection(const QPolygon &); 100 void mouseDoubleClickEvent(QMouseEvent *); 101 void mousePressEvent(QMouseEvent *); 102 void mouseReleaseEvent(QMouseEvent *); 103 void mouseMoveEvent(QMouseEvent *); 101 104 void contextMenuEvent(QContextMenuEvent *); 102 105 void MenuSetUpdateRate(); … … 166 169 167 170 private: 168 //EddDateScale *Scale;169 171 QwtLegend *Legend; 170 172 QTimer *SingleShot; … … 185 187 186 188 private slots: 187 void ScaleUpdate();188 189 void MenuPasteService(); 189 190 void MenuShowLastHour();
Note:
See TracChangeset
for help on using the changeset viewer.