void ShapeKeyMatrix::PropertyChanged( QtBrowserItem *item, QList<PropertyValue *> & ) const
{
    // if rows or columns change, update the key names editor
    QtProperty *prop = item->property();
    assert( prop != NULL );
    if ( prop != NULL && prop->propertyName().compare( "Rows", Qt::CaseInsensitive ) == 0 )
    {
        int nRows = ShapeProperty::m_intManager->value( prop );
        ShapeProperty::m_keyMatrixNameFactory->setRows( nRows );
    }
    else if ( prop != NULL && prop->propertyName().compare( "Columns", Qt::CaseInsensitive ) == 0 )
    {
        int nColumns = ShapeProperty::m_intManager->value( prop );
        ShapeProperty::m_keyMatrixNameFactory->setColumns( nColumns );
    }
}
void QtGroupBoxPropertyBrowserPrivate::updateItem(WidgetItem *item)
{
  QtProperty *property = m_itemToIndex[item]->property();
  if (item->groupBox)
  {
    QFont font = item->groupBox->font();
    font.setUnderline(property->isModified());
    item->groupBox->setFont(font);
    item->groupBox->setTitle(property->propertyName());
    item->groupBox->setToolTip(property->toolTip());
    item->groupBox->setStatusTip(property->statusTip());
    item->groupBox->setWhatsThis(property->whatsThis());
    item->groupBox->setEnabled(property->isEnabled());
  }
  if (item->label)
  {
    QFont font = item->label->font();
    font.setUnderline(property->isModified());
    item->label->setFont(font);
    item->label->setText(property->propertyName());
    item->label->setToolTip(property->toolTip());
    item->label->setStatusTip(property->statusTip());
    item->label->setWhatsThis(property->whatsThis());
    item->label->setEnabled(property->isEnabled());
  }
  if (item->widgetLabel)
  {
    QFont font = item->widgetLabel->font();
    font.setUnderline(false);
    item->widgetLabel->setFont(font);
    item->widgetLabel->setText(property->valueText());
    item->widgetLabel->setToolTip(property->valueText());
    item->widgetLabel->setEnabled(property->isEnabled());
  }
  if (item->widget)
  {
    QFont font = item->widget->font();
    font.setUnderline(false);
    item->widget->setFont(font);
    item->widget->setEnabled(property->isEnabled());
    item->widget->setToolTip(property->valueText());
  }
  // item->setIcon(1, property->valueIcon());
}
QtProperty *ObjectController::getProperty(QString propertyName)
{
    if (m_use_treeView)
    {
        QList<QtBrowserItem *> topLevelItems = d_ptr->m_browser->topLevelItems();
        QList<QtBrowserItem *>::iterator i;
        for (i = topLevelItems.begin(); i != topLevelItems.end(); ++i)
        {
            if ((*i))
            {
                QtProperty *rootprop = (*i)->property();
                QString rootName = rootprop->propertyName();
                //qDebug() << "Root PropertyName: " << rootName;
                if (propertyName.compare(rootName) == 0)
                {
                    return rootprop;
                }
                QList<QtBrowserItem *> children = (*i)->children();
                QList<QtBrowserItem *>::iterator j;
                for (j = children.begin(); j != children.end(); ++j)
                {
                    if ((*j))
                    {
                        QtProperty *prop = (*j)->property();
                        QString propName = prop->propertyName();
                        //qDebug() << "Child PropertyName: " << propName;
                        if (propertyName.compare(propName) == 0)
                        {
                            return prop;
                        }
                    }
                }
            }
        }
    }
    return nullptr;
}
Exemple #4
0
void IqtFit::fixItem() {
  QtBrowserItem *item = m_ffTree->currentItem();

  // Determine what the property is.
  QtProperty *prop = item->property();

  QtProperty *fixedProp = m_stringManager->addProperty(prop->propertyName());
  QtProperty *fprlbl = m_stringManager->addProperty("Fixed");
  fixedProp->addSubProperty(fprlbl);
  m_stringManager->setValue(fixedProp, prop->valueText());

  item->parent()->property()->addSubProperty(fixedProp);
  m_fixedProps[fixedProp] = prop;
  item->parent()->property()->removeSubProperty(prop);
}
Exemple #5
0
int PropertyEditor::applyPropertiesFilter(const QList<QtBrowserItem *> &items)
{
    int showCount = 0;
    const bool matchAll = m_filterPattern.isEmpty();
    QListIterator<QtBrowserItem *> itProperty(items);
    while (itProperty.hasNext()) {
        QtBrowserItem *propertyItem = itProperty.next();
        QtProperty *property = propertyItem->property();
        const QString propertyName = property->propertyName();
        const bool showProperty = matchAll || propertyName.contains(m_filterPattern, Qt::CaseInsensitive);
        setItemVisible(propertyItem, showProperty);
        if (showProperty)
            showCount++;
    }
    return showCount;
}
Exemple #6
0
void PropertyEditor::storePropertiesExpansionState(const QList<QtBrowserItem *> &items)
{
    const QChar bar = QLatin1Char('|');
    QListIterator<QtBrowserItem *> itProperty(items);
    while (itProperty.hasNext()) {
        QtBrowserItem *propertyItem = itProperty.next();
        if (!propertyItem->children().empty()) {
            QtProperty *property = propertyItem->property();
            const QString propertyName = property->propertyName();
            const QMap<QtProperty *, QString>::const_iterator itGroup = m_propertyToGroup.constFind(property);
            if (itGroup != m_propertyToGroup.constEnd()) {
                QString key = itGroup.value();
                key += bar;
                key += propertyName;
                m_expansionState[key] = isExpanded(propertyItem);
            }
        }
    }
}
Exemple #7
0
void PropertyEditor::applyPropertiesExpansionState(const QList<QtBrowserItem *> &items)
{
    const QChar bar = QLatin1Char('|');
    QListIterator<QtBrowserItem *> itProperty(items);
    while (itProperty.hasNext()) {
        const QMap<QString, bool>::const_iterator excend = m_expansionState.constEnd();
        QtBrowserItem *propertyItem = itProperty.next();
        QtProperty *property = propertyItem->property();
        const QString propertyName = property->propertyName();
        const QMap<QtProperty *, QString>::const_iterator itGroup = m_propertyToGroup.constFind(property);
        if (itGroup != m_propertyToGroup.constEnd()) {
            QString key = itGroup.value();
            key += bar;
            key += propertyName;
            const QMap<QString, bool>::const_iterator pit = m_expansionState.constFind(key);
            if (pit != excend)
                setExpanded(propertyItem, pit.value());
            else
                setExpanded(propertyItem, false);
        }
    }
}
Exemple #8
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow),
    copyView(NULL)
{
    ui->setupUi(this);

    //model.setFilter(QDir::AllDirs);
    model.setNameFilters( QStringList() << "*.xml");// << "*.lua"
    model.setNameFilterDisables(false);
    ui->fileTreeView->setModel(&model);
    ui->fileTreeView->setColumnHidden( 0, true);
    ui->fileTreeView->setColumnHidden( 1, true);
    ui->fileTreeView->setColumnHidden( 2, true);
    ui->fileTreeView->setColumnHidden( 3, true);
    connect(ui->fileTreeView, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(treeViewClicked(const QModelIndex &)));
    connect(ui->fileTreeView, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(treeViewContextMenu(QPoint)));

    loadIni();

    PropertyWidget *propertybrowser = PropertyWidget::getInstance();
    ui->dockWidget_2->setWidget(propertybrowser);
    connect( propertybrowser->variantManager, SIGNAL(valueChanged(QtProperty*,QVariant)), this, SLOT(propertyChanged(QtProperty*,QVariant)));
    connect( propertybrowser->variantManager, SIGNAL(attributeChanged(QtProperty *, const QString, const QVariant)), this, SLOT(attributeChanged(QtProperty *, const QString, const QVariant)));

    //控制台输出
    PrintfDockWidget *dockWidget = PrintfDockWidget::getInstance();
    addDockWidget(Qt::BottomDockWidgetArea, dockWidget);

    //初始化大纲
    QStringList header;
    header << "对象" << "类型";
    ui->treeWidget->setColumnCount(2);
    ui->treeWidget->setAlternatingRowColors(true);
    ui->treeWidget->setHeaderLabels(header);
    ui->treeWidget->setColumnWidth( 0, 200);
    connect( ui->treeWidget, SIGNAL(clicked(QModelIndex)), this, SLOT(clickedOutlineTreeItem(QModelIndex)));
    connect( ui->treeWidget, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(treeWidgetContextMenu(QPoint)));
    connect(ui->treeWidget, SIGNAL(itemChanged(QTreeWidgetItem*, int)), this, SLOT(treeItemChanged(QTreeWidgetItem*, int)));

    ui->listWidget->setIconSize(QSize(60,60));
    ui->listWidget->setDragEnabled(true);
    QSetIterator<QtProperty *> itr(propertybrowser->group->properties());
    QStringList list;
    while(itr.hasNext()){
        QtProperty *pro = itr.next();
        list << pro->propertyName();
    }
    list.sort();
    for( int i = 0; i < list.count(); i++){
        QString str = list.at(i);
        QListWidgetItem *item = new QListWidgetItem();
        ui->listWidget->addItem(item);

        ControlsPaintWidget *widget = new ControlsPaintWidget(ui->listWidget, "", str, "描述");
        ui->listWidget->setItemWidget(item, widget);
        item->setSizeHint (QSize(widget->rect().width(),widget->rect().height()));
    }

    setWindowState(Qt::WindowMaximized);

    ui->tabWidget->clear();
    connect( ui->tabWidget, SIGNAL(tabCloseRequested(int)), this, SLOT(tabCloseRequested(int)));
    connect( ui->tabWidget, SIGNAL(currentChanged(int)), this, SLOT(currentChanged(int)));

    ui->actionShowPrint->setChecked(true);
    ui->actionShowPrint->setCheckable(true);
    connect( ui->actionShowPrint, SIGNAL(triggered(bool)), this, SLOT(showPrint(bool)));

    ui->actionShowProperty->setChecked(true);
    ui->actionShowProperty->setCheckable(true);
    connect( ui->actionShowProperty, SIGNAL(triggered(bool)), this, SLOT(showProperty(bool)));

    ui->actionShowControls->setChecked(true);
    ui->actionShowControls->setCheckable(true);
    connect( ui->actionShowControls, SIGNAL(triggered(bool)), this, SLOT(showControls(bool)));

    setUnifiedTitleAndToolBarOnMac(true);
}