コード例 #1
0
   void	DataManagerPropertyView::dataChanged( const QModelIndex & topLeft, const QModelIndex & /* bottomRight */)
   {
      if((topLeft.column() == 1)&&m_node.valid()&&propertyInterface())
      {
         QStandardItemModel* itemModel = (QStandardItemModel*)topLeft.model();
         DataManagerProperty* propertyItem = dynamic_cast<DataManagerProperty*>(itemModel->itemFromIndex(topLeft));
         if(propertyItem)
         {
            ossimRefPtr<ossimProperty> property = propertyItem->property();
            if(property.valid())
            {
               QVariant v = propertyItem->data(Qt::EditRole);
               if(v.isValid())
               {
                  property->setValue(v.toString().toAscii().data());
#if 0 /* warning C4065: switch statement contains 'default' but no 'case' labels (drb) */
                  switch(v.type())
                  {
                     default:
                     {
                        property->setValue(v.toString().toAscii().data());
                        break;
                     }
                  }
#endif
                  
                  DataManagerProperty* rootItem = propertyItem->rootProperty();
                  if(rootItem)
                  {
                     if(propertyInterface())
                     {
                        
                        propertyInterface()->setProperty(rootItem->property());
                     }
                  }
                  if(property->isCacheRefresh())
                  {
                     fireRefresh(ossimRefreshEvent::REFRESH_PIXELS);
                  }
                  else if(property->isFullRefresh())
                  {
                     fireRefresh(ossimRefreshEvent::REFRESH_GEOMETRY);
                  }
                  if(property->affectsOthers())
                  {
                     reloadProperties();
                  }
               }
            }
         }
      }
   }
コード例 #2
0
ファイル: mainwindow.cpp プロジェクト: dotblank/easylist
/**
 * Check the DBUS property to see if the keyboard is closed or opened.
 */
bool MainWindow::isKeyboardClosed()
{
    QDBusInterface propertyInterface("org.freedesktop.Hal",
                    DBUS_KEYBOARD_SLIDE,
                    "org.freedesktop.Hal.Device",
                    QDBusConnection::systemBus());
    bool result = propertyInterface.call("GetProperty", "button.state.value").arguments().at(0).toBool();
    qDebug() << "Keyboard is closed:" << result;
    return result;
}
コード例 #3
0
void CameraButtonListener::updateFocusButtonState()
{
    QDBusInterface propertyInterface("org.freedesktop.Hal",
                                     "/org/freedesktop/Hal/devices/platform_cam_focus",
                                     "org.freedesktop.Hal.Device",
                                     QDBusConnection::systemBus());

    bool pressed = propertyInterface.call("GetProperty", "button.state.value").arguments().at(0).toBool();

    if (m_focusPressed != pressed) {
        m_focusPressed = pressed;
        QWidget *window = QApplication::focusWidget();

        if (window) {
            QApplication::postEvent(window,
                                    new QKeyEvent(pressed ? QEvent::KeyPress : QEvent::KeyRelease,
                                                  0x01100021, //Qt::Key_CameraFocus since Qt 4.7.0
                                                  Qt::NoModifier));
        }
    }
}
コード例 #4
0
   void DataManagerPropertyView::populateChildren()
   {
      blockSignals(true);
      QList<QString> labels;
      labels.push_back("Name");
      labels.push_back("Value");
      m_model->clear();
      m_model->setHorizontalHeaderLabels(labels);
      if(m_node.valid())
      {
         ossimPropertyInterface* propInterface = propertyInterface();
         if(propInterface)
         {
            std::vector<ossimRefPtr<ossimProperty> > currentProperties;
            propInterface->getPropertyList(currentProperties);
            ossim_uint32 idx = 0;
            for(idx = 0; idx < currentProperties.size(); ++idx)
            {
               DataManagerProperty* nameItem = new DataManagerProperty(currentProperties[idx]->getName().c_str());
               DataManagerProperty* valueItem = new DataManagerProperty(currentProperties[idx]->valueToString().c_str(), currentProperties[idx]);
               QList<QStandardItem*> items;
               items.push_back(nameItem);
               items.push_back(valueItem);
               m_model->blockSignals(true);
               m_model->appendRow(items);
               nameItem->setProperty(currentProperties[idx].get());
               valueItem->setProperty(currentProperties[idx].get());
               nameItem->populateChildren();
               m_model->blockSignals(false);
            }
         }
      }
      resizeColumnToContents(0);

      blockSignals(false);
   }