Results 1 to 7 of 7

Thread: How to add forms(.ui file) to a QGraphicScene background

  1. #1
    Join Date
    Dec 2008
    Posts
    52
    Thanks
    3
    Qt products
    Qt4

    Default How to add forms(.ui file) to a QGraphicScene background

    Hi,
    I have a application where there is a scene(QGraphicsScene) by using toolbox we can add items to scene. I have designed two forms(hwidget.ui, vwidget.ui) now i want to add these two to scene background, how can i do this.

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

    Default Re: How to add forms(.ui file) to a QGraphicScene background

    You can only add them as items, not into the background layer. Create widgets out of them and use QGraphicsScene::addWidget().

  3. #3
    Join Date
    Dec 2008
    Posts
    52
    Thanks
    3
    Qt products
    Qt4

    Default Re: How to add forms(.ui file) to a QGraphicScene background

    ya i have tried like that but addWidget( ) accepts QWidget object.and i have only designed two forms (hwidget.ui and vwidget.ui) do i need to create any class for that.

  4. #4
    Join Date
    Sep 2008
    Location
    Bangalore
    Posts
    659
    Thanks
    116
    Thanked 42 Times in 41 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to add forms(.ui file) to a QGraphicScene background

    try
    QGraphicsProxyWidget to ur application

  5. #5
    Join Date
    Jan 2008
    Location
    Poland
    Posts
    687
    Thanks
    4
    Thanked 140 Times in 132 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: How to add forms(.ui file) to a QGraphicScene background

    Quote Originally Posted by c_srikanth1984 View Post
    ya i have tried like that but addWidget( ) accepts QWidget object.and i have only designed two forms (hwidget.ui and vwidget.ui) do i need to create any class for that.
    Yes, you have to create an widget object first. Try QUiLoader. As I see in docs, it's the thing you need, but I've never tried it for myself.
    I would like to be a "Guru"

    Useful hints (try them before asking):
    1. Use Qt Assistant
    2. Search the forum

    If you haven't found solution yet then create new topic with smart question.

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

    Default Re: How to add forms(.ui file) to a QGraphicScene background

    Quote Originally Posted by faldżip View Post
    Yes, you have to create an widget object first. Try QUiLoader. As I see in docs, it's the thing you need, but I've never tried it for myself.
    I would advise against it. Either create proper classes based on those forms or use the direct approach which might be simpler in your case. Both are described in Using a Component in Your Application

  7. The following user says thank you to wysota for this useful post:

    c_srikanth1984 (30th January 2009)

  8. #7
    Join Date
    Dec 2008
    Posts
    52
    Thanks
    3
    Qt products
    Qt4

    Default Re: How to add forms(.ui file) to a QGraphicScene background

    I could add my hwidget.ui and vwidget.ui to my scene background using this direct approch.
    thank u.

Similar Threads

  1. Set up the Qt4.3.2 with Visual Studio 2005
    By lamoda in forum Installation and Deployment
    Replies: 6
    Last Post: 30th January 2008, 06:51
  2. background attribute & url to file
    By Flakes in forum Qt Tools
    Replies: 6
    Last Post: 24th January 2008, 13:04
  3. qt-3.3.8 fail in scratchbox
    By nass in forum Installation and Deployment
    Replies: 0
    Last Post: 25th May 2007, 15:21
  4. [QT3 with XP] .png file as background to a form
    By incapacitant in forum Newbie
    Replies: 2
    Last Post: 10th February 2006, 21:20

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.