void QmitkSliderLevelWindowWidget::contextMenuEvent( QContextMenuEvent * )
{
  m_Contextmenu->setLevelWindowManager(m_Manager.GetPointer());
  auto contextMenu = new QMenu( this );
  Q_CHECK_PTR( contextMenu );
  if (m_ScaleVisible)
    contextMenu->addAction(tr("Hide Scale"), this, SLOT(hideScale()));
  else
    contextMenu->addAction(tr("Show Scale"), this, SLOT(showScale()));
  contextMenu->addSeparator();
  m_Contextmenu->getContextMenu(contextMenu);

  // Fix: Bug #13327 we need to reset the m_MouseDown value
  // otherwise the cursor is not correctly restored afterwards
  m_MouseDown = false;
}
Beispiel #2
0
void BarWidget::loadWidgetInfo(DataFileParser *file)
{
    DataWidget::loadWidgetInfo(file);

    // data type
    if(file->seekToNextBlock("barWType", BLOCK_WIDGET))
    {
        file->read((char*)&m_numberType, sizeof(m_numberType));
        setDataType(m_numberType);
    }

    // range
    if(file->seekToNextBlock("barWRangeDouble", BLOCK_WIDGET))
    {
        double min = file->readVal<double>();
        double max = file->readVal<double>();
        m_bar->setScale(min, max);
    }
    else if(file->seekToNextBlock("barWRange", BLOCK_WIDGET))
    {
        double min = file->readVal<int>();
        double max = file->readVal<int>();
        m_bar->setScale(min, max);
    }

    //rotation
    if(file->seekToNextBlock("barWRotation", BLOCK_WIDGET))
    {
        file->read((char*)&m_rotation, sizeof(m_rotation));
        rotate(m_rotation);
    }

    // visibility
    if(file->seekToNextBlock("barWVisibility", BLOCK_WIDGET))
    {
        showScale(file->readVal<bool>());
        showVal(file->readVal<bool>());
    }

    // colors
    if(file->seekToNextBlock("barWColors", BLOCK_WIDGET))
    {
        QPalette p = m_bar->palette();
        Q_ASSERT(COLOR_COUNT == 3);
        for(int i = 0; i < COLOR_COUNT; ++i)
            p.setColor(roles[i], QColor(file->readString()));
        m_bar->setPalette(p);
    }

    // alarm
    if(file->seekToNextBlock("barWAlarm", BLOCK_WIDGET))
    {
        bool enable = file->readVal<bool>();
        m_bar->setAlarmLevel(file->readVal<double>());
        m_bar->setAlarmEnabled(enable);
        m_alarmEnable->setChecked(m_bar->alarmEnabled());
        m_alarmLevel->setEnabled(m_bar->alarmEnabled());
    }

    // formula
    if(file->seekToNextBlock("barWFormula", BLOCK_WIDGET))
        m_eval.setFormula(file->readString());
}