2012-12-09 26 views
3

大約一個月前,我選擇了一個廢棄的Qt應用程序的開發。它幾乎完成,但我正面臨着一個我無法解決的錯誤。 當我模擬應用程序,一切工作正常,都作爲景觀肖像。但是,當我在諾基亞BElle刷新(Qt 4.8)上運行的諾基亞E7-00上安裝應用程序時,橫向模式會中斷。 有沒有解決這個問題的方法? 我發現了一個描述類似問題的主題,但沒有找到真正的解決方案。風景模式損壞,顯示不正確

關於QmlApplicationViewer在main.cpp中的代碼:

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

不知道是什麼原因,但你main.qml是奇怪... PageStackWindow已經是一個窗口,爲什麼你用另一個窗口包裝它?嘗試刪除窗口並使用PageStackWindow作爲main.qml中的最高級別 – Dickson

+0

@Dickson我嘗試了它,並通過一些小調整,我修復了它!謝謝你的幫助!沒有真正注意到這一點,因爲它總是這樣,因爲當我繼續應用程序,並且原始開發人員需要此爲component.onCompleted。順便說一句,這是固定的,但我不能標記你的答案爲答案? – Bertware

+0

@Bertware你不能接受答案,因爲它不是一個答案,而是一個評論。 Dickson應該複製粘貼它作爲答案,你可以自己做,然後接受你自己的答案,將問題標記爲答案。 – hyde

回答

0

不知道是什麼原因,但你的main.qml是奇怪的... PageStackWindow已經是一個窗口,爲什麼你用另一個窗口包裝它?嘗試刪除窗口和main.qm使用PageStackWindow作爲頂級

(答案由@Dickson評論)