横向模式损坏,显示不正确

时间:2012-12-09 15:51:03

标签: qt4 symbian qml nokia

我在一个月前接受了一个废弃的Qt应用程序的开发。它几乎完成了,但我面临一个我无法修复的错误。 当我模拟应用程序时,一切正常,画像都是风景。但是,当我在运行诺基亚美女刷新(Qt 4.8)的诺基亚E7-00上安装应用程序时,横向模式会中断。 这有什么解决方案吗? 我发现了一个描述类似问题的主题,但没有找到真正的解决方案。

有关main.cpp中的QmlApplicationViewer的代码:

QScopedPointer<QmlApplicationViewer> tQmlApplicationViewer(QmlApplicationViewer::create());
tQmlApplicationViewer->setResizeMode(QDeclarativeView::SizeRootObjectToView);

// Load the QML entrypoint
tQmlApplicationViewer->setMainQmlFile(QLatin1String("qml/BeTrains/main.qml"));

tQmlApplicationViewer->showFullScreen();

main.qml中的代码

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
    }
}

最后一个文本对象用于测试目的,它按原样旋转... 显示问题的图片:

(我无法嵌入图片,所以这里是链接:http://i.stack.imgur.com/LXsxe.jpg

模拟器结果在左侧,屏幕截图来自我右边的E7。问题以红色圈出。

1 个答案:

答案 0 :(得分:0)

不确定是什么原因但你的main.qml很奇怪... PageStackWindow已经是一个Window,为什么用另一个Window包装它?尝试删除Window并使用PageStackWindow作为main.qm中的顶级

(由@Dickson评论回答)

相关问题