void PropertyModel::setObject(QObject * object)
{
    beginResetModel();
	m_object = object;
	refreshProperties();
	endResetModel();
}
/* The open action was clicked
*/
void QtSpacescapeMainWindow::onOpen()
{
    QString filename = QFileDialog::getOpenFileName(
         this,
         QLatin1String("Open Spacescape .xml file"), 
         mLastOpenDir,
         QLatin1String("XML Files (*.xml)")
    );

    // disable ogre window till done opening to prevent crashes
    ui->ogreWindow->setDisabled(true);

    if(!filename.isNull() && !filename.isEmpty()) {
        QFileInfo fi(filename);
        mLastOpenDir = fi.absolutePath();
        mLastSaveDir = mLastOpenDir;

        ui->statusBar->showMessage("Opening " + filename + " ...");

        // open the progress dialog
        ui->mProgressDialog->setValue(0);
        ui->mProgressDialog->show();

        if(ui->ogreWindow->open(filename)) {
            mFilename = filename;

            QString title = "Spacescape - " + fi.completeBaseName() + "." + fi.completeSuffix();
            setWindowTitle(QApplication::translate("MainWindow", title.toStdString().c_str(), 0, QApplication::UnicodeUTF8));

            // file opened successfully so clear property list and start over
            refreshProperties();

            ui->statusBar->showMessage("Opened " + filename,3000);
        }
        else {
            ui->statusBar->showMessage("Failed to load " + filename,3000);
        }
    }

    ui->ogreWindow->setDisabled(false);
}
void PropertyModel::setObject(QObject * object)
{
	m_object = object;
	refreshProperties();
	reset();
}
PropertyModel::PropertyModel(QObject* parent, QObject* object, QList<PropertyInterface*> * plugins): QAbstractItemModel(parent), m_object(object), m_plugins(plugins)
{
	refreshProperties();
}
Exemple #5
0
 /**
  * Implementation that updates result with the matching parts in source
  * Relies on the fact that getMember returns a C++ reference to each part of \a result, which is then updated
  * with a property found in source.
  */
 virtual bool composeTypeImpl(const PropertyBag& source,  typename internal::AssignableDataSource<T>::reference_t result) const {
     // The default implementation decomposes result and refreshes it with source.
     TypeInfoRepository::shared_ptr tir = Types();
     internal::ReferenceDataSource<T> rds(result);
     rds.ref(); // prevent dealloc.
     PropertyBag decomp;
     // only try refreshProperties if decomp's type is equal to source type.
     // update vs refresh: since it is intentional that the decomposition leads to references to parts of result,
     // only refreshProperties() is meaningful (ie we have a one-to-one mapping). In case of sequences, this would
     // of course not match, so this is struct specific.
     return typeDecomposition( &rds, decomp, false) && ( tir->type(decomp.getType()) == tir->type(source.getType()) ) && refreshProperties(decomp, source);
 }
/** The new file action was clicked
*/
void QtSpacescapeMainWindow::onNewFile()
{
    // TODO: prompt to save first
    ui->ogreWindow->clearLayers();
    refreshProperties();
}
 bool Property<PropertyBag>::refresh( const Property<PropertyBag>& orig)
 {
     if ( !ready() )
         return false;
     return refreshProperties( this->_value->set(), orig.rvalue() );
 }