Description
This component provides the main window for an meego-ux-components based application. The navigation structure is intended as follows:
- page: an AppPage resembling the basic display widget. Here you can display any content you like. The main window provides :an action context menu for each page which can be activated via the action menu icon in the toolbar. This action context menu offers text entries by :default, but can be completely customized if needed.
- book: a set of pages. Books have a first page from which you can reach all the others, either directly or via other pages in the book. The window :provides a page stack to manage them. Pages removed from the stack are destroyed.
- main window: displays the current page. The main window can switch between books via the book menu icon which provides a context menu displaying :all available books. Switching books resets the stack and displays the first page of the chosen book.
- To add books and pages to a window, set the model and a payload property:
- the model property is a list of strings which identify the books and are used as entries for the book context menu.
- the payload property is a list of indexes of the the main pages used to display them.
IMPORTANT:
The id of the applications main window must always be id: window
Otherwise the AppPages cannot link correctly.
API Properties
- string toolBarTitle
- Sets a label for the toolbar.
- bool showToolBarSearch
- Hides/shows the search bar.
- bool actionMenuActive
- Activates/deactivates the windowMenuButton
- variant bookMenuModel
- String list that sets the menu entry labels for the bookMenu.
- variant bookMenuPayload
- String list that sets the filenames for the books (their initial pages).
- alias actionMenuModel
- String list that sets the menu entry labels for the actionMenu.
- variant actionMenuPayload
- Sets payload for the actionMenu.
- bool fullScreen
- Hides the statusbar if true.
- bool fullContent
- Hides the statusbar and the toolbar if true.
- bool actionMenuActive
- Activates/Deactivates the windowMenuButton.
- int orientation
- The orientation the window is in. This property can be set manually.
- 1 = landscape
- 2 = portrait
- 3 = inverted landscape
- 4 = inverted portrait
- string lockOrientationIn
- This property can be used to lock the window in a given orientation. Possible values are:
- "landscape"
- "portrait"
- "invertedLandscape"
- "invertedPortrait"
- Every other value will unlock the orientation. Default is "".
- bool isOrientationLocked
- Indicates if oriention was locked.
- bool inLandscape
- True if the current orientation is landscape
- bool inPortrait
- True if the current orientation is portrait
- bool inInvertedLandscape
- True if the current orientation is inverted landscape
- bool inInvertedPortrait
- True if the current orientation is inverted portrait
- bool inhibitScreenSaver
- Inhibits activation of the screen saver.
- bool backButtonEnabled
- Inhibits if the backButton is enabled or not. if not enabled.
- Item overlayItem
- An item spanning over the whole content area where the AppPages are shown. Here you can add extra toolbars aplication wide for example.
- alias statusBar
- Convenience property to anchors something to the statusBar for example. Intended as read-only.
- alias toolBar
- Convenience property to anchors something to the toolBar for example. Intended as read-only.
- bool customActionMenu
- If enabled the own action context menu is not shown and the signal actionMenuIconClicked is emitted. This enables AppPages to use their completely own context menus.
- bool actionMenuPresent
- This notifies the action and bookmenu buttons if they should be in their 'pressed' state
Signals
- search
- Indicates that a search was started
- Parameters:
- string needle, the string to search for
- actionMenuIconClicked
- Provides the action menu context menu coordinate for custom action menus created by AppPages
- Parameters:
- int mouseX, the x coordinate where the click occurred
- int mouseY, the y coordinate where the click occurred
- actionMenuTriggered
- Notifies that the an Item in the action menu was selected
- Parameters:
- variant selectedItem, selected Item of the action menu
- orientationChangeAboutToStart
- Signals that a orientation change will come
- Parameters:
- string newOrientation, provides the new orientation
- string oldOrientation, provides the old orientation
- orientationChangeStarted
- Signals the start of the orientation change
- orientationChangeFinished
- Signales the end of the orientationChange
- Parameters:
- string newOrientation, provides the new orientation
- string oldOrientation, provides the old orientation
- orientationChanged
- Obsolete signal, will be triggered just as orientationChangeFinished.
Functions
- setBookMenuData
- Sets model and payload at once.
- Parameters:
- variant model, sets the book menus model
- variant payload, sets the book menus payload
- switchBook
- Clears the page stack and loads the page given as parameter. Usually you don't need to call that function at all if you just hand a proper model and payload to the bookContextMenu. But if you want to switch between books by other means, you can use this function.
- Parameters:
- AppPage pageComponent, first page of the selected book to switch to
- addPage
- Adds a page to the page stack and sets it as the current page.
- Parameters:
- AppPage pageComponent, page which sould be added
- popPage
- Pops a page to the page stack and sets the last page as the current page.
Example
Window {
id: window
bookMenuModel: [ qsTr("Page1") , qsTr("Page2") ]
bookMenuPayload: [ book1Component, book2Component ]
Component.onCompleted: {
console.log("load MainPage")
switchBook( book1Component )
}
Component { id: book1Component; Page1 {} }
Component { id: book2Component; Page2 {} }
}