示例#1
0
void ShaderComboBox::currentChanged(int index)
{
    if (itemData(index).isValid() && itemData(index) == QVariant((int)QVariant::UserType))
    {
            QString newShader = HordeFileDialog::getResourceFile( H3DResTypes::Shader, m_resourcePath, this, tr("Select shader to import"));
            if (!newShader.isEmpty())
            {
                    int index2 = findText(newShader);
                    if (index2 == -1)
                    {
                            blockSignals(true);
                            removeItem(index);
                            addItem(newShader);
                            addItem(tr("Import from Repository"), QVariant(QVariant::UserType));
                            blockSignals(false);
                            QHordeSceneEditorSettings settings;
                            setItemData( count() - 1, settings.value( "ImportEntryColor", QColor( 132, 255, 136 ) ), Qt::BackgroundColorRole );
                            index2 = findText(newShader);
                    }
                    setCurrentIndex(index2);
                    return;
            }
            else
                    setCurrentIndex(findText(m_init));
                    return;
    }
    if (m_init != currentText())
    {
            emit shaderChanged();
            emit editFinished();
    }
}
示例#2
0
Importer::Importer()
{
	QHordeSceneEditorSettings settings;
	settings.beginGroup("Repository");
	m_sourceResourcePath = settings.value("repositoryDir", QApplication::applicationDirPath()+QDir::separator()+"Repository").toString();
	settings.endGroup();

}