Exemplo n.º 1
0
OptionsWindow::OptionsWindow( Vwr::CoreGraph* cg, QOSG::ViewerQT* viewer )
{
	//vytvorenie a inicializovanie celeho okna
	this->viewer = viewer;
	this->cg = cg;

	setModal( true );
	resize( 600,250 );

	changes = new QList<QString>();
	selectedItem = NULL;

	Util::ApplicationConfig* appConf = Util::ApplicationConfig::get();
	treeModel = new TreeModel( appConf->getList() );

	QTreeView* treeView = new QTreeView();
	treeView->setFocusPolicy( Qt::NoFocus );
	treeView->setModel( treeModel );
	treeView->setHeaderHidden( true );

	connect( treeView,SIGNAL( clicked( QModelIndex ) ),this,SLOT( itemClicked( QModelIndex ) ) );

	view = new QTreeView();
	view->setFocusPolicy( Qt::NoFocus );
	view->setVisible( false );

	QPushButton* closeButton = new QPushButton( tr( "Close" ) );
	closeButton->setFocusPolicy( Qt::NoFocus );
	connect( closeButton, SIGNAL( clicked() ), this, SLOT( close() ) );

	applyButton= new QPushButton( tr( "Apply" ) );
	applyButton->setFocusPolicy( Qt::NoFocus );
	applyButton->setEnabled( false );
	connect( applyButton, SIGNAL( clicked() ), this, SLOT( commitChanges() ) );

	QHBoxLayout* horizontalLayout = new QHBoxLayout;
	horizontalLayout->addWidget( treeView );
	horizontalLayout->addWidget( view );

	QHBoxLayout* buttonsLayout = new QHBoxLayout;
	buttonsLayout->addStretch( 1 );
	buttonsLayout->addWidget( applyButton );
	buttonsLayout->addWidget( closeButton );

	QVBoxLayout* mainLayout = new QVBoxLayout;
	mainLayout->addLayout( horizontalLayout );
	mainLayout->addStretch( 1 );
	mainLayout->addSpacing( 12 );
	mainLayout->addLayout( buttonsLayout );

	setLayout( mainLayout );

	setWindowTitle( tr( "Config Dialog" ) );
}