marcomas
18th August 2009, 18:38
Hi all,
I am trying to solve a problem and, after a long and unsuccessful research in forums and guides, I decided to post it on this forum.
I don't think that there is already an answer here; however, if there is, please accept my apology and kindly indicate to me a link to it.
The application I am developing has to run on MS Windows, Mac OS X and (later) Linux.
My development environments:
Qt 4.5.2 on Windows XP, Vista, 7RC (Windows, for brevity) with MinGW
Qt 4.5.2 on MAC OS X 10.5.8 (latest Mini Mac)
The application runs perfectly on Windows XP. However, I have a problem on OS X as the scene doesn't show the widget in it correctly.
It has to be said that the widget has a layout containing many, many pixmaps to create a dynamic scene according to user preferences.
When rendered, the size of the scene under the view corresponds to the size of the layout and the scrollbars for the view appear as they do on Windows. However, the actual picture is much smaller and under no circumstances exceeds the size of the view.
I am pretty sure that what I am doing is textbook stuff (at least on 4.5, but that's the only version of Qt I have some experience on) and I might have even written my code out of some example from books or documentation.
Here comes the skeleton of my code
m_gs = new DocScene(); // derived from QGraphicsScene
QGridLayout *gvBackLayout = new QGridLayout;
// The layout is filled with (many) QLabels created out QPixmaps using
---
gvBackLayout->addWidget(QLabel* , ...);
---
QWidget * backform = new QWidget; // In the end a new Widget is created
backform->setLayout(gvBackLayout); // and the layout created before
// is assigned to it
m_gpw = m_gs->addWidget(backform); // the newly created widget
// is assigned to the scene
ui.graphicsView->setScene(m_gs); // scene assigned to the view
I would be extremely grateful to anyone who could indicate to me what I am doing wrong, if anything, or possible alternatives.
Thanks in advance
Marco
I am trying to solve a problem and, after a long and unsuccessful research in forums and guides, I decided to post it on this forum.
I don't think that there is already an answer here; however, if there is, please accept my apology and kindly indicate to me a link to it.
The application I am developing has to run on MS Windows, Mac OS X and (later) Linux.
My development environments:
Qt 4.5.2 on Windows XP, Vista, 7RC (Windows, for brevity) with MinGW
Qt 4.5.2 on MAC OS X 10.5.8 (latest Mini Mac)
The application runs perfectly on Windows XP. However, I have a problem on OS X as the scene doesn't show the widget in it correctly.
It has to be said that the widget has a layout containing many, many pixmaps to create a dynamic scene according to user preferences.
When rendered, the size of the scene under the view corresponds to the size of the layout and the scrollbars for the view appear as they do on Windows. However, the actual picture is much smaller and under no circumstances exceeds the size of the view.
I am pretty sure that what I am doing is textbook stuff (at least on 4.5, but that's the only version of Qt I have some experience on) and I might have even written my code out of some example from books or documentation.
Here comes the skeleton of my code
m_gs = new DocScene(); // derived from QGraphicsScene
QGridLayout *gvBackLayout = new QGridLayout;
// The layout is filled with (many) QLabels created out QPixmaps using
---
gvBackLayout->addWidget(QLabel* , ...);
---
QWidget * backform = new QWidget; // In the end a new Widget is created
backform->setLayout(gvBackLayout); // and the layout created before
// is assigned to it
m_gpw = m_gs->addWidget(backform); // the newly created widget
// is assigned to the scene
ui.graphicsView->setScene(m_gs); // scene assigned to the view
I would be extremely grateful to anyone who could indicate to me what I am doing wrong, if anything, or possible alternatives.
Thanks in advance
Marco