Using qt ruby

Discussion in 'Ruby' started by flukus@gmail.com, Jun 18, 2008.

  1. Guest

    I'm not particularly new to ruby or QT but I'm having trouble getting
    the two to work nicely together.

    I have a TextEdit and I'm trying to call setExtraSelections on it.
    when I use the getter I get the error:

    "Cannot handle 'QList<QTextEdit::ExtraSelection>' as return-type of
    QTextEdit::extraSelections (ArgumentError)"

    And likewise with the setter:

    "Cannot handle 'const QList<QTextEdit::ExtraSelection>&' as argument
    of QTextEdit::setExtraSelections"

    So how do you deal with Qlists in ruby?


    Also a few more general questions, please feel free to point me
    somewhere with answers like these but I searched long and hard and
    couldn't find any.

    Is there an API reference somewhere with rubyized method lists etc?
    For instance it took alot of reading and searching to find out the qts
    ExtraSelection class should be an OpenStruct.

    Any there any more gotchas like the qlist above and how enums are
    passed as ints?

    Any good documentation anywhere, what I could find online was very
    lacking and alot of google searches just turn up change logs.
    , Jun 18, 2008
    #1
    1. Advertising

  2. On Wednesday 18 June 2008, wrote:
    > I'm not particularly new to ruby or QT but I'm having trouble getting
    > the two to work nicely together.
    >
    > I have a TextEdit and I'm trying to call setExtraSelections on it.
    > when I use the getter I get the error:
    >
    > "Cannot handle 'QList<QTextEdit::ExtraSelection>' as return-type of
    > QTextEdit::extraSelections (ArgumentError)"
    >
    > And likewise with the setter:
    >
    > "Cannot handle 'const QList<QTextEdit::ExtraSelection>&' as argument
    > of QTextEdit::setExtraSelections"
    >
    > So how do you deal with Qlists in ruby?
    >
    >
    > Also a few more general questions, please feel free to point me
    > somewhere with answers like these but I searched long and hard and
    > couldn't find any.
    >
    > Is there an API reference somewhere with rubyized method lists etc?
    > For instance it took alot of reading and searching to find out the qts
    > ExtraSelection class should be an OpenStruct.
    >
    > Any there any more gotchas like the qlist above and how enums are
    > passed as ints?
    >
    > Any good documentation anywhere, what I could find online was very
    > lacking and alot of google searches just turn up change logs.


    Which version of QtRuby are you using? I'm using an old version from KDE4 svn
    (I think it's more or less a month old) and I can create a new ExtraSelection,
    but my test application crashes when I try to call
    Qt::TextEditor.set_extra_selections. At any rate, I suggest you to post this
    questions on the Qt/Korundum forum
    (http://rubyforge.org/forum/forum.php?forum_id=723).

    As for the documentation, I think you're right, there's not much information
    about differences between QtRuby and C++ Qt. Yet, there aren't that many
    differences (at least in my opinion).

    By the way, I don't think ExtraSelection s should be OpenStruct s. At least in
    the version I use, they're instances of Qt::TextEditor::ExtraSelection, just
    as in C++. And as far as lists are concerned, I think they're always treated
    as ruby Array s.

    I hope this helps

    Stefano
    Stefano Crocco, Jun 18, 2008
    #2
    1. Advertising

  3. Guest

    On Jun 18, 1:12 pm, Stefano Crocco <> wrote:
    > On Wednesday 18 June 2008, wrote:
    >
    >
    >
    > > I'm not particularly new to ruby or QT but I'm having trouble getting
    > > the two to work nicely together.

    >
    > > I have a TextEdit and I'm trying to call setExtraSelections on it.
    > > when I use the getter I get the error:

    >
    > > "Cannot handle 'QList<QTextEdit::ExtraSelection>' as return-type of
    > > QTextEdit::extraSelections (ArgumentError)"

    >
    > > And likewise with the setter:

    >
    > > "Cannot handle 'const QList<QTextEdit::ExtraSelection>&' as argument
    > > of QTextEdit::setExtraSelections"

    >
    > > So how do you deal with Qlists in ruby?

    >
    > > Also a few more general questions, please feel free to point me
    > > somewhere with answers like these but I searched long and hard and
    > > couldn't find any.

    >
    > > Is there an API reference somewhere with rubyized method lists etc?
    > > For instance it took alot of reading and searching to find out the qts
    > > ExtraSelection class should be an OpenStruct.

    >
    > > Any there any more gotchas like the qlist above and how enums are
    > > passed as ints?

    >
    > > Any good documentation anywhere, what I could find online was very
    > > lacking and alot of google searches just turn up change logs.

    >
    > Which version of QtRuby are you using? I'm using an old version from KDE4 svn
    > (I think it's more or less a month old) and I can create a new ExtraSelection,
    > but my test application crashes when I try to call
    > Qt::TextEditor.set_extra_selections. At any rate, I suggest you to post this
    > questions on the Qt/Korundum forum
    > (http://rubyforge.org/forum/forum.php?forum_id=723).
    >
    > As for the documentation, I think you're right, there's not much information
    > about differences between QtRuby and C++ Qt. Yet, there aren't that many
    > differences (at least in my opinion).
    >
    > By the way, I don't think ExtraSelection s should be OpenStruct s. At least in
    > the version I use, they're instances of Qt::TextEditor::ExtraSelection, just
    > as in C++. And as far as lists are concerned, I think they're always treated
    > as ruby Array s.
    >
    > I hope this helps
    >
    > Stefano

    I changed ExtraSelection to a Ruby Struct for the QtRuby 1.4.10
    release, but the QList marshaller for it doesn't work. So I've just
    made it an ordinary QtRuby class again in the svn, and added a
    marshaller that works. So it will be fixed in the next release of
    QtRuby.

    I'm hoping to add some docs about QtRuby on the KDE TechBase wiki in
    the next month or two, as details about the Qt4 version are a bit
    lacking online I'm afraid.

    -- Richard
    , Jun 18, 2008
    #3
  4. Guest

    On Jun 19, 2:38 am, ""
    <> wrote:
    > On Jun 18, 1:12 pm, Stefano Crocco <> wrote:
    >
    > > On Wednesday 18 June 2008, wrote:

    >
    > > > I'm not particularly new to ruby or QT but I'm having trouble getting
    > > > the two to work nicely together.

    >
    > > > I have a TextEdit and I'm trying to call setExtraSelections on it.
    > > > when I use the getter I get the error:

    >
    > > > "Cannot handle 'QList<QTextEdit::ExtraSelection>' as return-type of
    > > > QTextEdit::extraSelections (ArgumentError)"

    >
    > > > And likewise with the setter:

    >
    > > > "Cannot handle 'const QList<QTextEdit::ExtraSelection>&' as argument
    > > > of QTextEdit::setExtraSelections"

    >
    > > > So how do you deal with Qlists in ruby?

    >
    > > > Also a few more general questions, please feel free to point me
    > > > somewhere with answers like these but I searched long and hard and
    > > > couldn't find any.

    >
    > > > Is there an API reference somewhere with rubyized method lists etc?
    > > > For instance it took alot of reading and searching to find out the qts
    > > > ExtraSelection class should be an OpenStruct.

    >
    > > > Any there any more gotchas like the qlist above and how enums are
    > > > passed as ints?

    >
    > > > Any good documentation anywhere, what I could find online was very
    > > > lacking and alot of google searches just turn up change logs.

    >
    > > Which version of QtRuby are you using? I'm using an old version from KDE4 svn
    > > (I think it's more or less a month old) and I can create a new ExtraSelection,
    > > but my test application crashes when I try to call
    > > Qt::TextEditor.set_extra_selections. At any rate, I suggest you to post this
    > > questions on the Qt/Korundum forum
    > > (http://rubyforge.org/forum/forum.php?forum_id=723).

    >
    > > As for the documentation, I think you're right, there's not much information
    > > about differences between QtRuby and C++ Qt. Yet, there aren't that many
    > > differences (at least in my opinion).

    >
    > > By the way, I don't think ExtraSelection s should be OpenStruct s. At least in
    > > the version I use, they're instances of Qt::TextEditor::ExtraSelection, just
    > > as in C++. And as far as lists are concerned, I think they're always treated
    > > as ruby Array s.

    >
    > > I hope this helps

    >
    > > Stefano

    >
    > I changed ExtraSelection to a Ruby Struct for the QtRuby 1.4.10
    > release, but the QList marshaller for it doesn't work. So I've just
    > made it an ordinary QtRuby class again in the svn, and added a
    > marshaller that works. So it will be fixed in the next release of
    > QtRuby.
    >
    > I'm hoping to add some docs about QtRuby on the KDE TechBase wiki in
    > the next month or two, as details about the Qt4 version are a bit
    > lacking online I'm afraid.
    >
    > -- Richard


    THanks.

    So theres no marshaller that works in 1.4.9?

    with a bit of trial and error I found the method was an accesor called
    extra_selections.
    , Jun 19, 2008
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    0
    Views:
    202
  2. anne001
    Replies:
    1
    Views:
    391
  3. Phrogz
    Replies:
    4
    Views:
    216
    Austin Ziegler
    Sep 6, 2006
  4. roschler
    Replies:
    0
    Views:
    174
    roschler
    Oct 16, 2006
  5. George  Moschovitis

    Using ruby-openid/ruby-yadis w/o ruby gems

    George Moschovitis, Mar 10, 2007, in forum: Ruby
    Replies:
    1
    Views:
    120
    George Moschovitis
    Mar 11, 2007
Loading...

Share This Page