maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Development (https://talk.maemo.org/forumdisplay.php?f=13)
-   -   QML and SelectionDialog [and other QML-related questions] (https://talk.maemo.org/showthread.php?t=85113)

ajalkane 2012-07-03 12:18

Re: QML and SelectionDialog
 
Quote:

Originally Posted by marmistrz (Post 1230727)
Wait... Does Item require x,y coordinates? It may be why it's a blank screen. As putting any component in a Rectangle caused not showing up of this component.

It does not require x/y co-ordinates, but of course it has basically no width/height if you don't specify them. It can be a problem if its descendants use indirectly the Item's width/height to calculate their size.

marmistrz 2012-07-03 18:15

Re: QML and SelectionDialog
 
Quote:

Originally Posted by ajalkane (Post 1230740)
It does not require x/y co-ordinates, but of course it has basically no width/height if you don't specify them. It can be a problem if its descendants use indirectly the Item's width/height to calculate their size.

Is there any way I can tell the Rectangle to occupy the maximum size (as it's with Column only), so that in landscape N900 it'll be 800x480, portrait N900 480x800, portrait N9 480x854 and so on?

ajalkane 2012-07-03 18:36

Re: QML and SelectionDialog
 
Quote:

Originally Posted by marmistrz (Post 1231147)
Is there any way I can tell the Rectangle to occupy the maximum size (as it's with Column only), so that in landscape N900 it'll be 800x480, portrait N900 480x800, portrait N9 480x854 and so on?

I don't know about N900, but for N9 see the QML Window component's sources on how to do it. Here's its documentation:

http://harmattan-dev.nokia.com/docs/...go-window.html

marmistrz 2012-07-03 19:23

Re: QML and SelectionDialog
 
Quote:

Originally Posted by ajalkane (Post 1231168)
I don't know about N900, but for N9 see the QML Window component's sources on how to do it. Here's its documentation:

http://harmattan-dev.nokia.com/docs/...go-window.html

I think it's what I'm looking for, as I plan to release my programs not only for N900 but for N9 too.

But somehow the hildon status menu is still shown. changing showExpanded() to showMaximized() doesn't work.

thanks in advance.

Here's my main.qml
Code:

import QtQuick 1.0
import org.maemo.fremantle 1.0

//property color fontcolor: "white"

PageStackWindow
{
    property color fontcolor: "white"
    initialPage: Component
    {
        Column
        {
            Row
            {
                width: parent.width
                CheckBox
                {
                    id: tracksrc
                    //text: "Select track from library"
                    checked: true
                    //checkable: true
                }
                Label
                {
                    id: tracksrcText
                    text: "Select track from library"
                    anchors.verticalCenter: tracksrc.verticalCenter
                    color: fontcolor
                }
            }

            Label
            {
                id: selecttracklabel
                text: "Selected track"
                color: fontcolor
            }
            Button
            {
                id: selecttrack
                text: "No track selected"
                checkable: false
                width: parent.width
                onClicked:
                {

                }
            }

            SelectionDialog
            {
                id: lyricssrcdialog
                titleText: "Download source"
                selectedIndex: 0
                model: ListModel
                {
                    ListElement { name: "AZLyrics" }
                }
            }
            Button
            {
                id: lyricssrcbutton
                text: lyricssrcdialog.model.get(lyricssrcdialog.selectedIndex).name
                width: parent.width
                onClicked: { lyricssrcdialog.open(); }
            }

            Button
            {
                id: go
                text: "Go!"
                width: parent.width
            }
        }
    }
}


ajalkane 2012-07-03 20:32

Re: QML and SelectionDialog
 
Quote:

Originally Posted by marmistrz (Post 1231211)
I think it's what I'm looking for, as I plan to release my programs not only for N900 but for N9 too.

But somehow the hildon status menu is still shown. changing showExpanded() to showMaximized() doesn't work.

I'm not familiar with Fremantle, but on Harmattan PageStackWindow's showStatusBar property should do the trick:

Code:

PageStackWindow
{
    showStatusBar: false
    ...
}

In C++ showFullScreen() should be called.

marmistrz 2012-07-04 08:55

Re: QML and SelectionDialog
 
Quote:

Originally Posted by ajalkane (Post 1231278)
I'm not familiar with Fremantle, but on Harmattan PageStackWindow's showStatusBar property should do the trick:

Code:

PageStackWindow
{
    showStatusBar: false
    ...
}

In C++ showFullScreen() should be called.

OK. I'm starting to work it out. showStatusBar should be true, and only showFullScreen() in C++.
Is there any way I set the width of the buttons to be resized as the screen rotates? With Column only I set
Code:

width: parent.width
But with PageStackWindow the width is set well only after clicking the button pointing to the SelectionDialog. And
Code:

screen.width
is always 800 even after rotation (then it should be 480)

marmistrz 2012-07-04 13:48

Re: QML and SelectionDialog
 
Quote:

Originally Posted by marmistrz (Post 1231594)
OK. I'm starting to work it out. showStatusBar should be true, and only showFullScreen() in C++.
Is there any way I set the width of the buttons to be resized as the screen rotates? With Column only I set
Code:

width: parent.width
But with PageStackWindow the width is set well only after clicking the button pointing to the SelectionDialog. And
Code:

screen.width
is always 800 even after rotation (then it should be 480)


I finally worked it out with
Code:

    property int screenwidth: (screen.currentOrientation == Screen.Landscape) ? screen.displayWidth : screen.displayHeight
But I've got another problem. I want to divide the program into multiple files but
Files are:
main.qml - the main one, only PageStackWindow
mainView.qml - Page used by main.qml

And I'm getting
Code:

Can't find variable: mainView
I tried importing
Code:

import "."
import "mainView.qml"
import "mainView.qml" as mainView

But nothing works.
thanx in advance

nicolai 2012-07-04 13:59

Re: QML and SelectionDialog
 
No need to import your own qml-file
as long as it is in the same directory.
How does your main.qml file looks like?
The one with the pagestackwindow
must have set the initialPage property.

Here is a simple example
http://harmattan-dev.nokia.com/docs/...etutorial.html

ajalkane 2012-07-04 20:41

Re: QML and SelectionDialog
 
Quote:

Originally Posted by marmistrz (Post 1231767)
But I've got another problem. I want to divide the program into multiple files but
Files are:
main.qml - the main one, only PageStackWindow
mainView.qml - Page used by main.qml

And I'm getting
Code:

Can't find variable: mainView
I tried importing
Code:

import "."
import "mainView.qml"
import "mainView.qml" as mainView

But nothing works.
thanx in advance

You should rename it to MainView.qml. Remove the imports, they're automatically imported. But the naming is important, ie. capital start letter.

So after that you can use it in main.qml like:

Code:

PageStackWindow {
  ...
  MainView {
    ...
  }
}


marmistrz 2012-07-05 09:34

Re: QML and SelectionDialog
 
Quote:

Originally Posted by ajalkane (Post 1232024)
You should rename it to MainView.qml. Remove the imports, they're automatically imported. But the naming is important, ie. capital start letter.

So after that you can use it in main.qml like:

Code:

PageStackWindow {
  ...
  MainView {
    ...
  }
}


OK, thanks for help. Seems that I used it wrong (as if it was #include and extern declaration in C++), thinking it was already declared.


All times are GMT. The time now is 07:33.

vBulletin® Version 3.8.8