Dear visitor, welcome to QtForum.org. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

Quoted
Just use paintEvent and draw whatever you want
|
|
Source code |
1 2 3 4 5 6 7 |
void OgreWidget::paintEvent(QPaintEvent *e)
{
mRoot->_fireFrameStarted();
mWindow->update();
mRoot->_fireFrameEnded();
e->accept();
}
|
|
|
Source code |
1 2 3 4 5 6 7 8 9 |
Ogre::Viewport* vp1 = mWindow->addViewport( mCamera1); //default values, rendered in the whole window vp1->setBackgroundColour(Ogre::ColourValue(0,0,0)); // Alter the camera aspect ratio to match the viewport mCamera1->setAspectRatio(Ogre::Real(vp1->getActualWidth()) / Ogre::Real(vp1->getActualHeight())); Ogre::Viewport* vp2 = mWindow->addViewport( mCamera2, 1 , 0.75, 0.75, 0.25, 0.25 ); //small viewport, rendered in the lower right corner of the window (the 0.75's define the position, the 0.25's define the size // Set backgrounc color vp2->setBackgroundColour( Ogre::ColourValue( 1, 0, 0 ) ); mCamera2->setAspectRatio( Ogre::Real(vp2->getActualWidth()) / Ogre::Real(vp2->getActualHeight())); //don't forget to set the aspect ratio of the second camera |
|
|
Source code |
1 2 3 4 5 6 7 8 9 10 11 |
void OgreWidget::paintEvent(QPaintEvent *e)
{
mRoot->_fireFrameStarted();
mWindow->update();
mRoot->_fireFrameEnded();
// now use QPainter to draw a rectangle.
// The size of the rect should be rect() (or a little smaller)
e->accept();
}
|
|
|
Source code |
1 2 3 4 5 6 |
MainWindow::MainWindow()
{
this->setBaseSize(1500,1500);
my_calsseWidget = new my_classe(this);
setCentralWidget(my_calsseWidget);
|
This post has been edited 1 times, last edit by "chahd09" (May 24th 2012, 8:26pm)
|
|
Source code |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
#include <QtGui/QApplication>
#include <QHBoxLayout>
#include <QGridLayout>
#include <QGroupBox>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QWidget w;
QHBoxLayout* mainlayout = new QHBoxLayout;
QGridLayout* rightSide = new QGridLayout;
rightSide->addWidget(new QGroupBox("0,0"), 0, 0 );
rightSide->addWidget(new QGroupBox("0,1"), 0, 1 );
rightSide->addWidget(new QGroupBox("0,2"), 0, 2 );
rightSide->addWidget(new QGroupBox("1,0"), 1, 0 );
rightSide->addWidget(new QGroupBox("1,1"), 1, 1 );
rightSide->addWidget(new QGroupBox("1,2"), 1, 2 );
rightSide->addWidget(new QGroupBox("2,0"), 2, 0 );
rightSide->addWidget(new QGroupBox("2,1"), 2, 1 );
rightSide->addWidget(new QGroupBox("2,2"), 2, 2 );
mainlayout->addWidget(new QGroupBox("big frame"));
mainlayout->addLayout(rightSide);
w.setLayout(mainlayout);
w.show();
return a.exec();
}
|
|
|
Source code |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
my_calsseWidget = new OgreWidget(this);
setCentralWidget(ogreWidget);
QHBoxLayout* mainlayout = new QHBoxLayout;
QGridLayout* rightSide = new QGridLayout;
rightSide->addWidget(new QGroupBox("0,0"), 0, 0 );
rightSide->addWidget(new QGroupBox("0,1"), 0, 1 );
rightSide->addWidget(new QGroupBox("0,2"), 0, 2 );
rightSide->addWidget(new QGroupBox("1,0"), 1, 0 );
rightSide->addWidget(new QGroupBox("1,1"), 1, 1 );
rightSide->addWidget(new QGroupBox("1,2"), 1, 2 );
rightSide->addWidget(new QGroupBox("2,0"), 2, 0 );
rightSide->addWidget(new QGroupBox("2,1"), 2, 1 );
rightSide->addWidget(new QGroupBox("2,2"), 2, 2 );
rightSide->addWidget(new QGroupBox("3,0"), 3, 0 );
rightSide->addWidget(new QGroupBox("3,1"), 3, 1 );
rightSide->addWidget(new QGroupBox("3,2"), 3, 2 );
mainlayout->addWidget(new QGroupBox("big frame"));
mainlayout->addLayout(rightSide);
my_calsseWidget.setLayout(mainlayout);
|
|
|
Source code |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
ogreWidget = new OgreWidget(this);
//setCentralWidget(ogreWidget);
createModel();
//QWidget w;
// createActionMenus();
////////////////////////////////////////////////////
QHBoxLayout* mainlayout = new QHBoxLayout;
QGridLayout* rightSide = new QGridLayout;
rightSide->addWidget(new QGroupBox("0,0"), 0, 0 );
rightSide->addWidget(new QGroupBox("0,1"), 0, 1 );
rightSide->addWidget(new QGroupBox("0,2"), 0, 2 );
rightSide->addWidget(new QGroupBox("1,0"), 1, 0 );
rightSide->addWidget(new QGroupBox("1,1"), 1, 1 );
rightSide->addWidget(new QGroupBox("1,2"), 1, 2 );
rightSide->addWidget(new QGroupBox("2,0"), 2, 0 );
rightSide->addWidget(new QGroupBox("2,1"), 2, 1 );
rightSide->addWidget(new QGroupBox("2,2"), 2, 2 );
rightSide->addWidget(new QGroupBox("3,0"), 3, 0 );
rightSide->addWidget(new QGroupBox("3,1"), 3, 1 );
rightSide->addWidget(new QGroupBox("3,2"), 3, 2 );
mainlayout->addWidget(ogreWidget);
//mainlayout->addWidget(new QGroupBox("big frame"));
QWidget *central = new QGroupBox("My Scene", this);
central->setLayout(mainlayout);
setCentralWidget(central);
mainlayout->addLayout(rightSide);
|
|
|
Source code |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
void OgreWidget::createViewports(void)
{
mWindow->addViewport(mCamera, 0, 0, 0, 0.5, 1); // large left half viewport
int columns = 3;
int rows = 4;
for(int y = 0; y < rows; y++)
for(int x = 0; x < columns; x++)
{
mWindow->addViewport(mCamera,
x + y * columns + 1, // each viewport needs a unique zorder value
0.5f + (0.5f / columns) * x, // left edge
(1.0f / rows) * y, // top edge
0.5f / columns, // tile width
1.0f / rows); // tile height
}
}
|
Quoted
and put where the small group boxes are.