Changeset 4630 in ntrip for trunk


Ignore:
Timestamp:
Sep 1, 2012, 2:57:37 PM (12 years ago)
Author:
mervart
Message:
 
Location:
trunk/BNC/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/src/bncmap.h

    r4627 r4630  
    1616 public slots:
    1717  void slotNewPoint(const QString& name, double latDeg, double lonDeg);
    18    
     18
     19 private slots:
     20  void slotClose();
     21  void slotPrint();
     22
     23 protected:
     24  virtual void closeEvent(QCloseEvent *);
     25
    1926 private:
    20   QwtPlot* _mapPlot;
     27  QwtPlot*     _mapPlot;
     28  QPushButton* _buttonClose;
     29  QPushButton* _buttonPrint;
    2130};
    2231
  • trunk/BNC/src/bncmap_svg.cpp

    r4629 r4630  
    1717t_bncMap::t_bncMap(QWidget* parent) : QDialog(parent) {
    1818
     19  // Map in Scalable Vector Graphics (svg) Format
     20  // --------------------------------------------
    1921  _mapPlot = new QwtPlot();
    2022
     
    2830  mapItem->attach(_mapPlot);
    2931
     32  // Buttons
     33  // -------
     34  int ww = QFontMetrics(font()).width('w');
     35
     36  _buttonClose = new QPushButton(tr("Close"), this);
     37  _buttonClose->setMaximumWidth(10*ww);
     38  connect(_buttonClose, SIGNAL(clicked()), this, SLOT(slotClose()));
     39
     40  _buttonPrint = new QPushButton(tr("Print"), this);
     41  _buttonPrint->setMaximumWidth(10*ww);
     42  connect(_buttonPrint, SIGNAL(clicked()), this, SLOT(slotPrint()));
     43
     44  // Layout
     45  // ------
     46  QHBoxLayout* buttonLayout = new QHBoxLayout;
     47  buttonLayout->addWidget(_buttonClose);
     48  buttonLayout->addWidget(_buttonPrint);
     49
    3050  QVBoxLayout* mainLayout = new QVBoxLayout(this);
    3151  mainLayout->addWidget(_mapPlot);
     52  mainLayout->addLayout(buttonLayout);
    3253
     54  // Important
     55  // ---------
    3356  _mapPlot->replot();
    3457}
     
    5477}
    5578
     79// Close
     80////////////////////////////////////////////////////////////////////////////
     81void t_bncMap::slotClose() {
     82  done(0);
     83}
    5684
     85// Close Dialog gracefully
     86////////////////////////////////////////////////////////////////////////////
     87void t_bncMap::closeEvent(QCloseEvent* event) {
     88  QDialog::closeEvent(event);
     89}
    5790
     91// Print the widget
     92////////////////////////////////////////////////////////////////////////////
     93void t_bncMap::slotPrint() {
     94
     95  QPrinter printer;
     96  QPrintDialog* dialog = new QPrintDialog(&printer, this);
     97  dialog->setWindowTitle(tr("Print Plot"));
     98  if (dialog->exec() != QDialog::Accepted) {
     99    return;
     100  }
     101  else {
     102    qDebug() << "Print Map";
     103  }
     104}
Note: See TracChangeset for help on using the changeset viewer.