[Qt 4.8] Qt quick / Qml landscape issue on belle refresh
Hello,
I picked up the development for an abandoned Qt app about a month ago. It's almost complete, but I'm facing one bug that I can't manage to fix.
When I simulate the app, everything works fine, both portrait as landscape. However, when I install the app on my Nokia E7-00 running on nokia belle refresh (Qt 4.8), landscape mode breaks.
Is there any solution to this?
I found 1 topic that described similar problems, but didn't find a real solution in that one.
code concerning the QmlApplicationViewer in main.cpp:
[CODE]
QScopedPointer<QmlApplicationViewer> tQmlApplicationViewer(QmlApplicationViewer::create());
tQmlApplicationViewer->setResizeMode(QDeclarativeView::SizeRootObjectToView);
// Load the QML entrypoint
tQmlApplicationViewer->setMainQmlFile(QLatin1String("qml/BeTrains/main.qml"));
tQmlApplicationViewer->showFullScreen();[/CODE]
The code in main.qml
[CODE]import QtQuick 1.1
import com.nokia.symbian 1.1
import com.nokia.extras 1.1
import "pages"
import "components"
import "js/utils.js" as Utils
import "js/storage.js" as Storage
import QtQuick 1.0
Window{
id: window
property string __schemaIdentification: "2"
Component.onCompleted: {
Storage.initialize()
}
//
// Window structure
//
PageStackWindow {
id: pagestackwindow1
initialPage: mainPage
showStatusBar: true
showToolBar: true
onRotationChanged: console.log("rotated!")
Page {
id: mainPage
// orientationLock: PageOrientation.LockPortrait
tools: toolBarLayout
TabGroup {
id: tabGroup
currentTab: liveboardStack
anchors.fill: parent
PageStack {
id: liveboardStack
Component.onCompleted: liveboardStack.push(liveboardPage)
}
PageStack {
id: travelStack
Component.onCompleted: travelStack.push(travelPage)
}
}
}
}
//
// Toolbar
//
ToolBarLayout {
id: toolBarLayout
// Back buton
ToolButton {
property bool closeButton: tabGroup.currentTab.depth <= 1
flat: true
iconSource: closeButton ? "icons/close.svg" : "toolbar-back"
onClicked: closeButton ? Qt.quit() : tabGroup.currentTab.pop();
}
// Tab bar
ButtonRow {
TabButton { id: tabBtnLiveboard; tab: liveboardStack; iconSource: "toolbar-list" }
TabButton {id:tabBtnTravel;tab: travelStack; iconSource: "toolbar-search" }
}
// Menu
ToolButton {
iconSource: "toolbar-menu"
onClicked: {
if (!window.menu)
window.menu = Utils.loadObjectByComponent(menuComponent, window)
window.menu.open()
}
}
}
//
// Objects
//
// Statically loaded objects
property variant liveboardPage: LiveboardPage {}
property variant travelPage: TravelPage {}
// Dynamically loaded objects
property variant aboutDialog
// In-line defined menu component
property variant menu
Component {
id: menuComponent
Menu {
id: menu
content: MenuLayout {
// About
MenuItem {
text: qsTr("About")
onClicked: {
if (!aboutDialog)
aboutDialog = Utils.loadObjectByPath("components/AboutDialog.qml", menu)
aboutDialog.open()
}
}
// Quit
MenuItem {
text: qsTr("Quit")
onClicked: Qt.quit()
}
}
}
}
Text {
id: statustext
x: 2
y: 2
width: 230
height: 22
color: "#ffffff"
text: qsTr("BeTrains")
font.pixelSize: 20
}
}
[/CODE]
The last text object was for testing purposes, and it rotated as it should...
Image that shows the problem:
[IMG]http://i50.tinypic.com/2ezr2f5.jpg[/IMG]
The simulator result is on the left side, screenshots from my E7 on the right. The problem is circled in red.
Thanks in advance.
Re: [Qt 4.8] Qt quick / Qml landscape issue on belle refresh
Is this relevant? [url]http://www.developer.nokia.com/Community/Wiki/Changes_in_Symbian_Belle_and_Qt_4.x#Orientation_detection_in_QWidget_.E2.80.93based_Symbian_application[/url]
Re: [Qt 4.8] Qt quick / Qml landscape issue on belle refresh
[QUOTE=hamishwillee;907752]Is this relevant? [url]http://www.developer.nokia.com/Community/Wiki/Changes_in_Symbian_Belle_and_Qt_4.x#Orientation_detection_in_QWidget_.E2.80.93based_Symbian_application[/url][/QUOTE]
I already found information on changed coordinates and anchoring etc, but changing the anchoring etc didn't change anything.
However, I found the solution thanks to the people at StackExchange.
the pagestackwindow was nestled inside a normal window, something the original author did. This was needed to use component.Oncompleted etc. Anyways, I changed the code to remove the top level window and now it's working :)
Thanks for your help anyway :)