example qmlscene tutorial2.qml:23 Cell is not a type

1,245 views
Skip to first unread message

Jackie Li

unread,
Oct 24, 2013, 10:10:11 AM10/24/13
to go-...@googlegroups.com
Hi,

I tried to run the example in qmlscene on windows: `qmlscene.exe tutorial2.qml`
C:\Users\hb19623\Gocode\src\github.com\niemeyer\qml\examples\qmlscene>qmlscene.exe tutorial2.qml
error: file:C:/Users/hb19623/Gocode/src/github.com/niemeyer/qml/examples/qmlscene/tutorial2.qml:23 Cell is not a type

I also tried to modify qml.go:134 to:
location = "file://" + filepath.ToSlash(filepath.Join(dir, location))

per instruction here:

but it didn't work... 

What is the problem here?

Thanks,
Jackie

Gustavo Niemeyer

unread,
Nov 4, 2013, 9:12:48 AM11/4/13
to Jackie Li, Go QML
Hi there,

I was hoping someone with better Windows knowledge than I do (which is
easy) would chime in.

That said, as any feedback is better than none, I don't really know
what's going on there. The Cell type is defined within Cell.qml in the
same directly, and is supposed to be imported automatically given its
presence in the same directory.

Have you had any luck with it since then? I may try to change the way
the path is defined to see if it helps.
> --
> You received this message because you are subscribed to the Google Groups
> "go-qml" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to go-qml+un...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.



--

gustavo @ http://niemeyer.net

Cecil New

unread,
Nov 5, 2013, 6:13:24 AM11/5/13
to go-...@googlegroups.com, Jackie Li
I had same error some time ago (see https://groups.google.com/forum/#!topic/go-qml/REimfRV10R0). Early on, externally defined components were not supported correctly, but this was fixed quickly.

Hopefully you have a resent version of the QML package?

Is the Cell object defined in separate file? if so, is it in the current directory where you execute the qmlscene command?

Jackie Li

unread,
Nov 5, 2013, 7:34:16 AM11/5/13
to Cecil New, go-...@googlegroups.com
Hi Cecil!

I made it working by inserting:
import "../qmlscene" as C
in tutorial2.qml and and use C.Cell for the Cell type


Thanks,
Jackie
--
Jackie

Gustavo Niemeyer

unread,
Nov 5, 2013, 9:12:45 AM11/5/13
to Jackie Li, Cecil New, Go QML
Cecil might be right: have you tried updating your source code? This
was the exact problem that was fixed weeks ago.

Jackie Li

unread,
Nov 5, 2013, 10:32:50 AM11/5/13
to Gustavo Niemeyer, Cecil New, Go QML
Yes, I updated the code minutes ago, and it was the same error, and I had to add that "import" line to make it work
--
Jackie

Ignazio Di Napoli

unread,
Nov 13, 2013, 7:51:51 AM11/13/13
to go-...@googlegroups.com
I have the same problem with everything downloaded and installed today.

Gustavo Niemeyer

unread,
Nov 13, 2013, 8:01:40 AM11/13/13
to Ignazio Di Napoli, Go QML
I'll see if I can do something to fix the issue. If that doesn't work,
we'll need a hand from someone that is sitting on Windows to
investigate the problem in more detail.

On Wed, Nov 13, 2013 at 10:51 AM, Ignazio Di Napoli <necl...@gmail.com> wrote:
> I have the same problem with everything downloaded and installed today.
>

Mark Saward

unread,
Mar 1, 2014, 1:04:58 AM3/1/14
to go-...@googlegroups.com, Ignazio Di Napoli
I have run into this problem too, trying to test things on windows.

I've had a look at qml.go, but can't seem to determine what might be causing the problem.  qml files should be loaded automatically from the working directory.  Am I right in thinking that it is QT C++ code that does the automatic searching of the folder for relevant files?

If so, it puzzles me that this would not work.  It tells me which line has a type it doesn't know about, which implies that it must have been able to locate that file.

Do you have any suggestions of what parts of the code I should look at in order to try and figure out what is going wrong?

Gustavo Niemeyer

unread,
Mar 1, 2014, 6:57:33 AM3/1/14
to Mark Saward, Go QML, Ignazio Di Napoli
Hey Mark,

On Sat, Mar 1, 2014 at 3:04 AM, Mark Saward <mdsa...@gmail.com> wrote:
> I have run into this problem too, trying to test things on windows.

Great, thanks for doing that.

> I've had a look at qml.go, but can't seem to determine what might be causing
> the problem. qml files should be loaded automatically from the working
> directory. Am I right in thinking that it is QT C++ code that does the
> automatic searching of the folder for relevant files?

That's right, and the problem is definitely in trying to get the URL
set in a way that QML is happy with. The way to do that on Windows is
probably not correct yet.

I've just made a change to Engine.Load in qml.go, so it properly uses
double-slashed file URLs. Can you please try again? If that doesn't
work, there's a small blob of commented code in that same function.
Would you be able to uncomment and run it? It'll not do anything
interesting, besides printing the location a couple of times. If the
initial change doesn't work, please let me know what these locations
are.


gustavo @ http://niemeyer.net

Mark Saward

unread,
Mar 1, 2014, 7:18:51 AM3/1/14
to go-...@googlegroups.com, Mark Saward, Ignazio Di Napoli
The output does not quite match the code you had, because I modified part of the code to also be:
        if filepath.IsAbs(location) {
            location = "file://" + filepath.ToSlash(location)
            fmt.Printf("Location abs: %q\n", location)
        } else {
            dir, err := os.Getwd()
            if err != nil {
                return nil, fmt.Errorf("cannot obtain absolute path: %v", err)

            }
            location = "file://" + filepath.ToSlash(filepath.Join(dir, location))
            fmt.Printf("Location not abs: %q\n", location)
        }

And with your lines uncommented, plus the above, the output was:
-----
C:\gopath\src\github.com\niemeyer\qml\examples\qmlscene>qmlscene.exe tutorial2.qml
location: tutorial2.qml
location: file:///C:/gopath/src/github.com/niemeyer/qml/examples/qmlscene/tutorial2.qml
Location abs: "file://C:/gopath/src/github.com/niemeyer/qml/examples/qmlscene/tutorial2.qml"
error: :23 Cell is not a type

C:\gopath\src\github.com\niemeyer\qml\examples\qmlscene>
-----

(might be a good 12+ hours before I can do any more tests)

Gustavo Niemeyer

unread,
Mar 1, 2014, 10:09:01 AM3/1/14
to Mark Saward, Go QML, Ignazio Di Napoli
Okay, I assume it did not work after tha change and without
uncommenting anything?

It might well be the extra slash that is missing on Windows. It looks
bogus, but we can add it if it fixes things. Have you tried just
adding one more slash so it matches the "Location abs:" line matches
the "location:" one?

Mark Saward

unread,
Mar 1, 2014, 5:31:42 PM3/1/14
to go-...@googlegroups.com, Mark Saward, Ignazio Di Napoli

Okay, I assume it did not work after tha change and without
uncommenting anything?

Correct.
 
It might well be the extra slash that is missing on Windows. It looks
bogus, but we can add it if it fixes things. Have you tried just
adding one more slash so it matches the "Location abs:" line matches
the "location:" one?

Just did now -- and it works!  So looks like adding in the third slash is the fix!  Tested it with qmlscene tutorial2 and with my own project, both of which weren't working but now do.

Reply all
Reply to author
Forward
0 new messages