PDA

View Full Version : bug in qt 4.7rc1? wrong availablegeometry



faenil
29th August 2010, 21:23
Hi guys I'm stuck on a bug with rc1...

The software was working ok with beta2...

The problem is, I'm using the PLLayout class by nokia (http://wiki.forum.nokia.com/index.php/Code_Example_for_Portrait_/_Landscape_Autorotate_Layout_in_Qt) to use rotation functions...

BUT, when I rotate the screen, the wrong availablegeometry is shown...

Is there anything I can do about it?



void dummy::createComponents()
{
centralwidget = new QWidget();
imgCameraLab = new QLabel(centralwidget);
imgCameraLab->setObjectName(QString::fromUtf8("imgCameraLab"));

cameramenu = new QMenu(this);
cameramenu->addAction(tr("Photo PF"), this, SLOT(PFphoto_slot()));
cameramenu->addAction("Photo AF", this, SLOT(AFphoto_slot()));

videomenu = new QMenu(this);
videomenu->addAction("Video PF", this, SLOT(PFvideo_slot()));
videomenu->addAction("Video AF", this, SLOT(AFvideo_slot()));

samsungmenu = new QMenu(tr("Samsung devices"),this);
samsungmenu->addAction(tr("i8910"), this, SLOT(i8910_slot()));
samsungmenu->addAction(tr("i8510"), this, SLOT(i8510_slot()));

motomenu = new QMenu(tr("Motorola devices"),this);
motomenu->addAction(tr("droidx"), this, SLOT(droidx_slot()));
motomenu->addAction(tr("milestone"), this, SLOT(milestone_slot()));

othersmenu = new QMenu(tr("Other devices"),this);
othersmenu->addAction(tr("vivaz"), this, SLOT(vivaz_slot()));
othersmenu->addAction(tr("devplat"), this, SLOT(devplat_slot()));
othersmenu->addAction(tr("n900"), this, SLOT(n900_slot()));
othersmenu->addAction(tr("palm pre"), this, SLOT(palm_slot()));

codecsmenu = new QMenu(this);
codecsmenu->addMenu(samsungmenu);
codecsmenu->addMenu(motomenu);
codecsmenu->addMenu(othersmenu);


cameramenu_butt = new ModButton(tr("Camera Focus"));
cameramenu_butt->setMenu(cameramenu);
videomenu_butt = new ModButton(tr("Video Focus"));
videomenu_butt->setMenu(videomenu);
codecsmenu_butt = new ModButton(tr("JPEG Codecs Setting"));
codecsmenu_butt->setMenu(codecsmenu);
startcamera_butt = new ModButton(tr("Start Camera"));
connect(startcamera_butt, SIGNAL(pressed()), this, SLOT(startcamera_slot()));
exit_butt = new ModButton("EXIT");
connect(exit_butt, SIGNAL(pressed()), this, SLOT(exit_slot()));
}

void dummy::createPortraitLayout()
{
Qt::Alignment AlignFull = 0x0;
layoutPortrait = new QGridLayout;
layoutPortrait->setHorizontalSpacing(15);
layoutPortrait->setVerticalSpacing(30);

cameramenu_butt->setFixedHeight(80);
videomenu_butt->setFixedHeight(80);
codecsmenu_butt->setFixedHeight(80);
startcamera_butt->setFixedHeight(110);
exit_butt->setFixedHeight(70);
/*layoutPortrait->setRowMinimumHeight(3,300);*/
layoutPortrait->addWidget(cameramenu_butt, 1, 0, 1, 1, AlignFull);
layoutPortrait->addWidget(videomenu_butt, 1, 1, 1, 1, AlignFull);
layoutPortrait->addWidget(codecsmenu_butt, 2, 0, 1, 2, AlignFull);
layoutPortrait->addWidget(startcamera_butt, 4, 0, 1, 1, Qt::AlignLeft);
layoutPortrait->addWidget(exit_butt, 4, 1, 1, 1, Qt::AlignBottom);
layoutPortrait->addWidget(imgCameraLab, 0, 0, 1, 1, Qt::AlignLeft);
}

void dummy::createLandscapeLayout()
{
Qt::Alignment AlignFull = 0x0;

layoutLandscape = new QGridLayout;
layoutLandscape->setHorizontalSpacing(15);
layoutLandscape->setVerticalSpacing(30);
layoutLandscape->addWidget(imgCameraLab, 0, 0 ,1 ,1, AlignFull);
layoutLandscape->addWidget(cameramenu_butt, 1, 0, 1, 1, AlignFull);
layoutLandscape->addWidget(videomenu_butt, 1, 1, 1, 1, AlignFull);
layoutLandscape->addWidget(codecsmenu_butt, 2, 0, 1, 2, AlignFull);
layoutLandscape->addWidget(startcamera_butt, 3, 0, 1, 1, Qt::AlignLeft);
layoutLandscape->addWidget(exit_butt, 3, 1, 1, 1, Qt::AlignBottom);

}


void dummy::createAutoLayout() {
autoLayout = new PLLayout();
autoLayout->setPLayout(layoutPortrait);
autoLayout->setLLayout(layoutLandscape);
//recommendation; first assign Landscape and THEN portrait layout
//as some - not yet understood - effects have been observed for other sequence
}

void dummy::resizeEvent (QResizeEvent* event)
{


autoLayout->resizeEvent(event);

if(autoLayout->m_isLLayout == true )
{
this->setStyleSheet("dummy {background-image: url(C:/Data/faenil-graphics/backCamland.jpg)}");
}
else
{
this->setStyleSheet("dummy {background-image: url(C:/Data/faenil-graphics/backCam.jpg)}");
}


// Call base class impl
QMainWindow::resizeEvent(event);
}


void dummy::selfAssignLayout() {

centralwidget->setLayout(autoLayout);
centralwidget->setObjectName(QString::fromUtf8("centralwidget"));
this->setCentralWidget(centralwidget);
}





This is the code of my mainwindow...
the code of the PLLayout class is the same given by nokia...

What am I doing wrong?
The problem is the wrong available geometry makes my pushbutton menu go out of screen while in landscape, because the system uses the availablegeometry of portrait...

The RESIZEEVENT example code from Nokia has the same problem that I have, it doesn't work correctly in the S60 SDK and on the phone, but it works ok in QT Creator's Simulator...

so I guess it's a Symbian libraries bug...