Results 1 to 20 of 26

Thread: Use own Class in some Qt class

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Feb 2013
    Posts
    29
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows Android

    Default Use own Class in some Qt class

    Hi,
    I start with example: i have for example QQuickView class and i want set my own instance of QQuickItem but how i know one way:
    implement own instance of QQuickView class and use own QQuickItem class. This is hard way and only way or is there some another way to do this?

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,017 Times in 4,793 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Use own Class in some Qt class

    Please rephrase your question. It is hard to make out what you want.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Use own Class in some Qt class

    Indeed hard to understand the problem, but my guess is you are looking for qmlRegisterType()?

    Cheers,
    _

  4. #4
    Join Date
    Feb 2013
    Posts
    29
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows Android

    Default Re: Use own Class in some Qt class

    ok i want use my own instance of QQuickItem in QQuickView. For example:
    I make my class MyItem - public class Item : public QQuickItem
    QQuickView *view = new QQuickView();
    view->rootObject->itemsChild(); and i want that this will return QList<MyItem> items;

  5. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,017 Times in 4,793 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Use own Class in some Qt class

    Do you mean that you want to be able to put instances of your MyItem class into QtQuick scene or that all items in the scene are MyItem instances instead of QQuickItem instances?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  6. #6
    Join Date
    Feb 2013
    Posts
    29
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows Android

    Default Re: Use own Class in some Qt class

    all items in the scene are MyItem instances instead of QQuickItem instances
    this is waht i want, sorry for hard understanding but i realy didn't know how say it

  7. #7
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,017 Times in 4,793 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Use own Class in some Qt class

    In that case that is not possible. Why do you want that?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  8. #8
    Join Date
    Feb 2013
    Posts
    29
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows Android

    Default Re: Use own Class in some Qt class

    Because when i did one program i wanted to storage friend QQuickItem. I this case i have to use objectUserData method, but i think if i make own class it will much better but this is only one example this happen me few times

  9. #9
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,017 Times in 4,793 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Use own Class in some Qt class

    Quote Originally Posted by Ichi View Post
    Because when i did one program i wanted to storage friend QQuickItem.
    I don't understand what it means.

    I this case i have to use objectUserData method
    Why do you have to use that method (whatever it is)? And what does QQuickItem have to do with this?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  10. #10
    Join Date
    Feb 2013
    Posts
    29
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows Android

    Default Re: Use own Class in some Qt class

    In this program every QquickItem has friends. And i need to get this friend. But i can't call function which get friends every time when i need it so it is comfortable when you can customise this class

  11. #11
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,017 Times in 4,793 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Use own Class in some Qt class

    Quote Originally Posted by Ichi View Post
    In this program every QquickItem has friends.
    What friends?

    But i can't call function which get friends every time when i need it so it is comfortable when you can customise this class
    I'm sorry, I don't understand you. I'm afraid I can't help.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  12. #12
    Join Date
    Feb 2013
    Posts
    29
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows Android

    Default Re: Use own Class in some Qt class

    ok i think it doesn't matter what friend or whatever.
    i simply wanted customise this class because in some cases it is much comfortable, i wanted add 2 or 3 methods this is all.

Similar Threads

  1. show object (scene) in widget in class class mainwindow
    By rimie23 in forum Qt Programming
    Replies: 8
    Last Post: 1st May 2012, 16:15
  2. Replies: 1
    Last Post: 20th January 2012, 04:39
  3. Replies: 7
    Last Post: 18th August 2011, 14:43
  4. Replies: 3
    Last Post: 27th December 2008, 19:34
  5. Replies: 3
    Last Post: 16th May 2007, 11:07

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.