Ejemplo n.º 1
0
void SkinStyle::createMenuBarContainer(QWidget * widget, const QString & objectName) {
    QHBoxLayout * layout = new QHBoxLayout();
    layout->setMenuBar(widget);

    QWidget * container = new QWidget(widget->parentWidget());
    container->setObjectName(objectName);
    container->setLayout(layout);
}
Ejemplo n.º 2
0
GLObjectWindow::GLObjectWindow(QWidget *parent)
    : QWidget(parent)
{
    // Create a menu
    QMenu *file = new QMenu(this);
    file->addAction(tr("Exit"), qApp, &QApplication::quit);

    // Create a menu bar
    QMenuBar *m = new QMenuBar(this);
    m->addMenu(file)->setText(tr("&File"));

    // Create a nice frame to put around the OpenGL widget
    QFrame *f = new QFrame(this);
    f->setFrameStyle(QFrame::Sunken | QFrame::Panel);
    f->setLineWidth(2);

    // Create our OpenGL widget
    GLBox *c = new GLBox(f, "glbox");

    // Create the three sliders; one for each rotation axis
    QSlider *x = new QSlider(Qt::Vertical, this);
    x->setMaximum(360);
    x->setPageStep(60);
    x->setTickPosition(QSlider::TicksLeft);
    connect(x, &QSlider::valueChanged, c, &GLBox::setXRotation);

    QSlider *y = new QSlider(Qt::Vertical, this);
    y->setMaximum(360);
    y->setPageStep(60);
    y->setTickPosition(QSlider::TicksLeft);
    connect(y, &QSlider::valueChanged, c, &GLBox::setYRotation);

    QSlider *z = new QSlider(Qt::Vertical, this);
    z->setMaximum(360);
    z->setPageStep(60);
    z->setTickPosition(QSlider::TicksLeft);
    connect(z, &QSlider::valueChanged, c, &GLBox::setZRotation);

    // Now that we have all the widgets, put them into a nice layout

    // Top level layout, puts the sliders to the left of the frame/GL widget
    QHBoxLayout *hlayout = new QHBoxLayout(this);

    // Put the sliders on top of each other
    QVBoxLayout *vlayout = new QVBoxLayout();
    vlayout->addWidget(x);
    vlayout->addWidget(y);
    vlayout->addWidget(z);

    // Put the GL widget inside the frame
    QHBoxLayout *flayout = new QHBoxLayout(f);
    flayout->setMargin(0);
    flayout->addWidget(c, 1);

    hlayout->setMenuBar(m);
    hlayout->addLayout(vlayout);
    hlayout->addWidget(f, 1);
}
Ejemplo n.º 3
0
GLObjectWindow::GLObjectWindow( QWidget* parent, const char* name )
    : QWidget( parent, name )
{

    // Create nice frames to put around the OpenGL widgets
    QFrame* f1 = new QFrame( this, "frame1" );
    f1->setFrameStyle( QFrame::Sunken | QFrame::Panel );
    f1->setLineWidth( 2 );

    // Create an OpenGL widget
    GLTexobj* c = new GLTexobj( f1, "glbox1");

    // Create a menu
    QPopupMenu *file = new QPopupMenu( this );
    file->insertItem( "Toggle Animation", c, SLOT(toggleAnimation()),
                      CTRL+Key_A );
    file->insertSeparator();
    file->insertItem( "Exit",  qApp, SLOT(quit()), CTRL+Key_Q );

    // Create a menu bar
    QMenuBar *m = new QMenuBar( this );
    m->setSeparator( QMenuBar::InWindowsStyle );
    m->insertItem("&File", file );

    // Create the three sliders; one for each rotation axis
    QSlider* x = new QSlider ( 0, 360, 60, 0, QSlider::Vertical, this, "xsl" );
    x->setTickmarks( QSlider::Left );
    connect( x, SIGNAL(valueChanged(int)), c, SLOT(setXRotation(int)) );

    QSlider* y = new QSlider ( 0, 360, 60, 0, QSlider::Vertical, this, "ysl" );
    y->setTickmarks( QSlider::Left );
    connect( y, SIGNAL(valueChanged(int)), c, SLOT(setYRotation(int)) );

    QSlider* z = new QSlider ( 0, 360, 60, 0, QSlider::Vertical, this, "zsl" );
    z->setTickmarks( QSlider::Left );
    connect( z, SIGNAL(valueChanged(int)), c, SLOT(setZRotation(int)) );


    // Now that we have all the widgets, put them into a nice layout

    // Put the sliders on top of each other
    QVBoxLayout* vlayout = new QVBoxLayout( 20, "vlayout");
    vlayout->addWidget( x );
    vlayout->addWidget( y );
    vlayout->addWidget( z );

    // Put the GL widget inside the frame
    QHBoxLayout* flayout1 = new QHBoxLayout( f1, 2, 2, "flayout1");
    flayout1->addWidget( c, 1 );

    // Top level layout, puts the sliders to the left of the frame/GL widget
    QHBoxLayout* hlayout = new QHBoxLayout( this, 20, 20, "hlayout");
    hlayout->setMenuBar( m );
    hlayout->addLayout( vlayout );
    hlayout->addWidget( f1, 1 );

}
Ejemplo n.º 4
0
GLObjectWindow::GLObjectWindow( QWidget* parent, const char* name )
    : QWidget( parent, name )
{
    // Create a menu
    file = new QPopupMenu( this );
    file->setCheckable( TRUE );
    file->insertItem( "Grab Frame Buffer", this, SLOT(grabFrameBuffer()) );
    file->insertItem( "Render Pixmap", this, SLOT(makePixmap()) );
    file->insertItem( "Render Pixmap Hidden", this, SLOT(makePixmapHidden()) );
    file->insertSeparator();
    fixMenuItemId = file->insertItem( "Use Fixed Pixmap Size", this, 
				      SLOT(useFixedPixmapSize()) );
    file->insertSeparator();
    insertMenuItemId = file->insertItem( "Insert Pixmap Here", this, 
					 SLOT(makePixmapForMenu()) );
    file->insertSeparator();
    file->insertItem( "Exit",  qApp, SLOT(quit()), CTRL+Key_Q );

    // Create a menu bar
    QMenuBar *m = new QMenuBar( this );
    m->setSeparator( QMenuBar::InWindowsStyle );
    m->insertItem("&File", file );

    // Create nice frames to put around the OpenGL widgets
    QFrame* f1 = new QFrame( this, "frame1" );
    f1->setFrameStyle( QFrame::Sunken | QFrame::Panel );
    f1->setLineWidth( 2 );

    // Create an OpenGL widget
    c1 = new GLBox( f1, "glbox1");

    // Create a label that can display the pixmap
    lb = new QLabel( this, "pixlabel" );
    lb->setFrameStyle( QFrame::Sunken | QFrame::Panel );
    lb->setLineWidth( 2 );
    lb->setAlignment( AlignCenter );
    lb->setMargin( 0 );
    lb->setIndent( 0 );

    // Create the three sliders; one for each rotation axis
    QSlider* x = new QSlider ( 0, 360, 60, 0, QSlider::Vertical, this, "xsl" );
    x->setTickmarks( QSlider::Left );
    connect( x, SIGNAL(valueChanged(int)), c1, SLOT(setXRotation(int)) );

    QSlider* y = new QSlider ( 0, 360, 60, 0, QSlider::Vertical, this, "ysl" );
    y->setTickmarks( QSlider::Left );
    connect( y, SIGNAL(valueChanged(int)), c1, SLOT(setYRotation(int)) );

    QSlider* z = new QSlider ( 0, 360, 60, 0, QSlider::Vertical, this, "zsl" );
    z->setTickmarks( QSlider::Left );
    connect( z, SIGNAL(valueChanged(int)), c1, SLOT(setZRotation(int)) );


    // Now that we have all the widgets, put them into a nice layout

    // Put the sliders on top of each other
    QVBoxLayout* vlayout = new QVBoxLayout( 20, "vlayout");
    vlayout->addWidget( x );
    vlayout->addWidget( y );
    vlayout->addWidget( z );

    // Put the GL widget inside the frame
    QHBoxLayout* flayout1 = new QHBoxLayout( f1, 2, 2, "flayout1");
    flayout1->addWidget( c1, 1 );

    // Top level layout, puts the sliders to the left of the frame/GL widget
    QHBoxLayout* hlayout = new QHBoxLayout( this, 20, 20, "hlayout");
    hlayout->setMenuBar( m );
    hlayout->addLayout( vlayout );
    hlayout->addWidget( f1, 1 );
    hlayout->addWidget( lb, 1 );

}
Ejemplo n.º 5
0
Window::Window()
{
    glWidget = new GLWidget;

    lbl = new QLabel(tr("die"));

    QPushButton* btnDef = new QPushButton("Deformation");
    QPushButton* btnDef3 = new QPushButton("Deformation *3");
    QPushButton* btnDefComp1 = new QPushButton("Component #1");
    QPushButton* btnReset = new QPushButton("Reset");
    QPushButton* btnExtr = new QPushButton("Extract");
    QPushButton* btnHideTex = new QPushButton("Hide textures");
    QPushButton* btnUpdateNorm = new QPushButton("UpdateNorm");

    xSlider = createSliderZ();
    ySlider = createSliderXY();
    zSlider = createSliderXY();

    connect(xSlider, SIGNAL(valueChanged(int)), glWidget, SLOT(pickXsurf(int)));
    //connect(glWidget, SIGNAL(xRotationChanged(int)), xSlider, SLOT(setValue(int)));
    connect(ySlider, SIGNAL(valueChanged(int)), glWidget, SLOT(pickYsurf(int)));
    //connect(glWidget, SIGNAL(yRotationChanged(int)), ySlider, SLOT(setValue(int)));
    connect(zSlider, SIGNAL(valueChanged(int)), glWidget, SLOT(pickZsurf(int)));
   // connect(glWidget, SIGNAL(zRotationChanged(int)), zSlider, SLOT(setValue(int)));

    connect(btnDef, SIGNAL(clicked()), glWidget, SLOT(deformD()));
    connect(btnDef3, SIGNAL(clicked()), glWidget, SLOT(deform3()));
    connect(btnDefComp1, SIGNAL(clicked()), glWidget, SLOT(comp1()));
    connect(btnReset, SIGNAL(clicked()), glWidget, SLOT(reset()));
    connect(btnExtr, SIGNAL(clicked()), glWidget, SLOT(extract()));
    connect(btnHideTex, SIGNAL(clicked()), glWidget, SLOT(hideTex()));
    connect(btnUpdateNorm, SIGNAL(clicked()), glWidget, SLOT(updateNorm()));

    QHBoxLayout *mainLayout = new QHBoxLayout;
    mainLayout->addWidget(glWidget);
    mainLayout->addWidget(xSlider);
    mainLayout->addWidget(ySlider);
    mainLayout->addWidget(zSlider);
    mainLayout->addWidget(zSlider);

    createMenu();
    mainLayout->setMenuBar(menuBar);

    QVBoxLayout *cntrLayout = new QVBoxLayout;

    QGroupBox* verticalGroupBox = new QGroupBox(tr("Actions"));

    //cntrLayout->addWidget(btnDef);
    cntrLayout->addWidget(btnDef3);
    //cntrLayout->addWidget(btnDefComp1);
    cntrLayout->addWidget(btnReset);
    cntrLayout->addWidget(btnExtr);
    cntrLayout->addWidget(btnHideTex);
    cntrLayout->addWidget(btnHideTex);
    cntrLayout->addWidget(btnUpdateNorm);
    verticalGroupBox->setLayout(cntrLayout);

    mainLayout->addWidget(verticalGroupBox);

    setLayout(mainLayout);

    xSlider->setValue(15 * 16);
    ySlider->setValue(345 * 16);
    zSlider->setValue(0 * 16);
    setWindowTitle(tr("Brain Extraction Tools"));

}
Ejemplo n.º 6
0
 Window::Window()
 {
     glWidget = new GLWidget;

     QHBoxLayout *mainLayout = new QHBoxLayout;
     mainLayout->addWidget(glWidget);
	
	openAct = new QAction(tr("Abrir..."), this);
    openAct->setShortcut(tr("Ctrl+A"));
    openAct->setStatusTip(tr("Abrir Archivo"));
	connect(openAct, SIGNAL(triggered()), glWidget, SLOT(onVentanaAbrir()));
    connect(openAct, SIGNAL(triggered()), glWidget, SLOT(onAbrir()));


	closeAct = new QAction(tr("Cerrar..."), this);
    closeAct->setShortcut(tr("Ctrl+C"));
    closeAct->setStatusTip(tr("Cerrar Archivo"));
    connect(closeAct, SIGNAL(triggered()), this, SLOT(close()));

	escalAct = new QAction(tr("Escalar..."), this);
    escalAct->setShortcut(tr("Ctrl+E"));
    escalAct->setStatusTip(tr("Escalar objeto"));
    connect(escalAct, SIGNAL(triggered()), glWidget, SLOT(onEscalar()));

	trasAct = new QAction(tr("Trasladar..."), this);
    trasAct->setShortcut(tr("Ctrl+T"));
    trasAct->setStatusTip(tr("Trasladar objeto"));
    connect(trasAct, SIGNAL(triggered()), glWidget, SLOT(onTrasladar()));

	rotAct = new QAction(tr("Rotar..."), this);
    rotAct->setShortcut(tr("Ctrl+R"));
    rotAct->setStatusTip(tr("Rotar objeto"));
    connect(rotAct, SIGNAL(triggered()), glWidget, SLOT(onRotar()));

	zBufAct = new QAction(tr("On/Off Z-Buffer..."), this);
    zBufAct->setShortcut(tr("Ctrl+Z"));
    zBufAct->setStatusTip(tr("Habilitar/Deshabilitar ZBuffer"));
    connect(zBufAct, SIGNAL(triggered()), glWidget, SLOT(onZBuffer()));

	fogAct = new QAction(tr("On/Off Niebla..."), this);
    fogAct->setShortcut(tr("Ctrl+F"));
    fogAct->setStatusTip(tr("Habilitar/Deshabilitar Niebla"));
    connect(fogAct, SIGNAL(triggered()), glWidget, SLOT(onFog()));

	colFogAct = new QAction(tr("Color Niebla..."), this);
    colFogAct->setStatusTip(tr("Cambiar Color Niebla"));
    connect(colFogAct, SIGNAL(triggered()), glWidget, SLOT(onColorFog()));

	planoAct = new QAction(tr("On/Off Plano de Corte..."), this);
    planoAct->setShortcut(tr("Ctrl+P"));
    planoAct->setStatusTip(tr("Habilitar/Deshabilitar Plano de Corte"));
    connect(planoAct, SIGNAL(triggered()), glWidget, SLOT(onPlano()));

	meshAct = new QAction(tr("On/Off Mallado..."), this);
    meshAct->setShortcut(tr("Ctrl+M"));
    meshAct->setStatusTip(tr("Mostrar/Ocultar Mallado"));
    connect(meshAct, SIGNAL(triggered()), glWidget, SLOT(onMalla()));

	colMeshAct = new QAction(tr("Color Mallado..."), this);
    colMeshAct->setStatusTip(tr("Cambiar Color Mallado"));
    connect(colMeshAct, SIGNAL(triggered()), glWidget, SLOT(onColorMalla()));

	boxAct = new QAction(tr("On/Off Bounding Box..."), this);
    boxAct->setShortcut(tr("Ctrl+B"));
    boxAct->setStatusTip(tr("Mostrar/Ocultar Bounding Box"));
    connect(boxAct, SIGNAL(triggered()), glWidget, SLOT(onBox()));

	colBoxAct = new QAction(tr("Color Bounding Box..."), this);
    colBoxAct->setStatusTip(tr("Cambiar Color Bounding Box"));
    connect(colBoxAct, SIGNAL(triggered()), glWidget, SLOT(onColorBox()));

	fillAct = new QAction(tr("On/Off Relleno..."), this);
    fillAct->setShortcut(tr("Ctrl+R"));
    fillAct->setStatusTip(tr("Mostrar/Ocultar Relleno"));
    connect(fillAct, SIGNAL(triggered()), glWidget, SLOT(onRelleno()));

	colFillAct = new QAction(tr("Color Relleno..."), this);
    colFillAct->setStatusTip(tr("Cambiar Color Relleno"));
    connect(colFillAct, SIGNAL(triggered()), glWidget, SLOT(onColorRelleno()));

	edgeAct = new QAction(tr("On/Off Vertices..."), this);
    edgeAct->setShortcut(tr("Ctrl+V"));
    edgeAct->setStatusTip(tr("Mostrar/Ocultar Vertices"));
    connect(edgeAct, SIGNAL(triggered()), glWidget, SLOT(onVertices()));

	colEdgeAct = new QAction(tr("Color Vertices..."), this);
    colEdgeAct->setStatusTip(tr("Cambiar Color Vertices"));
    connect(colEdgeAct, SIGNAL(triggered()), glWidget, SLOT(onColorVertices()));

	fileMenu = new QMenu;
	QMenuBar *m = new QMenuBar;
	fileMenu = m->addMenu(tr("&Archivo"));
	fileMenu->addAction(openAct);
	fileMenu->addAction(closeAct);

	editMenu = new QMenu;
	editMenu = m->addMenu(tr("&Editar"));
	editMenu->addAction(escalAct);
	editMenu->addAction(rotAct);
	editMenu->addAction(trasAct);
	editMenu->addAction(colFogAct);
	editMenu->addAction(colMeshAct);
	editMenu->addAction(colBoxAct);
	editMenu->addAction(colFillAct);
	editMenu->addAction(colEdgeAct);

	toolMenu = new QMenu;
	toolMenu = m->addMenu(tr("&Herramientas"));
	toolMenu->addAction(zBufAct);
	toolMenu->addAction(fogAct);
	toolMenu->addAction(planoAct);
	toolMenu->addAction(meshAct);
	toolMenu->addAction(boxAct);
	toolMenu->addAction(fillAct);
	toolMenu->addAction(edgeAct);

    setLayout(mainLayout);
    setWindowTitle(tr("3D SCAN"));
	mainLayout->setMenuBar(m);

 }
Ejemplo n.º 7
0
GLObjectWindow::GLObjectWindow( QWidget* parent, const char* name )
    : QWidget( parent, name )
{
    // Create a menu
    QPopupMenu *file = new QPopupMenu( this );
    file->insertItem( "Delete Left QGLWidget", this, 
		      SLOT(deleteFirstWidget()) );
    file->insertItem( "Exit",  qApp, SLOT(quit()), CTRL+Key_Q );

    // Create a menu bar
    QMenuBar *m = new QMenuBar( this );
    m->setSeparator( QMenuBar::InWindowsStyle );
    m->insertItem("&File", file );

    // Create nice frames to put around the OpenGL widgets
    QFrame* f1 = new QFrame( this, "frame1" );
    f1->setFrameStyle( QFrame::Sunken | QFrame::Panel );
    f1->setLineWidth( 2 );
    QFrame* f2 = new QFrame( this, "frame2" );
    f2->setFrameStyle( QFrame::Sunken | QFrame::Panel );
    f2->setLineWidth( 2 );

    // Create an OpenGL widget
    c1 = new GLBox( f1, "glbox1" );
    
    // Create another OpenGL widget that shares display lists with the first
    c2 = new GLBox( f2, "glbox2", c1 );

    // Create the three sliders; one for each rotation axis
    // Make them spin the boxes, but not in synch
    QSlider* x = new QSlider ( 0, 360, 60, 0, QSlider::Vertical, this, "xsl" );
    x->setTickmarks( QSlider::Left );
    connect( x, SIGNAL(valueChanged(int)), c1, SLOT(setXRotation(int)) );
    connect( x, SIGNAL(valueChanged(int)), c2, SLOT(setZRotation(int)) );

    QSlider* y = new QSlider ( 0, 360, 60, 0, QSlider::Vertical, this, "ysl" );
    y->setTickmarks( QSlider::Left );
    connect( y, SIGNAL(valueChanged(int)), c1, SLOT(setYRotation(int)) );
    connect( y, SIGNAL(valueChanged(int)), c2, SLOT(setXRotation(int)) );

    QSlider* z = new QSlider ( 0, 360, 60, 0, QSlider::Vertical, this, "zsl" );
    z->setTickmarks( QSlider::Left );
    connect( z, SIGNAL(valueChanged(int)), c1, SLOT(setZRotation(int)) );
    connect( z, SIGNAL(valueChanged(int)), c2, SLOT(setYRotation(int)) );


    // Now that we have all the widgets, put them into a nice layout

    // Put the sliders on top of each other
    QVBoxLayout* vlayout = new QVBoxLayout( 20, "vlayout");
    vlayout->addWidget( x );
    vlayout->addWidget( y );
    vlayout->addWidget( z );

    // Put the GL widgets inside the frames
    QHBoxLayout* flayout1 = new QHBoxLayout( f1, 2, 2, "flayout1");
    flayout1->addWidget( c1, 1 );
    QHBoxLayout* flayout2 = new QHBoxLayout( f2, 2, 2, "flayout2");
    flayout2->addWidget( c2, 1 );

    // Top level layout, puts the sliders to the left of the frame/GL widget
    QHBoxLayout* hlayout = new QHBoxLayout( this, 20, 20, "hlayout");
    hlayout->setMenuBar( m );
    hlayout->addLayout( vlayout );
    hlayout->addWidget( f1, 1 );
    hlayout->addWidget( f2, 1 );

}
Ejemplo n.º 8
0
GLObjectWindow::GLObjectWindow( QWidget* parent, const char* name )
    : QWidget( parent, name )
{
    // Create top-level layout manager
    QHBoxLayout* hlayout = new QHBoxLayout( this, 20, 20, "hlayout");

    // Create a menu
    QPopupMenu *file = new QPopupMenu();
    file->insertItem( "Delete Left QGLWidget", this, 
		      SLOT(deleteFirstWidget()) );
    file->insertItem( "Exit",  qApp, SLOT(quit()), CTRL+Key_Q );

    // Create a menu bar
    QMenuBar *m = new QMenuBar( this );
    m->setSeparator( QMenuBar::InWindowsStyle );
    m->insertItem("&File", file );
    hlayout->setMenuBar( m );

    // Create a layout manager for the sliders
    QVBoxLayout* vlayout = new QVBoxLayout( 20, "vlayout");
    hlayout->addLayout( vlayout );

    // Create a nice frame to put around the openGL widget
    QFrame* f = new QFrame( this, "frame" );
    f->setFrameStyle( QFrame::Sunken | QFrame::Panel );
    f->setLineWidth( 2 );
    hlayout->addWidget( f, 1 );

    // Create a layout manager for the openGL widget
    QHBoxLayout* flayout = new QHBoxLayout( f, 2, 2, "flayout");


    // Create an openGL widget
    c1 = new GLBox( f, "glbox1");
    c1->setMinimumSize( 50, 50 );
    flayout->addWidget( c1, 1 );
    flayout->activate();


    // Create a nice frame to put around the second openGL widget
    QFrame* f2 = new QFrame( this, "frame2" );
    f2->setFrameStyle( QFrame::Sunken | QFrame::Panel );
    f2->setLineWidth( 2 );
    hlayout->addWidget( f2, 1 );

    // Create a layout manager for the second openGL widget
    QHBoxLayout* flayout2 = new QHBoxLayout( f2, 2, 2, "flayout2");

    // Create another openGL widget which shares display lists with the first
    c2 = new GLBox( f2, "glbox2", c1 );
    c2->setMinimumSize( 50, 50 );
    flayout2->addWidget( c2, 1 );
    flayout2->activate();

    // Create the three sliders; one for each rotation axis
    QSlider* x = new QSlider ( 0, 360, 60, 0, QSlider::Vertical, this, "xsl" );
    x->setTickmarks( QSlider::Left );
    x->setMinimumSize( x->sizeHint() );
    vlayout->addWidget( x );
    QObject::connect( x, SIGNAL(valueChanged(int)),c1,SLOT(setXRotation(int)));
    QObject::connect( x, SIGNAL(valueChanged(int)),c2,SLOT(setZRotation(int)));

    QSlider* y = new QSlider ( 0, 360, 60, 0, QSlider::Vertical, this, "ysl" );
    y->setTickmarks( QSlider::Left );
    y->setMinimumSize( y->sizeHint() );
    vlayout->addWidget( y );
    QObject::connect( y, SIGNAL(valueChanged(int)),c1,SLOT(setYRotation(int)));
    QObject::connect( y, SIGNAL(valueChanged(int)),c2,SLOT(setXRotation(int)));

    QSlider* z = new QSlider ( 0, 360, 60, 0, QSlider::Vertical, this, "zsl" );
    z->setTickmarks( QSlider::Left );
    z->setMinimumSize( z->sizeHint() );
    vlayout->addWidget( z );
    QObject::connect( z, SIGNAL(valueChanged(int)),c1,SLOT(setZRotation(int)));
    QObject::connect( z, SIGNAL(valueChanged(int)),c2,SLOT(setYRotation(int)));

    // Start the geometry management
    hlayout->activate();
}
Ejemplo n.º 9
0
TxqPlot3DWindow::TxqPlot3DWindow( char *thisLabel, WindowType myWindow )
    : QWidget( )
{

    // set thisWindow so that all class members may access
    thisWindow = myWindow;

    // Set the title
    setPalette( QPalette( Qt::lightGray ) );
    setCaption(thisLabel);
    setIconText(thisLabel);

    // Create top-level layout manager
    QHBoxLayout* hlayout = new QHBoxLayout( this, 20, 20, "hlayout");

    // Create a popup menu containing Close
    QPopupMenu *file = new QPopupMenu();
    file->setPalette( QPalette( Qt::lightGray ) );
    file->insertItem( "Close",  this, SLOT( close() ), CTRL+Key_Q );

    // Create a menu bar
    QMenuBar *m = new QMenuBar( this );
    m->setSeparator( QMenuBar::InWindowsStyle );
    m->insertItem("&File", file );
    hlayout->setMenuBar( m );

    // Create a layout manager for the sliders
    QVBoxLayout* vlayout = new QVBoxLayout( 20, "vlayout");
    hlayout->addLayout( vlayout );

    // Create a nice frame tp put around the openGL widget
    QFrame* f = new QFrame( this, "frame" );
    f->setFrameStyle( QFrame::Sunken | QFrame::Panel );
    f->setLineWidth( 2 );
    hlayout->addWidget( f, 1 );

    // Create a layout manager for the openGL widget
    QHBoxLayout* flayout = new QHBoxLayout( f, 2, 2, "flayout");

    // Create an openGL widget
    plot3D = new GLPlot3D( f, "glbox");
    plot3D->setData(thisLabel, myWindow);
    plot3D->setMinimumSize( 50, 50 );
    flayout->addWidget( plot3D, 1 );
    flayout->activate();

    // Create the three sliders; one for each rotation axis
    QSlider* x = new QSlider ( 0, 360, 60, 0, QSlider::Vertical, this, "xsl" );
    x->setTickmarks( QSlider::Left );
    x->setMinimumSize( x->sizeHint() );
    vlayout->addWidget( x );
    QObject::connect( x, SIGNAL(valueChanged(int)),plot3D,SLOT(setXRotation(int)) );

    QSlider* y = new QSlider ( 0, 360, 60, 0, QSlider::Vertical, this, "ysl" );
    y->setTickmarks( QSlider::Left );
    y->setMinimumSize( y->sizeHint() );
    vlayout->addWidget( y );
    QObject::connect( y, SIGNAL(valueChanged(int)),plot3D,SLOT(setYRotation(int)) );

    QSlider* z = new QSlider ( 0, 360, 60, 0, QSlider::Vertical, this, "zsl" );
    z->setTickmarks( QSlider::Left );
    z->setMinimumSize( z->sizeHint() );
    vlayout->addWidget( z );
    QObject::connect( z, SIGNAL(valueChanged(int)),plot3D,SLOT(setZRotation(int)) );

    // create the slider for the eye translation
    QSlider* t = new QSlider ( -15, -5, 1, -15, QSlider::Vertical, this, "tsl" );
    t->setTickmarks( QSlider::Left );
    t->setMinimumSize( x->sizeHint() );
    vlayout->addWidget( t );
    QObject::connect( t, SIGNAL(valueChanged(int)),plot3D,SLOT(setTranslation(int)) );

    // Start the geometry management
    hlayout->activate();
}
Ejemplo n.º 10
0
//----------------------------------------------------------------------------------
// our main form for Brick-by-Brick
//----------------------------------------------------------------------------------
BBB_Form::BBB_Form( QWidget *parent, const char *name ) : QWidget( parent, name )
{
	// set our forms size and name
	setName("AutoMason");
	// setMinimumSize( 1024,768 );
	setMinimumSize( 1024,600 );
	
	setCaption("AutoMason v 2.0");

	//--------------------------------------------------------------------------------
	// Main Palette Creation
	//--------------------------------------------------------------------------------
	QPalette pal;
	QColorGroup cg;
	cg.setColor( QColorGroup::Foreground, black );
	cg.setColor( QColorGroup::Button, QColor( 158, 158, 158) );
	cg.setColor( QColorGroup::Light, QColor( 237, 237, 237) );
	cg.setColor( QColorGroup::Midlight, QColor( 197, 197, 197) );
	cg.setColor( QColorGroup::Dark, QColor( 79, 79, 79) );
	cg.setColor( QColorGroup::Mid, QColor( 105, 105, 105) );
	cg.setColor( QColorGroup::Text, black );
	cg.setColor( QColorGroup::BrightText, white );
	cg.setColor( QColorGroup::ButtonText, black );
	cg.setColor( QColorGroup::Base, white );
	cg.setColor( QColorGroup::Background, QColor( 197, 197, 197) );
	cg.setColor( QColorGroup::Shadow, black );
	cg.setColor( QColorGroup::Highlight, QColor( 0, 0, 128) );
	cg.setColor( QColorGroup::HighlightedText, white );
	cg.setColor( QColorGroup::Link, black );
	cg.setColor( QColorGroup::LinkVisited, black );
	pal.setActive( cg );
	cg.setColor( QColorGroup::Foreground, black );
	cg.setColor( QColorGroup::Button, QColor( 158, 158, 158) );
	cg.setColor( QColorGroup::Light, QColor( 237, 237, 237) );
	cg.setColor( QColorGroup::Midlight, QColor( 181, 181, 181) );
	cg.setColor( QColorGroup::Dark, QColor( 79, 79, 79) );
	cg.setColor( QColorGroup::Mid, QColor( 105, 105, 105) );
	cg.setColor( QColorGroup::Text, black );
	cg.setColor( QColorGroup::BrightText, white );
	cg.setColor( QColorGroup::ButtonText, black );
	cg.setColor( QColorGroup::Base, white );
	cg.setColor( QColorGroup::Background, QColor( 197, 197, 197) );
	cg.setColor( QColorGroup::Shadow, black );
	cg.setColor( QColorGroup::Highlight, QColor( 0, 0, 128) );
	cg.setColor( QColorGroup::HighlightedText, white );
	cg.setColor( QColorGroup::Link, black );
	cg.setColor( QColorGroup::LinkVisited, black );
	pal.setInactive( cg );
	cg.setColor( QColorGroup::Foreground, QColor( 128, 128, 128) );
	cg.setColor( QColorGroup::Button, QColor( 158, 158, 158) );
	cg.setColor( QColorGroup::Light, QColor( 237, 237, 237) );
	cg.setColor( QColorGroup::Midlight, QColor( 181, 181, 181) );
	cg.setColor( QColorGroup::Dark, QColor( 79, 79, 79) );
	cg.setColor( QColorGroup::Mid, QColor( 105, 105, 105) );
	cg.setColor( QColorGroup::Text, QColor( 128, 128, 128) );
	cg.setColor( QColorGroup::BrightText, white );
	cg.setColor( QColorGroup::ButtonText, QColor( 128, 128, 128) );
	cg.setColor( QColorGroup::Base, white );
	cg.setColor( QColorGroup::Background, QColor( 197, 197, 197) );
	cg.setColor( QColorGroup::Shadow, black );
	cg.setColor( QColorGroup::Highlight, QColor( 0, 0, 128) );
	cg.setColor( QColorGroup::HighlightedText, white );
	cg.setColor( QColorGroup::Link, white );
	cg.setColor( QColorGroup::LinkVisited, white );
	pal.setDisabled( cg );
	setPalette( pal );

	//--------------------------------------------------------------------------------
	// UI - Toolbox Container Setup
	//--------------------------------------------------------------------------------
	tb_MainUI = new QToolBox( this, "tb_MainUI" );
	tb_MainUI->setGeometry( QRect( 855, 10, 165, 750 ) );
	tb_MainUI->setFrameShape( QToolBox::NoFrame );
	tb_MainUI->setFrameShadow( QToolBox::Plain );
	tb_MainUI->setCurrentIndex( 0 );

	pg_BrickCreation = new QWidget( tb_MainUI, "pg_BrickCreation" );
    pg_BrickCreation->setBackgroundMode( QWidget::PaletteBackground );

	pg_StartCondition = new QWidget( tb_MainUI, "pg_StartCondition" );
    pg_StartCondition->setBackgroundMode( QWidget::PaletteBackground );

	pg_Rules = new QWidget( tb_MainUI, "pg_Rules" );
    pg_Rules->setBackgroundMode( QWidget::PaletteBackground );
	pg_Rules->setFocusPolicy(QWidget::StrongFocus);

	pg_BeamCreation = new QWidget( tb_MainUI, "pg_BeamCreation" );
    pg_BeamCreation->setBackgroundMode( QWidget::PaletteBackground );

	tb_MainUI->addItem( pg_BrickCreation, QString::fromLatin1("Brick Creation") );
	tb_MainUI->addItem( pg_StartCondition, QString::fromLatin1("Start Conditions") );
	tb_MainUI->addItem( pg_Rules, QString::fromLatin1("Pattern Generation") );
	tb_MainUI->addItem( pg_BeamCreation, QString::fromLatin1("Beam Generation") );

	//--------------------------------------------------------------------------------
	// UI - Brick Generation
	//--------------------------------------------------------------------------------
	grp_BrickCreation = new QGroupBox( pg_BrickCreation, "grp_BrickCreation" );
	grp_BrickCreation->setGeometry( QRect( 0, 0, 165, 165) ); // , 140) );
	
	// brick size
	lbl_BrickSize = new QLabel( grp_BrickCreation, "lbl_BrickSize" );
	lbl_BrickSize->setGeometry( QRect( 5, 7, 50, 14 ) );
	lbl_BrickSize->setText("Brick Size:");
	
	lbl_BrickSize_Length = new QLabel( grp_BrickCreation, "lbl_BrickSize_Length" );
	lbl_BrickSize_Length->setGeometry( QRect( 5, 23, 30, 20 ) );
	lbl_BrickSize_Length->setText("width:");
	
	edit_BrickSize_Length = new QLineEdit( grp_BrickCreation, "edit_BrickSize_Length" );
	edit_BrickSize_Length->setGeometry( QRect( 35, 22, 40, 20 ) );
	edit_BrickSize_Length->setText("8");
	
	lbl_BrickSize_Width = new QLabel( grp_BrickCreation, "lbl_BrickSize_Width" );
	lbl_BrickSize_Width->setGeometry( QRect( 80, 22, 33, 20 ) );
	lbl_BrickSize_Width->setText("height:");
	
	edit_BrickSize_Width = new QLineEdit( grp_BrickCreation, "edit_BrickSize_Width" );
	edit_BrickSize_Width->setGeometry( QRect( 115, 22, 40, 20 ) );
	edit_BrickSize_Width->setText("4");
	
	// number of bricks
	lbl_NumBricks = new QLabel( grp_BrickCreation, "lbl_NumBricks" );
	lbl_NumBricks->setGeometry( QRect( 5, 53, 85, 20 ) );
	lbl_NumBricks->setText("Number of Bricks:");
	
	lbl_NumBricks_Rows = new QLabel( grp_BrickCreation, "lbl_NumBricks_Rows" );
	lbl_NumBricks_Rows->setGeometry( QRect( 5, 72, 26, 20 ) );
	lbl_NumBricks_Rows->setText("rows:");
	
	edit_NumBricks_Row = new QLineEdit( grp_BrickCreation, "edit_NumBricks_Row" );
	edit_NumBricks_Row->setGeometry( QRect( 35, 72, 40, 20 ) );
	edit_NumBricks_Row->setText("20");

	// CHIPP - Begin cantilevered height edit
	// cantilevered height
	lbl_Cantilevered_Height = new QLabel( grp_BrickCreation, "lbl_Cantilevered_Height" );
	lbl_Cantilevered_Height->setGeometry( QRect( 5, 91, 100, 20 ) );
	lbl_Cantilevered_Height->setText("cantilevered height:");
	lbl_Cantilevered_Height->hide();

	edit_Cantilevered_Height = new QLineEdit( grp_BrickCreation, "edit_Cantilevered_Height" );
	edit_Cantilevered_Height->setGeometry( QRect( 104, 91, 40, 20 ) );
	edit_Cantilevered_Height->setText("12");
	edit_Cantilevered_Height->hide();
	// CHIPP - End cantilevered height edit

	// CHIPP - Swap cantilevered height with Padding Rows
	// padding height
	lbl_Padding_Rows = new QLabel( grp_BrickCreation, "lbl_Padding_Rows" );
	lbl_Padding_Rows->setGeometry( QRect( 5, 91, 100, 20 ) );
	lbl_Padding_Rows->setText("padding rows:");
	
	edit_Padding_Rows = new QLineEdit( grp_BrickCreation, "edit_Padding_Rows" );
	edit_Padding_Rows->setGeometry( QRect( 74, 91, 40, 20 ) ); 
	edit_Padding_Rows->setText("1");
	// CHIPP - Swap cantilevered height with Padding Rows
	
	// layout toggle
	btn_BrickOffset = new QPushButton( grp_BrickCreation, "btn_BrickOffset" );
	// btn_BrickOffset->setGeometry( QRect( 10, 102, 140, 25 ));
	btn_BrickOffset->setGeometry( QRect( 10, 121, 140, 25 )); // CHIPP - bumped down brick offset button
	btn_BrickOffset->setText("Offset Bricks");
	btn_BrickOffset->setToggleButton(true);
	btn_BrickOffset->setPalette( pal );

	//--------------------------------------------------------------------------------
	// UI - Start Conditions
	//--------------------------------------------------------------------------------
	btn_ActivateBricks = new QPushButton( pg_StartCondition, "btn_ActivateBricks" );
	btn_ActivateBricks->setGeometry( QRect( 10, 10, 140, 25 ));
	btn_ActivateBricks->setText("Activate Bricks");
	btn_ActivateBricks->setToggleButton(true);
	btn_ActivateBricks->setPalette( pal );
	btn_ActivateBricks->setFocusProxy(pg_StartCondition);
	
	btn_ClearActiveBricks = new QPushButton( pg_StartCondition, "btn_ClearActiveBricks" );
	btn_ClearActiveBricks->setGeometry( QRect( 10, 40, 140, 25 ) );
	btn_ClearActiveBricks->setText("Clear Start Condition");
	btn_ClearActiveBricks->setPalette( pal );
	btn_ClearActiveBricks->setFocusProxy(pg_StartCondition);

	btn_RandomActiveBricks = new QPushButton( pg_StartCondition, "btn_RandomActiveBricks" );
	btn_RandomActiveBricks->setGeometry( QRect( 10, 70, 140, 25 ) );
	btn_RandomActiveBricks->setText("Random Start Condition");
	btn_RandomActiveBricks->setPalette( pal );
	btn_RandomActiveBricks->setFocusProxy(pg_StartCondition);

	//--------------------------------------------------------------------------------
	// UI - Rules
	//--------------------------------------------------------------------------------
	btn_Rule_00000 = new QPushButton( pg_Rules, "btn_Rule_00000" );
	btn_Rule_00000->setGeometry( QRect( 10, 9, 70, 20 ) );
	btn_Rule_00000->setPixmap( QPixmap::fromMimeSource( "data\\rule_00000.bmp" ) );
	btn_Rule_00000->setToggleButton(true);
	btn_Rule_00000->setPalette( pal );
	btn_Rule_00000->setFocusProxy(pg_Rules);
	
	btn_Rule_10000 = new QPushButton( pg_Rules, "btn_Rule_10000" );
	btn_Rule_10000->setGeometry( QRect( 10, 29, 70, 20 ) );
	btn_Rule_10000->setPixmap( QPixmap::fromMimeSource( "data\\rule_10000.bmp" ) );
	btn_Rule_10000->setToggleButton(true);
	btn_Rule_10000->setPalette( pal );
	btn_Rule_10000->setFocusProxy(pg_Rules);

	btn_Rule_01000 = new QPushButton( pg_Rules, "btn_Rule_01000" );
	btn_Rule_01000->setGeometry( QRect( 10, 50, 70, 20 ) );
	btn_Rule_01000->setPixmap( QPixmap::fromMimeSource( "data\\rule_01000.bmp" ) );
	btn_Rule_01000->setToggleButton(true);
	btn_Rule_01000->setPalette( pal );
	btn_Rule_01000->setFocusProxy(pg_Rules);

	btn_Rule_00100 = new QPushButton( pg_Rules, "btn_Rule_00100" );
	btn_Rule_00100->setGeometry( QRect( 10, 70, 70, 20 ) );
	btn_Rule_00100->setPixmap( QPixmap::fromMimeSource( "data\\rule_00100.bmp" ) );
	btn_Rule_00100->setToggleButton(true);
	btn_Rule_00100->setPalette( pal );
	btn_Rule_00100->setFocusProxy(pg_Rules);

	btn_Rule_00010 = new QPushButton( pg_Rules, "btn_Rule_00010" );
	btn_Rule_00010->setGeometry( QRect( 10, 90, 70, 20 ) );
	btn_Rule_00010->setPixmap( QPixmap::fromMimeSource( "data\\rule_00010.bmp" ) );
	btn_Rule_00010->setToggleButton(true);
	btn_Rule_00010->setPalette( pal );
	btn_Rule_00010->setFocusProxy(pg_Rules);

	btn_Rule_00001 = new QPushButton( pg_Rules, "btn_Rule_00001" );
	btn_Rule_00001->setGeometry( QRect( 10, 110, 70, 20 ) );
	btn_Rule_00001->setPixmap( QPixmap::fromMimeSource( "data\\rule_00001.bmp" ) );
	btn_Rule_00001->setToggleButton(true);
	btn_Rule_00001->setPalette( pal );
	btn_Rule_00001->setFocusProxy(pg_Rules);
	
	btn_Rule_11000 = new QPushButton( pg_Rules, "btn_Rule_11000" );
	btn_Rule_11000->setGeometry( QRect( 10, 130, 70, 20 ) );
	btn_Rule_11000->setPixmap( QPixmap::fromMimeSource( "data\\rule_11000.bmp" ) );
	btn_Rule_11000->setToggleButton(true);
	btn_Rule_11000->setPalette( pal );
	btn_Rule_11000->setFocusProxy(pg_Rules);
	
	btn_Rule_10100 = new QPushButton( pg_Rules, "btn_Rule_10100" );
	btn_Rule_10100->setGeometry( QRect( 10, 150, 70, 20 ) );
	btn_Rule_10100->setPixmap( QPixmap::fromMimeSource( "data\\rule_10100.bmp" ) );
	btn_Rule_10100->setToggleButton(true);
	btn_Rule_10100->setPalette( pal );
	btn_Rule_10100->setFocusProxy(pg_Rules);
	
	btn_Rule_10010 = new QPushButton( pg_Rules, "btn_Rule_10010" );
	btn_Rule_10010->setGeometry( QRect( 10, 170, 70, 20 ) );
	btn_Rule_10010->setPixmap( QPixmap::fromMimeSource( "data\\rule_10010.bmp" ) );
	btn_Rule_10010->setToggleButton(true);
	btn_Rule_10010->setPalette( pal );
	btn_Rule_10010->setFocusProxy(pg_Rules);
	
	btn_Rule_10001 = new QPushButton( pg_Rules, "btn_Rule_10001" );
	btn_Rule_10001->setGeometry( QRect( 10, 190, 70, 20 ) );
	btn_Rule_10001->setPixmap( QPixmap::fromMimeSource( "data\\rule_10001.bmp" ) );
	btn_Rule_10001->setToggleButton(true);
	btn_Rule_10001->setPalette( pal );
	btn_Rule_10001->setFocusProxy(pg_Rules);
	
	btn_Rule_01100 = new QPushButton( pg_Rules, "btn_Rule_01100" );
	btn_Rule_01100->setGeometry( QRect( 10, 210, 70, 20 ) );
	btn_Rule_01100->setPixmap( QPixmap::fromMimeSource( "data\\rule_01100.bmp" ) );
	btn_Rule_01100->setToggleButton(true);
	btn_Rule_01100->setPalette( pal );
	btn_Rule_01100->setFocusProxy(pg_Rules);
	
	btn_Rule_01010 = new QPushButton( pg_Rules, "btn_Rule_01010" );
	btn_Rule_01010->setGeometry( QRect( 10, 230, 70, 20 ) );
	btn_Rule_01010->setPixmap( QPixmap::fromMimeSource( "data\\rule_01010.bmp" ) );
	btn_Rule_01010->setToggleButton(true);
	btn_Rule_01010->setPalette( pal );
	btn_Rule_01010->setFocusProxy(pg_Rules);
	
	btn_Rule_01001 = new QPushButton( pg_Rules, "btn_Rule_01001" );
	btn_Rule_01001->setGeometry( QRect( 10, 250, 70, 20 ) );
	btn_Rule_01001->setPixmap( QPixmap::fromMimeSource( "data\\rule_01001.bmp" ) );
	btn_Rule_01001->setToggleButton(true);
	btn_Rule_01001->setPalette( pal );
	btn_Rule_01001->setFocusProxy(pg_Rules);
	
	btn_Rule_00110 = new QPushButton( pg_Rules, "btn_Rule_00110" );
	btn_Rule_00110->setGeometry( QRect( 10, 270, 70, 20 ) );
	btn_Rule_00110->setPixmap( QPixmap::fromMimeSource( "data\\rule_00110.bmp" ) );
	btn_Rule_00110->setToggleButton(true);
	btn_Rule_00110->setPalette( pal );
	btn_Rule_00110->setFocusProxy(pg_Rules);
	
	btn_Rule_00101 = new QPushButton( pg_Rules, "btn_Rule_00101" );
	btn_Rule_00101->setGeometry( QRect( 10, 290, 70, 20 ) );
	btn_Rule_00101->setPixmap( QPixmap::fromMimeSource( "data\\rule_00101.bmp" ) );
	btn_Rule_00101->setToggleButton(true);
	btn_Rule_00101->setPalette( pal );
	btn_Rule_00101->setFocusProxy(pg_Rules);
	
	btn_Rule_00011 = new QPushButton( pg_Rules, "btn_Rule_00011" );
	btn_Rule_00011->setGeometry( QRect( 10, 310, 70, 20 ) );
	btn_Rule_00011->setPixmap( QPixmap::fromMimeSource( "data\\rule_00011.bmp" ) );
	btn_Rule_00011->setToggleButton(true);
	btn_Rule_00011->setPalette( pal );
	btn_Rule_00011->setFocusProxy(pg_Rules);
	
	btn_Rule_11100 = new QPushButton( pg_Rules, "btn_Rule_11100" );
	btn_Rule_11100->setGeometry( QRect( 85, 9, 70, 20 ) );
	btn_Rule_11100->setPixmap( QPixmap::fromMimeSource( "data\\rule_11100.bmp" ) );
	btn_Rule_11100->setToggleButton(true);
	btn_Rule_11100->setPalette( pal );
	btn_Rule_11100->setFocusProxy(pg_Rules);
	
	btn_Rule_11010 = new QPushButton( pg_Rules, "btn_Rule_11010" );
	btn_Rule_11010->setGeometry( QRect( 85, 29, 70, 20 ) );
	btn_Rule_11010->setPixmap( QPixmap::fromMimeSource( "data\\rule_11010.bmp" ) );
	btn_Rule_11010->setToggleButton(true);
	btn_Rule_11010->setPalette( pal );
	btn_Rule_11010->setFocusProxy(pg_Rules);
	
	btn_Rule_11001 = new QPushButton( pg_Rules, "btn_Rule_11001" );
	btn_Rule_11001->setGeometry( QRect( 85, 50, 70, 20 ) );
	btn_Rule_11001->setPixmap( QPixmap::fromMimeSource( "data\\rule_11001.bmp" ) );
	btn_Rule_11001->setToggleButton(true);
	btn_Rule_11001->setPalette( pal );
	btn_Rule_11001->setFocusProxy(pg_Rules);
	
	btn_Rule_11110 = new QPushButton( pg_Rules, "btn_Rule_11110" );
	btn_Rule_11110->setGeometry( QRect( 85, 190, 70, 20 ) );
	btn_Rule_11110->setPixmap( QPixmap::fromMimeSource( "data\\rule_11001.bmp" ) );
	btn_Rule_11110->setToggleButton(true);
	btn_Rule_11110->setPalette( pal );
	btn_Rule_11110->setFocusProxy(pg_Rules);
	
	btn_Rule_01111 = new QPushButton( pg_Rules, "btn_Rule_01111" );
	btn_Rule_01111->setGeometry( QRect( 85, 270, 70, 20 ) );
	btn_Rule_01111->setPixmap( QPixmap::fromMimeSource( "data\\rule_01111.bmp" ) );
	btn_Rule_01111->setToggleButton(true);
	btn_Rule_01111->setPalette( pal );
	btn_Rule_01111->setFocusProxy(pg_Rules);
	
	btn_Rule_01110 = new QPushButton( pg_Rules, "btn_Rule_01110" );
	btn_Rule_01110->setGeometry( QRect( 85, 90, 70, 20 ) );
	btn_Rule_01110->setPixmap( QPixmap::fromMimeSource( "data\\rule_01110.bmp" ) );
	btn_Rule_01110->setToggleButton(true);
	btn_Rule_01110->setPalette( pal );
	btn_Rule_01110->setFocusProxy(pg_Rules);
	
	btn_Rule_10101 = new QPushButton( pg_Rules, "btn_Rule_10101" );
	btn_Rule_10101->setGeometry( QRect( 85, 170, 70, 20 ) );
	btn_Rule_10101->setPixmap( QPixmap::fromMimeSource( "data\\rule_10101.bmp" ) );
	btn_Rule_10101->setToggleButton(true);
	btn_Rule_10101->setPalette( pal );
	btn_Rule_10101->setFocusProxy(pg_Rules);
	
	btn_Rule_10111 = new QPushButton( pg_Rules, "btn_Rule_10111" );
	btn_Rule_10111->setGeometry( QRect( 85, 250, 70, 20 ) );
	btn_Rule_10111->setPixmap( QPixmap::fromMimeSource( "data\\rule_10111.bmp" ) );
	btn_Rule_10111->setToggleButton(true);
	btn_Rule_10111->setPalette( pal );
	btn_Rule_10111->setFocusProxy(pg_Rules);
	
	btn_Rule_10011 = new QPushButton( pg_Rules, "btn_Rule_10011" );
	btn_Rule_10011->setGeometry( QRect( 85, 70, 70, 20 ) );
	btn_Rule_10011->setPixmap( QPixmap::fromMimeSource( "data\\rule_10011.bmp" ) );
	btn_Rule_10011->setToggleButton(true);
	btn_Rule_10011->setPalette( pal );
	btn_Rule_10011->setFocusProxy(pg_Rules);
	
	btn_Rule_01101 = new QPushButton( pg_Rules, "btn_Rule_01101" );
	btn_Rule_01101->setGeometry( QRect( 85, 150, 70, 20 ) );
	btn_Rule_01101->setPixmap( QPixmap::fromMimeSource( "data\\rule_01101.bmp" ) );
	btn_Rule_01101->setToggleButton(true);
	btn_Rule_01101->setPalette( pal );
	btn_Rule_01101->setFocusProxy(pg_Rules);
	
	btn_Rule_11011 = new QPushButton( pg_Rules, "btn_Rule_11011" );
	btn_Rule_11011->setGeometry( QRect( 85, 230, 70, 20 ) );
	btn_Rule_11011->setPixmap( QPixmap::fromMimeSource( "data\\rule_11011.bmp" ) );
	btn_Rule_11011->setToggleButton(true);
	btn_Rule_11011->setPalette( pal );
	btn_Rule_11011->setFocusProxy(pg_Rules);
	
	btn_Rule_01011 = new QPushButton( pg_Rules, "btn_Rule_01011" );
	btn_Rule_01011->setGeometry( QRect( 85, 130, 70, 20 ) );
	btn_Rule_01011->setPixmap( QPixmap::fromMimeSource( "data\\rule_01011.bmp" ) );
	btn_Rule_01011->setToggleButton(true);
	btn_Rule_01011->setPalette( pal );
	btn_Rule_01011->setFocusProxy(pg_Rules);
	
	btn_Rule_11101 = new QPushButton( pg_Rules, "btn_Rule_11101" );
	btn_Rule_11101->setGeometry( QRect( 85, 210, 70, 20 ) );
	btn_Rule_11101->setPixmap( QPixmap::fromMimeSource( "data\\rule_11101.bmp" ) );
	btn_Rule_11101->setToggleButton(true);
	btn_Rule_11101->setPalette( pal );
	btn_Rule_11101->setFocusProxy(pg_Rules);
	
	btn_Rule_11111 = new QPushButton( pg_Rules, "btn_Rule_11111" );
	btn_Rule_11111->setGeometry( QRect( 85, 290, 70, 20 ) );
	btn_Rule_11111->setPixmap( QPixmap::fromMimeSource( "data\\rule_11111.bmp" ) );
	btn_Rule_11111->setToggleButton(true);
	btn_Rule_11111->setPalette( pal );
	btn_Rule_11111->setFocusProxy(pg_Rules);
	
	btn_Rule_00111 = new QPushButton( pg_Rules, "btn_Rule_00111" );
	btn_Rule_00111->setGeometry( QRect( 85, 110, 70, 20 ) );
	btn_Rule_00111->setPixmap( QPixmap::fromMimeSource( "data\\rule_00111.bmp" ) );
	btn_Rule_00111->setToggleButton(true);
	btn_Rule_00111->setPalette( pal );
	btn_Rule_00111->setFocusProxy(pg_Rules);
	
	btn_Rule_10110 = new QPushButton( pg_Rules, "btn_Rule_10110" );
	btn_Rule_10110->setGeometry( QRect( 85, 310, 70, 20 ) );
	btn_Rule_10110->setPixmap( QPixmap::fromMimeSource( "data\\rule_10110.bmp" ) );
	btn_Rule_10110->setToggleButton(true);
	btn_Rule_10110->setPalette( pal );
	btn_Rule_10110->setFocusProxy(pg_Rules);
	
	btn_GeneratePattern = new QPushButton( pg_Rules, "btn_GeneratePattern" );
	btn_GeneratePattern->setGeometry( QRect( 16, 340, 135, 35 ) );
	btn_GeneratePattern->setText("Generate Pattern");
	//btn_GeneratePattern->setToggleButton(true);
	btn_GeneratePattern->setPalette( pal );
	btn_GeneratePattern->setFocusProxy(pg_Rules);

	btn_ClearPattern = new QPushButton( pg_Rules, "btn_ClearPattern" );
	btn_ClearPattern->setGeometry( QRect( 16, 380, 135, 25 ) );
	btn_ClearPattern->setText("Clear Pattern");
	btn_ClearPattern->setPalette( pal );
	btn_ClearPattern->setFocusProxy(pg_Rules);

	btn_ResetRules = new QPushButton( pg_Rules, "btn_ResetRules" );
	btn_ResetRules->setGeometry( QRect( 16, 410, 135, 25 ) );
	btn_ResetRules->setText("Reset Rules");
	btn_ResetRules->setPalette( pal );
	btn_ResetRules->setFocusProxy(pg_Rules);

	//--------------------------------------------------------------------------------
	// UI - Beam Creation
	//--------------------------------------------------------------------------------
	btn_GenerateBeams = new QPushButton( pg_BeamCreation, "btn_GenerateBeams" );
	btn_GenerateBeams->setGeometry( QRect( 10, 10, 145, 25 ) );
	btn_GenerateBeams->setText("Generate Beams");
	btn_GenerateBeams->setPalette( pal );

	btn_ClearBeams = new QPushButton( pg_BeamCreation, "btn_ClearBeams" );
	btn_ClearBeams->setGeometry( QRect( 10, 42, 145, 25 ) );
	btn_ClearBeams->setText("Clear Beams");
	btn_ClearBeams->setPalette( pal );

	//--------------------------------------------------------------------------------
	// UI - OpenGL Window
	//--------------------------------------------------------------------------------
	// Create a nice frame to put around the OpenGL widget
	qgl_GLFrame = new QFrame( this, "qgl_GLFrame" );
	qgl_GLFrame->setFrameStyle( QFrame::Sunken | QFrame::Panel );
	qgl_GLFrame->setLineWidth( 2 );
	qgl_GLFrame->setMinimumSize(840,550);
	
	// our OpenGL derived object/widget
	qgl_GLWindow = new BBB_GLWidget( qgl_GLFrame, "qgl_GLWindow" );
	qgl_GLWindow->setBackgroundColor(QColor(128,128,128));
	qgl_GLWindow->bindForm(this);

	//--------------------------------------------------------------------------------
	// Signals & Slots
	//--------------------------------------------------------------------------------
	QObject::connect( btn_ActivateBricks,		SIGNAL(clicked()),                   qgl_GLWindow, SLOT(activateBricks()) );
	QObject::connect( btn_ClearActiveBricks,	SIGNAL(clicked()),                   qgl_GLWindow, SLOT(clearActiveBricks()) );
	QObject::connect( btn_RandomActiveBricks, 	SIGNAL(clicked()),                   qgl_GLWindow, SLOT(randomActiveBricks()) );
	QObject::connect( btn_GeneratePattern,      SIGNAL(clicked()),                   qgl_GLWindow, SLOT(generatePattern()) );
	QObject::connect( btn_ClearPattern,		    SIGNAL(clicked()),                   qgl_GLWindow, SLOT(clearPattern()) );
	QObject::connect( btn_ResetRules,		 	SIGNAL(clicked()),                   qgl_GLWindow, SLOT(clearRules()) );
	QObject::connect( btn_GenerateBeams,	    SIGNAL(clicked()),                   qgl_GLWindow, SLOT(generateBeams()) );
	QObject::connect( btn_ClearBeams, 		    SIGNAL(clicked()),                   qgl_GLWindow, SLOT(clearBeams()) );
	QObject::connect( btn_BrickOffset, 		    SIGNAL(clicked()),                   qgl_GLWindow, SLOT(toggleOffset()) );

	QObject::connect( edit_NumBricks_Row, 		SIGNAL(textChanged(const QString&)), qgl_GLWindow, SLOT(rebuildBricks()) );
	QObject::connect( edit_BrickSize_Length, 	SIGNAL(textChanged(const QString&)), qgl_GLWindow, SLOT(rebuildBricks()) );
	QObject::connect( edit_BrickSize_Width, 	SIGNAL(textChanged(const QString&)), qgl_GLWindow, SLOT(rebuildBricks()) );
	QObject::connect( edit_Cantilevered_Height, SIGNAL(textChanged(const QString&)), qgl_GLWindow, SLOT(cantileverPattern()) );
	QObject::connect( edit_Padding_Rows, 		SIGNAL(textChanged(const QString&)), qgl_GLWindow, SLOT(rebuildBricks()) );

	//--------------------------------------------------------------------------------
	// Signals & Slots - Rules (used for "real-time" CA generation
	//--------------------------------------------------------------------------------
	//QObject::connect( btn_Rule_00000, 			SIGNAL(clicked()), qgl_GLWindow, SLOT(generatePattern()) );	
	//QObject::connect( btn_Rule_10000, 			SIGNAL(clicked()), qgl_GLWindow, SLOT(generatePattern()) );	
	//QObject::connect( btn_Rule_01000, 			SIGNAL(clicked()), qgl_GLWindow, SLOT(generatePattern()) );	
	//QObject::connect( btn_Rule_00100, 			SIGNAL(clicked()), qgl_GLWindow, SLOT(generatePattern()) );	
	//QObject::connect( btn_Rule_00010, 			SIGNAL(clicked()), qgl_GLWindow, SLOT(generatePattern()) );	
	//QObject::connect( btn_Rule_00001, 			SIGNAL(clicked()), qgl_GLWindow, SLOT(generatePattern()) );	
	//QObject::connect( btn_Rule_11000, 			SIGNAL(clicked()), qgl_GLWindow, SLOT(generatePattern()) );	
	//QObject::connect( btn_Rule_10100, 			SIGNAL(clicked()), qgl_GLWindow, SLOT(generatePattern()) );	
	//QObject::connect( btn_Rule_10010, 			SIGNAL(clicked()), qgl_GLWindow, SLOT(generatePattern()) );	
	//QObject::connect( btn_Rule_10001, 			SIGNAL(clicked()), qgl_GLWindow, SLOT(generatePattern()) );	
	//QObject::connect( btn_Rule_01100, 			SIGNAL(clicked()), qgl_GLWindow, SLOT(generatePattern()) );	
	//QObject::connect( btn_Rule_01010, 			SIGNAL(clicked()), qgl_GLWindow, SLOT(generatePattern()) );	
	//QObject::connect( btn_Rule_01001, 			SIGNAL(clicked()), qgl_GLWindow, SLOT(generatePattern()) );	
	//QObject::connect( btn_Rule_00110, 			SIGNAL(clicked()), qgl_GLWindow, SLOT(generatePattern()) );	
	//QObject::connect( btn_Rule_00101, 			SIGNAL(clicked()), qgl_GLWindow, SLOT(generatePattern()) );	
	//QObject::connect( btn_Rule_00011, 			SIGNAL(clicked()), qgl_GLWindow, SLOT(generatePattern()) );	
	//QObject::connect( btn_Rule_11100, 			SIGNAL(clicked()), qgl_GLWindow, SLOT(generatePattern()) );	
	//QObject::connect( btn_Rule_11010, 			SIGNAL(clicked()), qgl_GLWindow, SLOT(generatePattern()) );	
	//QObject::connect( btn_Rule_11001, 			SIGNAL(clicked()), qgl_GLWindow, SLOT(generatePattern()) );	
	//QObject::connect( btn_Rule_11110, 			SIGNAL(clicked()), qgl_GLWindow, SLOT(generatePattern()) );	
	//QObject::connect( btn_Rule_01111, 			SIGNAL(clicked()), qgl_GLWindow, SLOT(generatePattern()) );	
	//QObject::connect( btn_Rule_01110, 			SIGNAL(clicked()), qgl_GLWindow, SLOT(generatePattern()) );	
	//QObject::connect( btn_Rule_10101, 			SIGNAL(clicked()), qgl_GLWindow, SLOT(generatePattern()) );	
	//QObject::connect( btn_Rule_10111, 			SIGNAL(clicked()), qgl_GLWindow, SLOT(generatePattern()) );	
	//QObject::connect( btn_Rule_10011, 			SIGNAL(clicked()), qgl_GLWindow, SLOT(generatePattern()) );	
	//QObject::connect( btn_Rule_01101, 			SIGNAL(clicked()), qgl_GLWindow, SLOT(generatePattern()) );	
	//QObject::connect( btn_Rule_11011, 			SIGNAL(clicked()), qgl_GLWindow, SLOT(generatePattern()) );	
	//QObject::connect( btn_Rule_01011, 			SIGNAL(clicked()), qgl_GLWindow, SLOT(generatePattern()) );	
	//QObject::connect( btn_Rule_11101, 			SIGNAL(clicked()), qgl_GLWindow, SLOT(generatePattern()) );	
	//QObject::connect( btn_Rule_11111, 			SIGNAL(clicked()), qgl_GLWindow, SLOT(generatePattern()) );	
	//QObject::connect( btn_Rule_00111, 			SIGNAL(clicked()), qgl_GLWindow, SLOT(generatePattern()) );	
	//QObject::connect( btn_Rule_10110, 			SIGNAL(clicked()), qgl_GLWindow, SLOT(generatePattern()) );	

	//--------------------------------------------------------------------------------
	// Menu
	//--------------------------------------------------------------------------------
	// Create a menu with "file" elements
	menu_File = new QPopupMenu( this );
	menu_File->insertItem( "Save Pattern",			qgl_GLWindow, SLOT(savePattern()), CTRL+Key_S );
	menu_File->insertItem( "Load Pattern",			qgl_GLWindow, SLOT(loadPattern()), CTRL+Key_L );
	menu_File->insertItem( "Clear Pattern",		qgl_GLWindow, SLOT(resetAll()),    CTRL+Key_N );
	menu_File->insertSeparator();
	menu_File->insertItem( "Import Path",			qgl_GLWindow, SLOT(importPath()),  CTRL+Key_I );
	menu_File->insertItem( "Export to OBJ",			qgl_GLWindow, SLOT(exportToObj()), CTRL+Key_X );
	menu_File->insertItem( "Export to RLE",			qgl_GLWindow, SLOT(exportToRLE()), CTRL+Key_R );
	menu_File->insertItem( "Export to Playlist",	qgl_GLWindow, SLOT(exportToMP3()), CTRL+Key_P );
	menu_File->insertSeparator();
	menu_File->insertItem( "Exit",					qApp, SLOT(quit()),		   CTRL+Key_Q );
	
	// Create a menu with "utility" elements
	menu_Utility = new QPopupMenu( this );
	menu_Utility->insertItem( "Invert Active",      qgl_GLWindow, SLOT(invertActive()),   ALT+Key_I);
	menu_Utility->insertItem( "Hide/Show Inactive",	qgl_GLWindow, SLOT(showInactive()),	  ALT+Key_H);
	menu_Utility->insertItem( "Take Screenshot",    qgl_GLWindow, SLOT(takeScreenshot()), ALT+Key_S);
	menu_Utility->insertItem( "Zoom Extensts",      qgl_GLWindow, SLOT(zoomExtents()),    ALT+Key_Z);
	menu_Utility->insertItem( "Draw Borders",       qgl_GLWindow, SLOT(toggleBorders()),  ALT+Key_B);
	menu_Utility->insertItem( "Draw Grid",          qgl_GLWindow, SLOT(toggleGrid()),     ALT+Key_G);
		
	// Create a menu with "help" elements
	//menu_Help = new QPopupMenu( this );
	//menu_Help->insertItem( "Online Help",	qApp, SLOT(quit()), 0);
	//menu_Help->insertItem( "About",		qApp, SLOT(quit()), 0);
	
	// create a menu bar to store the popup menu
	menu_MainBar = new QMenuBar( this );
	menu_MainBar->setSeparator( QMenuBar::InWindowsStyle );
	menu_MainBar->insertItem("&File",	 menu_File );
	menu_MainBar->insertItem("&Utility", menu_Utility );
	//menu_MainBar->insertItem("&Help",	  menu_Help );

	//--------------------------------------------------------------------------------
	// Layouts
	//--------------------------------------------------------------------------------
	QVBoxLayout* vlayout = new QVBoxLayout(1,"vlayout");
	vlayout->add(tb_MainUI);
	vlayout->setAlignment(Qt::AlignTop);
  
	QHBoxLayout* flayout = new QHBoxLayout( qgl_GLFrame, 2, 2, "flayout");
    flayout->addWidget( qgl_GLWindow, 1 );

	QHBoxLayout* hlayout = new QHBoxLayout( this, 5, 5, "hlayout");
	hlayout->setMenuBar( menu_MainBar );
    hlayout->addLayout( vlayout );
    hlayout->addWidget( qgl_GLFrame, 1 );
}
Ejemplo n.º 11
0
void MenuWidget::setupUI()
{
    m_pMenubar = new QMenuBar;
    m_pMenubar->setContentsMargins(0,0,0,0);
    m_pMenubar->setStyleSheet("QMenuBar{background:#141A33;color:white;border:black;}"
                              "QMenuBar::item {background:#141A28;}");

    //系统
//    m_pMuSys = m_pMenubar->addMenu(tr("&System"));
//    m_pMuSys->setFixedSize(MEMU_WIDTH,MENU_HEIGHT);

//    m_pAcSys = new QAction(tr("system"),m_pMuSys);
//    m_pMuSys->addAction(m_pAcSys);

    //播放
    m_pMuPlay = m_pMenubar->addMenu(tr("&Play"));
    m_pMuPlay->setFixedSize(MEMU_WIDTH,MENU_HEIGHT);

    m_pAcPlay = new QAction(tr("play"),m_pMuPlay);
    m_pMuPlay->addAction(m_pAcPlay);

    //操作
    m_pMuOpe = m_pMenubar->addMenu(tr("&Operation"));
    m_pMuOpe->setFixedSize(MEMU_WIDTH,MENU_HEIGHT);

    m_pAcManageFile = new QAction(tr("ManageFile"),m_pMuOpe);
    m_pMuOpe->addAction(m_pAcManageFile);

    //设置
    m_pMuSetup = m_pMenubar->addMenu(tr("&Setup"));
    m_pMuSetup->setFixedSize(MEMU_WIDTH,MENU_HEIGHT*3);

    m_pAcSet = new QAction(tr("set"),m_pMuSetup);
    m_pMuSetup->addAction(m_pAcSet);

    m_pAcSaveFile = new QAction(tr("Save SnapFile"),m_pMuSetup);
    m_pMuSetup->addSeparator();
    m_pMuSetup->addAction(m_pAcSaveFile);

    //权限管理
    if (UIContext::getInstance()->right() == all)
    {
        qDebug() << tr("RightMgr");
        m_pAcRightMgr = new QAction(tr("RightMgr"), m_pMuSetup);
        m_pMuSetup->addSeparator();
        m_pMuSetup->addAction(m_pAcRightMgr);
    }

    //帮助
//    m_pMuHelp = m_pMenubar->addMenu(tr("&Help"));
//    m_pMuHelp->setFixedSize(MEMU_WIDTH,MENU_HEIGHT);

//    m_pAcHelp = new QAction(tr("help"),m_pMuHelp);
//    m_pMuHelp->addAction(m_pAcHelp);

    QHBoxLayout* mainLay = new QHBoxLayout;
    mainLay->setContentsMargins(0,0,0,0);
    mainLay->setSpacing(0);
    mainLay->setMenuBar(m_pMenubar);

    this->setLayout(mainLay);
}
Ejemplo n.º 12
0
VDWindow::VDWindow(QWidget *parent) : QWidget(parent)
{
    QHBoxLayout *boxLayout = new QHBoxLayout();

    setLayout(boxLayout);

    toolbar = new QToolBar("Toolbar", this);
    QIcon icon_break(":/icon-break");
    action_break = new QAction(icon_break, "Break main", 0);
    toolbar->addAction(action_break);
    QIcon icon_run(":/icon-run");
    action_run = new QAction(icon_run, "Run", 0);
    toolbar->addAction(action_run);
    QIcon icon_stepin(":/icon-stepin");
    action_stepin = new QAction(icon_stepin, "Step in", 0);
    toolbar->addAction(action_stepin);
    QIcon icon_stepover(":/icon-stepover");
    action_stepover = new QAction(icon_stepover, "Step over", 0);
    toolbar->addAction(action_stepover);
    QIcon icon_stepout(":/icon-stepout");
    action_stepout = new QAction(icon_stepout, "Step out", 0);
    toolbar->addAction(action_stepout);
    QIcon icon_listlocals(":/icon-listlocals");
    action_listlocals = new QAction(icon_listlocals, "List locals", 0);
    toolbar->addAction(action_listlocals);
    QIcon icon_stop(":/icon-stop");
    action_stop = new QAction(icon_stop, "Interrupt", 0);
    toolbar->addAction(action_stop);
    QIcon icon_quit(":/icon-quit");
    action_quit = new QAction(icon_quit, "Quit", 0);
    toolbar->addAction(action_quit);

    toolbar->addSeparator();
    boxLayout->setMenuBar(toolbar);

    splitter = new QSplitter(this);
    boxLayout->addWidget(splitter);

    m_debug_output = new QPlainTextEdit("Text", this);
    m_debug_output->setGeometry(10, 50, 500, 200);
    m_debug_output->appendPlainText("Startup text.");
    splitter->addWidget(m_debug_output);
    view = new QGraphicsView(this);
    splitter->addWidget(view);

    scene = new QGraphicsScene();
    view->setScene(scene);
    QPixmap image;
    item = scene->addPixmap(image);
    view->show();

    //QBrush blueBrush(Qt::blue);
    //QPen outlinePen(Qt::black);
    //QGraphicsRectItem *rect = scene->addRect(10, 10, 100, 100, outlinePen, blueBrush);
    //rect->setFlag(QGraphicsItem::ItemIsMovable);

    program = "gdb testapp -iex \"set auto-load safe-path /\" --interpreter=mi2";
    process = new QProcess();

    process->setProcessChannelMode(QProcess::MergedChannels);
    process->setWorkingDirectory("/home/ilze/Documents");
    process->start(program);
    appExecuting = false;

    parser = new GDBMIParser(m_debug_output, this);
    writer = new GDBMIWriter(process);
    varList = new VDVariableList(parser, writer, this);

    connect(process, SIGNAL (readyReadStandardOutput()), this, SLOT (slotOutputRecieved()));

    connect(action_break, SIGNAL (triggered()), this, SLOT (slotButtonClickedBreakMain()));
    connect(action_run, SIGNAL (triggered()), this, SLOT (slotButtonClickedRun()));
    connect(action_stepin, SIGNAL (triggered()), this, SLOT (slotButtonClickedStepin()));
    connect(action_stepover, SIGNAL (triggered()), this, SLOT (slotButtonClickedStepover()));
    connect(action_stepout, SIGNAL (triggered()), this, SLOT (slotButtonClickedStepout()));
    connect(action_listlocals, SIGNAL (triggered()), this, SLOT (slotButtonClickedListLocals()));
    connect(action_stop, SIGNAL (triggered()), this, SLOT (slotButtonClickedStop()));
    connect(action_quit, SIGNAL (triggered()), this, SLOT (slotButtonClickedQuit()));
    connect(this, SIGNAL(signalImageParced()), this, SLOT(slotImageParced()));
}
Ejemplo n.º 13
0
QNEMainWindow::QNEMainWindow(QWidget *parent) :  QMainWindow(parent)
{
	// -------------------------------------
	// central widget
	// -------------------------------------
	QWidget *window = new QWidget();
	setCentralWidget(window);
	QHBoxLayout *layout = new QHBoxLayout;
	window->setLayout(layout);	
	// -------------------------------------
	// Main menu
	// ------------------------------------
	createMenuBar();
	layout->setMenuBar(menuBar);


	// -------------------------------------
	// Tools
	// ------------------------------------

	QVBoxLayout *Tools_Layout = new QVBoxLayout;
    layout->addLayout(Tools_Layout);
	// -------------------------------------
	// Tree
	// ------------------------------------
	QTreeWidget *treeWidget = new QTreeWidget();
	treeWidget->setColumnCount(1);
	treeWidget->setHeaderHidden(true);
	treeWidget->setFixedWidth(250);
	// создаем новый итем (пусть сначала базовый)
	QTreeWidgetItem *topLevelItem=new QTreeWidgetItem(treeWidget);
	// вешаем его на наше дерево в качестве топ узла.
	treeWidget->addTopLevelItem(topLevelItem);
	// укажем текст итема
	topLevelItem->setText(0,"Item");
	// создаем новый итем и сразу вешаем его на наш базовый
	QTreeWidgetItem *item=new QTreeWidgetItem(topLevelItem);
	// укажем текст итема
	item->setText(0,"SubItem");
	Tools_Layout->addWidget(treeWidget);

	// -------------------------------------
	// Property Browser
	// ------------------------------------	
 
	QtIntPropertyManager *intManager;
    QtProperty *priority;
    
    intManager = new QtIntPropertyManager;
    priority = intManager->addProperty("Priority");   
    priority->setToolTip("Task Priority");
    intManager->setRange(priority, 1, 5);
    intManager->setValue(priority, 3);

    QtEnumPropertyManager *enumManager=new QtEnumPropertyManager();
    QtProperty *reportType;
	reportType = enumManager->addProperty("Report Type");  
    QStringList types;   
    types << "Bug" << "Suggestion" << "To Do";
    enumManager->setEnumNames(reportType, types);
    enumManager->setValue(reportType, 1); // "Suggestion"

    QtGroupPropertyManager *groupManager;
    QtProperty *task1;

    groupManager = new QtGroupPropertyManager;
    task1 = groupManager->addProperty("Task 1");
    
    task1->addSubProperty(priority);
    task1->addSubProperty(reportType);

    QtSpinBoxFactory *spinBoxFactory;
    QtEnumEditorFactory *enumFactory;
    
    spinBoxFactory = new QtSpinBoxFactory;
    enumFactory = new QtEnumEditorFactory;
    
    QtTreePropertyBrowser *browser;
    browser = new QtTreePropertyBrowser;
    browser->setFactoryForManager(intManager, spinBoxFactory);
    browser->setFactoryForManager(enumManager, enumFactory);
	browser->setFixedWidth(250);

    browser->addProperty(task1);
   // browser->show();

	Tools_Layout->addWidget(browser);

	// -------------------------------------
	// Graphic view
	// ------------------------------------
	view = new QGraphicsView(this);
	view->setInteractive(true);
	view->setBackgroundBrush(QBrush(QColor(60,60,60), Qt::SolidPattern));
	scene = new QGraphicsScene();
	view->setScene(scene);
	view->setRenderHint(QPainter::Antialiasing, true);
	layout->addWidget(view);

	// -------------------------------------
	// Nodes editor
	// -----------------------------------
	nodesEditor = new QNodesEditor(this);
	nodesEditor->install(scene);


	QNEBlock *b1 = new QNEBlock(0);
	scene->addItem(b1);
	b1->block_name="U1";
	b1->block_type="Source";
	b1->addOutputPort("img");
	b1->setPos(0, 0);

	QNEBlock *b2 = new QNEBlock(0);
	scene->addItem(b2);
	b2->block_name="U2";
	b2->block_type="Threshold";
	b2->addInputPort("img");
	b2->addOutputPort("thr");
	b2->setPos(150, 0);


}