示例#1
0
    ExtenderObject * extender(bool take = true) {
        ExtenderObject * result = 0;

        if (!m_extenders.contains(q->scene()) ||
                !m_extenders[q->scene()]) {
            result = new ExtenderObject(extenderIconSvg, NULL);

            result->setVisible(false);
            result->setIconSize(QSize(16, 16));

            m_extenders[q->scene()] = result;
        } else {
            result = m_extenders[q->scene()];
        }

        if (result->parentItem() != q) {
            if (!take) {
                return NULL;
            }

            result->setParentItem(q);
            result->setGroupByName(
                    q->group()->name() + "-Extender"
                    );

            connectTimer();

            disconnect(result, SIGNAL(clicked()), 0, 0);
            connect(result, SIGNAL(clicked()),
                    q, SLOT(activate()));
            relayoutExtender();
        }

        return result;
    }
示例#2
0
文件: monitor.cpp 项目: speakman/qlc
void Monitor::init()
{
  QString config;

  //
  // Init the arrays that hold the values
  m_newValues = new t_value[m_units];
  m_oldValues = new t_value[m_units];

  for (t_channel i = 0; i < m_units; i++)
    {
      m_newValues[i] = m_oldValues[i] = 0;
    }

  //
  // Set font
  _app->settings()->get(KEY_MONITOR_FONT, config);
  
  if (config != QString::null)
    {
      m_font.fromString(config);
    }

  //
  // Set display style
  _app->settings()->get(KEY_MONITOR_DISPLAY_STYLE, config);
  s_displayStyle = config.toInt();
  if (s_displayStyle == 0)
    {
      s_displayStyle = ID_RELATIVE;
    }

  //
  // Set display update frequency
  _app->settings()->get(KEY_MONITOR_UPDATE_FREQUENCY, config);
  s_updateFrequency = config.toInt();
  if (s_updateFrequency > ID_64HZ)
    {
      s_updateFrequency = ID_64HZ;
    }
  else if (s_updateFrequency < ID_16HZ)
    {
      s_updateFrequency = ID_16HZ;
    }

  //
  // Try and resize the window to square shape
  slotResizeSquare();

  //
  // Background color
  setBackgroundColor(Qt::black);

  connectTimer();
}