[Paraview-developers] Camera Parallel Projection enable by default

Pandu tech pandu4tech at gmail.com
Mon Oct 1 07:23:03 EDT 2012


Hi,

Please let me know if you have any suggestions in this regard.

Thanks,
Pandu

On Thu, Sep 27, 2012 at 9:41 AM, Pandu tech <pandu4tech at gmail.com> wrote:

> Hi,
>
> In my application, I would like to set 3D render view "Use Parallel
> Projection" option to checked by default. I understood that
> "CameraParallelProjection" is the property associated with this.
>
> I tried to modify the settings.ini file created by pqSettings class. I
> tried the following in myMainWindow.cxx file:
>
> code:--
> //creating a new settings file if not exists
>   QString settingsRoot;
> #if defined(Q_OS_WIN)
>   settingsRoot = QString::fromLocal8Bit(getenv("APPDATA"));
> #else
>   settingsRoot = QString::fromLocal8Bit(getenv("HOME")) +
>                  QDir::separator() + QString::fromLocal8Bit(".config");
> #endif
>   QString settingsPath = QString("%2%1%3");
>   settingsPath = settingsPath.arg(QDir::separator());
>   settingsPath = settingsPath.arg(settingsRoot);
>   settingsPath = settingsPath.arg(QApplication::organizationName());
>
>   QString filename = settingsPath.append("/"
> +QApplication::applicationName() +
> QApplication::applicationVersion()+".ini");
>
>   QSettings *settings = 0;
>   QFile file;
>   if(!file.exists(filename))
>   {
>       settings = new QSettings(QSettings::IniFormat,QSettings::UserScope,
>                                           QApplication::organizationName(),
>                                           QApplication::applicationName()
> + QApplication::applicationVersion(), this);
>
>       settings->beginGroup("renderModule");
>       settings->setValue("CameraParallelProjection", 1); // setting value
> to 1
>       settings->endGroup();
>       settings->sync();
>   }
>
> Using this code, I am able to create .ini file with
> CameraParallelProjection value set to 1. But for the first time, when I run
> my application, UseParallelProjection is not checked.
>
> Whenever I switch b/w views or restart the application once again, because
> .ini file already present, then I can see UseParallelProjection option
> checked.
>
> How can I set UseParallelProjection option to be checked even in the first
> time? Please let me know if there is any better approach regarding this.
>
> Truly appreciate your help reg. this.
>
> Thanks,
> Pandu.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/paraview-developers/attachments/20121001/51cc1f47/attachment.htm>


More information about the Paraview-developers mailing list