Reply
Thread Tools
Posts: 3,328 | Thanked: 4,476 times | Joined on May 2011 @ Poland
#21
Is there a prebuilt "OK" dialog in qml, like this: http://www.roseindia.net/java/exampl...eDialogBox.gif
?
Thanks in advance

EDIT: QueryDialog seems to work great.
__________________
If you want to support my work, you can donate by PayPal or Flattr

Projects no longer actively developed: here

Last edited by marmistrz; 2012-07-08 at 13:30.
 
Posts: 3,328 | Thanked: 4,476 times | Joined on May 2011 @ Poland
#22
Hi,
I want the selecttrack Button to hide when a checkbox isn't checked. my code is:
Code:
import QtQuick 1.0
import org.maemo.fremantle 1.0

Page
{
    id: mainPage
    tools: toolbar
    Column
    {

        signal tracksrcChanged(bool state)
        width: parent.width
        CheckBox
        {
            id: tracksrc
            text: "Select track from library" // label isn't needed with PageStackWindow
            checked: true
            //checkable: true

            onClicked:
            {
               mainPage.tracksrcChanged(checked)
            }
        }

        Label
        {
            id: selecttracklabel
            text: "Selected track"
        }
        Button
        {
            id: selecttrack
            text: "No track selected"
            checkable: false
            width: screenwidth
            onClicked:
            {
                console.log("Select track button clicked")
                pageStack.push(Qt.resolvedUrl("SelectTrackPage.qml"))
            }
            onTracksrcChanged:
            {
                ( state == true ) ? this.show()  :this.hide()
            }
        }
        Button
        {
            id: lyricssrcbutton
            text: lyricssrcdialog.model.get(lyricssrcdialog.selectedIndex).name
            width: screenwidth
            onClicked: { lyricssrcdialog.open(); }
        }

        Button
        {
            id: go
            text: "Go!"
            width: screenwidth
            onClicked:
            {
               console.log("Go! button clicked")
               pageStack.push(Qt.resolvedUrl("ShowLyricsPage.qml"))
            }
        }
    }
    SelectionDialog
    {
        id: lyricssrcdialog
        titleText: "Download source"
        selectedIndex: 0
        model: ListModel
        {
            ListElement { name: "AZLyrics" }
        }
    }
    OKDialog
    {
        id: notimplementeddialog
        message: "Sorry, not implemented yet!"
    }
}
I'm getting error
Code:
 .../MainPage.qml:42:13: Cannot assign to non-existent property onTracksrcChanged:
What am I doing wrong?
__________________
If you want to support my work, you can donate by PayPal or Flattr

Projects no longer actively developed: here
 
nicolai's Avatar
Posts: 1,637 | Thanked: 4,424 times | Joined on Apr 2009 @ Germany
#23
tracksrcChanged is a signal in Column
you can not access it within
Code:
Button {
id: selecttrack
onTracksrcChanged { ...
}
the onTracksrcChanged would work, only if trackSrcChanged is a property of
selecttrack

The easier solution would be:
Code:
Button
        {
            id: selecttrack
            text: "No track selected"
            checkable: false
            width: screenwidth
            visible:tracksrc.checked
            onClicked:
            {
                console.log("Select track button clicked")
                pageStack.push(Qt.resolvedUrl("SelectTrackPage.qml"))
            }
}
 

The Following User Says Thank You to nicolai For This Useful Post:
Posts: 3,328 | Thanked: 4,476 times | Joined on May 2011 @ Poland
#24
Originally Posted by nicolai View Post
tracksrcChanged is a signal in Column
you can not access it within
Code:
Button {
id: selecttrack
onTracksrcChanged { ...
}
the onTracksrcChanged would work, only if trackSrcChanged is a property of
selecttrack

The easier solution would be:
Code:
Button
        {
            id: selecttrack
            text: "No track selected"
            checkable: false
            width: screenwidth
            visible:tracksrc.checked
            onClicked:
            {
                console.log("Select track button clicked")
                pageStack.push(Qt.resolvedUrl("SelectTrackPage.qml"))
            }
}
Thanks.
I've got one more question: is there something like vertical spacer in QML, so that I don't have to hardcore any pixel heights?
__________________
If you want to support my work, you can donate by PayPal or Flattr

Projects no longer actively developed: here
 
Posts: 324 | Thanked: 371 times | Joined on Dec 2009 @ Vancouver, BC
#25
Originally Posted by marmistrz View Post
Thanks.
I've got one more question: is there something like vertical spacer in QML, so that I don't have to hardcore any pixel heights?
You can use Rectangles, or Items.
 
Posts: 3,328 | Thanked: 4,476 times | Joined on May 2011 @ Poland
#26
Originally Posted by Slocan View Post
You can use Rectangles, or Items.
But then I'll have to specify the height. And I want the spacer to automatically detect the space to take


Originally Posted by nicolai View Post
tracksrcChanged is a signal in Column
you can not access it within
Code:
Button {
id: selecttrack
onTracksrcChanged { ...
}
the onTracksrcChanged would work, only if trackSrcChanged is a property of
selecttrack

The easier solution would be:
Code:
Button
        {
            id: selecttrack
            text: "No track selected"
            checkable: false
            width: screenwidth
            visible:tracksrc.checked
            onClicked:
            {
                console.log("Select track button clicked")
                pageStack.push(Qt.resolvedUrl("SelectTrackPage.qml"))
            }
}
Is it possible to specify an animation for this?
__________________
If you want to support my work, you can donate by PayPal or Flattr

Projects no longer actively developed: here
 
Posts: 3,328 | Thanked: 4,476 times | Joined on May 2011 @ Poland
#27
Which component should I use to have look as used in the MeeGo Settings control panel?

How can I get the default height of a button?
thanks in advance
__________________
If you want to support my work, you can donate by PayPal or Flattr

Projects no longer actively developed: here

Last edited by marmistrz; 2012-07-17 at 08:53.
 
Posts: 324 | Thanked: 371 times | Joined on Dec 2009 @ Vancouver, BC
#28
Originally Posted by marmistrz View Post
But then I'll have to specify the height. And I want the spacer to automatically detect the space to take
Not if you use relative height (something like height: screen.height-otherstuff.height)

Originally Posted by marmistrz View Post
Is it possible to specify an animation for this?
Yes, look up one of the examples on how to create animations on property changes. You probably want to use the animation on opacity from 0 to 1, or on height.

Originally Posted by marmistrz View Post
How can I get the default height of a button?
I think it's in ButtonStyle object.
 

The Following User Says Thank You to Slocan For This Useful Post:
Posts: 3,328 | Thanked: 4,476 times | Joined on May 2011 @ Poland
#29
Originally Posted by Slocan View Post
Not if you use relative height (something like height: screen.height-otherstuff.height)

Yes, look up one of the examples on how to create animations on property changes. You probably want to use the animation on opacity from 0 to 1, or on height.

I think it's in ButtonStyle object.
Is it possible to use ButtonStyle without creating any object (as if these were static properties)?

I have another problem.

I have this class:

Code:
typedef QString lyricsDownloaderString;

class lyricsDownloader : public QObject
{
public:
    Q_INVOKABLE virtual short perform() = 0;
    Q_INVOKABLE inline void setData(const string & a, const string & t); // set artist and track
 // some other data

protected:
    lyricsDownloader(const string & a, const string & t ) : artist(a), track(t) {} 
  /*other data*/
};

class AZLyricsDownloader : public lyricsDownloader
{
public:
    AZLyricsDownloader() : lyricsDownloader("", "") {}
    AZLyricsDownloader(const string & a, const string & t) : lyricsDownloader(a, t) {}
    Q_INVOKABLE short perform();
    Q_INVOKABLE inline void setData(const string & a, const string & t);// set artist and track
 /*other data*/
In main.cpp
Code:
Q_DECL_EXPORT int main(int argc, char *argv[])
{
        QApplication app(argc, argv);

        mainWindow viewer;

        qmlRegisterUncreatableType<lyricsDownloader>("MaeLyrica", 1, 0, "lyricsDownloader", "");
        qmlRegisterType<AZLyricsDownloader>("MaeLyrica", 1, 0, "AZLyricsDownloader");
        viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto);
        viewer.setMainQmlFile(QLatin1String("qml/maelyrica/main.qml"));
        viewer.showFullScreen();

        return app.exec();
}
in main.qml

Code:
import QtQuick 1.1
import com.nokia.meego 1.0
import com.nokia.extras 1.0
import MaeLyrica 1.0

//property color fontcolor: "white"

PageStackWindow
{
    id: pagestackwindow
    visible: true
    MainPage
    {
        id: mainview
    }
    initialPage: mainview
    AZLyricsDownloader
    {
        id: azdownloader
    }
}
And in one of the pages

Code:
import QtQuick 1.1
import com.nokia.meego 1.0

Page
{
 /*some gui elements*/

        Button
        {
            id: go
            text: "Go!"
            width: parent.width
            onClicked:
            {
                goLoader.source = "ShowLyricsPage.qml"
                pageStack.push(goLoader.item)
                azdownloader.perform()
                showLyricsPage.busyind.visible = false
            }
        }
    }
/*dialogs and toolbar definitions*/
}
Code:
import QtQuick 1.1
import com.nokia.meego 1.0

Sheet {
    id: sheet

    acceptButtonText: "Save"
    rejectButtonText: "Cancel"
    onAccepted:
    {
        if ( artistfield.text == "" || trackfield.text == "" ) // check whether empty
        {
            emptyfieldsdialog.open()
        }
        else
        {
            selecttrack.text = artistfield.text + " - " + trackfield.text
            azdownloader.setData(artistfield.text, trackfield.text)
        }
    }

    content: Rectangle { /*some content here*/ }

    /*dialog definition*/
Although I marked functions as Q_INVOKABLE, I'm getting
Code:
TypeError: Result of expression 'azdownloader.setData' is not a function
TypeError: Result of expression 'azdownloader.perform' is not a function
What am I doing wrong?

EDIT: I forgot to add Q_OBJECT macro
__________________
If you want to support my work, you can donate by PayPal or Flattr

Projects no longer actively developed: here

Last edited by marmistrz; 2012-07-18 at 17:17.
 
Reply


 
Forum Jump


All times are GMT. The time now is 20:44.