/*---------------------------------- private: ----------------------------{{{-*/
void
RvizTfTransformGraphicsWidget::extendLayout()
{
  m_markerLabel = new QLabel("Marker");
  m_markerEdit = new QLineEdit();
  connect(m_markerEdit, SIGNAL(editingFinished()), this, SLOT(updateMarker()));
  m_markerFileButton = new QPushButton(QApplication::style()->standardIcon(QStyle::SP_FileIcon), tr("&Mesh"));
  connect(m_markerFileButton, SIGNAL(pressed()), this, SLOT(markerDialog()));

  m_markerScaleLabel = new QLabel("Scale");
  m_markerScaleXEdit = new QLineEdit("1.0");
  m_markerScaleXEdit->setFixedWidth(40);
  connect(m_markerScaleXEdit, SIGNAL(editingFinished()), this, SLOT(updateMarker()));
  m_markerScaleYEdit = new QLineEdit("1.0");
  m_markerScaleYEdit->setFixedWidth(40);
  connect(m_markerScaleYEdit, SIGNAL(editingFinished()), this, SLOT(updateMarker()));
  m_markerScaleZEdit = new QLineEdit("1.0");
  m_markerScaleZEdit->setFixedWidth(40);
  connect(m_markerScaleZEdit, SIGNAL(editingFinished()), this, SLOT(updateMarker()));

  m_markerLayout = new QHBoxLayout();
  m_markerLayout->addWidget(m_markerLabel);
  m_markerLayout->addWidget(m_markerFileButton);
  m_markerLayout->addWidget(m_markerEdit);
  m_markerLayout->addWidget(m_markerScaleLabel);
  m_markerLayout->addWidget(m_markerScaleXEdit);
  m_markerLayout->addWidget(m_markerScaleYEdit);
  m_markerLayout->addWidget(m_markerScaleZEdit);

  m_topLayout->addLayout(m_markerLayout, m_topLayout->rowCount() + 1, 1);
  updateParentLabel();
}
示例#2
0
void Plot::createMenu ()
{
  setContextMenuPolicy(Qt::CustomContextMenu);
  connect(this, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(showContextMenu()));

  _menu = new QMenu(this);
  
  _dateAction = new QAction(QIcon(date_xpm), tr("&Date"), this);
  _dateAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_D));
  _dateAction->setToolTip(tr("Date"));
  _dateAction->setStatusTip(tr("Date"));
  _dateAction->setCheckable(TRUE);
  _dateAction->setChecked(TRUE);
  connect(_dateAction, SIGNAL(triggered(bool)), this, SLOT(showDate(bool)));
  _menu->addAction(_dateAction);

  _gridAction = new QAction(QIcon(grid_xpm), tr("&Grid"), this);
  _gridAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_G));
  _gridAction->setToolTip(tr("Grid"));
  _gridAction->setStatusTip(tr("Grid"));
  _gridAction->setCheckable(TRUE);
  _gridAction->setChecked(TRUE);
  connect(_gridAction, SIGNAL(triggered(bool)), this, SLOT(setGrid(bool)));
  _menu->addAction(_gridAction);

  _infoAction = new QAction(QIcon(about_xpm), tr("Bar &Info"), this);
  _infoAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_I));
  _infoAction->setToolTip(tr("Bar Info"));
  _infoAction->setStatusTip(tr("Bar Info"));
  _infoAction->setCheckable(TRUE);
  _infoAction->setChecked(TRUE);
  connect(_infoAction, SIGNAL(triggered(bool)), this, SLOT(setInfo(bool)));
  _menu->addAction(_infoAction);

  _menu->addSeparator();
  
  // create the chart object menu
  QMenu *mm = new QMenu(this);
  mm->setTitle(tr("New Plot Marker..."));
  connect(mm, SIGNAL(triggered(QAction *)), this, SLOT(markerMenuSelected(QAction *)));
  _menu->addMenu(mm);
  
  // buy
  QAction *a = new QAction(QIcon(buyarrow_xpm), tr("&Buy"), this);
  a->setToolTip(tr("Create Buy Arrow Plot Marker"));
  a->setStatusTip(QString(tr("Create Buy Arrow Plot Marker")));
  a->setData(QVariant("MarkerBuy"));
  mm->addAction(a);

  // hline
  a = new QAction(QIcon(horizontal_xpm), tr("&HLine"), this);
  a->setToolTip(tr("Create Horizontal Line Plot Marker"));
  a->setStatusTip(QString(tr("Create Horizontal Line Plot Marker")));
  a->setData(QVariant("MarkerHLine"));
  mm->addAction(a);

  // retracement
  a = new QAction(QIcon(fib_xpm), tr("&Retracement"), this);
  a->setToolTip(tr("Create Retracement Levels Plot Marker"));
  a->setStatusTip(QString(tr("Create Retracement Levels Plot Marker")));
  a->setData(QVariant("MarkerRetracement"));
  mm->addAction(a);

  // sell
  a = new QAction(QIcon(sellarrow_xpm), tr("&Sell"), this);
  a->setToolTip(tr("Create Sell Arrow Plot Marker"));
  a->setStatusTip(QString(tr("Create Sell Arrow Plot Marker")));
  a->setData(QVariant("MarkerSell"));
  mm->addAction(a);

  // text
  a = new QAction(QIcon(text_xpm), tr("&Text"), this);
  a->setToolTip(tr("Create Text Plot Marker"));
  a->setStatusTip(QString(tr("Create Text Plot Marker")));
  a->setData(QVariant("MarkerText"));
  mm->addAction(a);

  // tline
  a = new QAction(QIcon(trend_xpm), tr("T&Line"), this);
  a->setToolTip(tr("Create Trend Line Plot Marker"));
  a->setStatusTip(QString(tr("Create Trend Line Plot Marker")));
  a->setData(QVariant("MarkerTLine"));
  mm->addAction(a);

  // vline
  a = new QAction(QIcon(vertical_xpm), tr("&VLine"), this);
  a->setToolTip(tr("Create Vertical Line Plot Marker"));
  a->setStatusTip(QString(tr("Create Vertical Line Plot Marker")));
  a->setData(QVariant("MarkerVLine"));
  mm->addAction(a);
  
  // delete all chart objects
  a = new QAction(QIcon(delete_xpm), tr("Delete All Plot &Markers"), this);
  a->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_M));
  a->setToolTip(tr("Delete All Plot Markers"));
  a->setStatusTip(tr("Delete All Plot Markers"));
  connect(a, SIGNAL(triggered(bool)), this, SLOT(deleteAllMarkersDialog()));
  _menu->addAction(a);

  // marker menu
  _markerMenu = new QMenu(this);
  _markerMenu->addAction(QIcon(edit_xpm), QObject::tr("&Edit"), this, SLOT(markerDialog()), QKeySequence(Qt::ALT+Qt::Key_E));
  _markerMenu->addAction(QIcon(delete_xpm), QObject::tr("&Delete"), this, SLOT(deleteMarker()), QKeySequence(Qt::ALT+Qt::Key_D));
}
示例#3
0
void Plot::createMenu ()
{
  setContextMenuPolicy(Qt::CustomContextMenu);
  connect(this, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(showContextMenu()));

  _menu = new QMenu(this);
  
  _dateAction = new QAction(QIcon(":icons/calendar"), tr("Show &Dates"), this);
  _dateAction->setIconVisibleInMenu(true);
  _dateAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_D));
  _dateAction->setToolTip(tr("Show/Hide Date"));
  _dateAction->setStatusTip(tr("Show/Hide Date"));
  _dateAction->setCheckable(true);
  _dateAction->setChecked(true);
  connect(_dateAction, SIGNAL(triggered(bool)), this, SLOT(showDate(bool)));
  _menu->addAction(_dateAction);

  _gridAction = new QAction(QIcon(":icons/grid"), tr("Show &Grid"), this);
  _gridAction->setIconVisibleInMenu(true);
  _gridAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_G));
  _gridAction->setToolTip(tr("Show/Hide Grid"));
  _gridAction->setStatusTip(tr("Show/Hide Grid"));
  _gridAction->setCheckable(true);
  _gridAction->setChecked(true);
  connect(_gridAction, SIGNAL(triggered(bool)), this, SLOT(setGrid(bool)));
  _menu->addAction(_gridAction);

  _infoAction = new QAction(QIcon(":icons/info"), tr("Show Bar &Info"), this);
  _infoAction->setIconVisibleInMenu(true);
  _infoAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_I));
  _infoAction->setToolTip(tr("Show/Hide Bar Info"));
  _infoAction->setStatusTip(tr("Show/Hide Bar Info"));
  _infoAction->setCheckable(true);
  _infoAction->setChecked(true);
  connect(_infoAction, SIGNAL(triggered(bool)), this, SLOT(setInfo(bool)));
  _menu->addAction(_infoAction);

  _menu->addSeparator();
  
  // create the chart object menu
  QMenu *mm = new QMenu(this);
  mm->setTitle(tr("New Plot Marker..."));
  connect(mm, SIGNAL(triggered(QAction *)), this, SLOT(markerMenuSelected(QAction *)));
  _menu->addMenu(mm);

  // buy
  QAction *a = new QAction(QIcon(":icons/buy"), tr("&Buy"), this);
  a->setToolTip(tr("Create Buy Arrow Plot Marker"));
  a->setIconVisibleInMenu(true);
  a->setStatusTip(QString(tr("Create Buy Arrow Plot Marker")));
  a->setData(QVariant("MarkerBuy"));
  mm->addAction(a);

  // sell
  a = new QAction(QIcon(":icons/sell"), tr("&Sell"), this);
  a->setToolTip(tr("Create Sell Arrow Plot Marker"));
  a->setIconVisibleInMenu(true);
  a->setStatusTip(QString(tr("Create Sell Arrow Plot Marker")));
  a->setData(QVariant("MarkerSell"));
  mm->addAction(a);

  // tline
  a = new QAction(QIcon(":icons/trend"), tr("Trend &Line"), this);
  a->setIconVisibleInMenu(true);
  a->setToolTip(tr("Create Trend Line Plot Marker"));
  a->setStatusTip(QString(tr("Create Trend Line Plot Marker")));
  a->setData(QVariant("MarkerTLine"));
  mm->addAction(a);

  // tline
  a = new QAction(QIcon(":icons/trend"), tr("&Horizontal Line"), this);
  a->setIconVisibleInMenu(true);
  a->setToolTip(tr("Create Trend Line Plot Marker"));
  a->setStatusTip(QString(tr("Create Trend Line Plot Marker")));
  a->setData(QVariant("MarkerHLine"));
  mm->addAction(a);

  // marker menu
  _markerMenu = new QMenu(this);
  _markerMenu->addAction(QIcon(":icons/edit"), QObject::tr("&Edit"), this, SLOT(markerDialog()), QKeySequence(Qt::ALT+Qt::Key_E));
  _markerMenu->addAction(QIcon(":icons/delete"), QObject::tr("&Delete"), this, SLOT(deleteMarker()), QKeySequence(Qt::ALT+Qt::Key_D));
  _markerMenu->menuAction()->setIconVisibleInMenu(true);
}