Changeset 18023
- Timestamp:
- 11/24/14 09:12:27 (10 years ago)
- Location:
- fact/Evidence
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
fact/Evidence/GUI.cc
r18017 r18023 341 341 342 342 // Additonal context menu items 343 QAction* Action = Menu->addAction("Paste service", this, SLOT(MenuPasteService()));343 QAction* Action = Menu->addAction("Paste", this, SLOT(MenuPaste())); 344 344 Menu->removeAction(Action); 345 Menu->insertAction(Menu->actions().value(1), Action); 346 Action = Menu->addAction("Copy time scale", this, SLOT(MenuCopyTimeScale())); 345 347 Menu->insertAction(Menu->actions().value(1), Action); 346 348 … … 437 439 } 438 440 439 // Add new service by pasting name 440 void EddPlot::MenuPasteService() { 441 // Menu: Copy time scale 442 void EddPlot::MenuCopyTimeScale() { 443 444 double Min = axisInterval(QwtPlot::xBottom).minValue(), Max = axisInterval(QwtPlot::xBottom).maxValue(); 445 QMimeData *MimeData = new QMimeData; 446 QByteArray Data; 447 448 Data.append((char *) &Min, sizeof(double)); 449 Data.append((char *) &Max, sizeof(double)); 450 MimeData->setData("Edd/TimeScale", Data); 451 452 QApplication::clipboard()->setMimeData(MimeData); 453 } 454 455 // Add new service by pasting name or paste time scale 456 void EddPlot::MenuPaste() { 441 457 442 458 const QMimeData *D = QApplication::clipboard()->mimeData(); 443 if (!D->hasFormat("Edd/Service")) return; 444 445 QByteArray E(D->data("Edd/Service")); 446 AddService(E.left(E.lastIndexOf(' ')), E.right(E.size()-E.lastIndexOf(' ')).toInt()); 459 460 if (D->data("Edd/TimeScale").size() == 2*sizeof(double)) { 461 setAxisScale(QwtPlot::xBottom, *((double *) D->data("Edd/TimeScale").data()), *((double *) D->data("Edd/TimeScale").data() + 1)); 462 replot(); 463 return; 464 } 465 466 if (D->hasFormat("Edd/Service")) { 467 QByteArray E(D->data("Edd/Service")); 468 AddService(E.left(E.lastIndexOf(' ')), E.right(E.size()-E.lastIndexOf(' ')).toInt()); 469 } 447 470 } 448 471 -
fact/Evidence/GUI.h
r17039 r18023 187 187 188 188 private slots: 189 void MenuPasteService(); 189 void MenuPaste(); 190 void MenuCopyTimeScale(); 190 191 void MenuShowLastHour(); 191 192 void MenuShowLastDay();
Note:
See TracChangeset
for help on using the changeset viewer.