Results 1 to 4 of 4

Thread: One Ui Form for multi classes

  1. #1
    Join Date
    Jan 2008
    Posts
    91
    Thanks
    8

    Default One Ui Form for multi classes

    Dear Qt programmers,
    I have a problem for two days, I have created a class ("myform") and this class is using a form, I have included this form's ui header ("ui_myform.h"). Then I created a new class ("mainclass") which is based myform class.

    I wrote these codes to my project;

    mainclass *a = new mainclass();
    a->show();

    mainclass *b = new mainclass();
    b->show();

    a and b are using same ui file , and they are using same labels, it doesnt crerate two forms. Why? I want it to create two forms .

  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: One Ui Form for multi classes

    Can we see the definition of mainclass?
    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 2008
    Posts
    91
    Thanks
    8

    Default Re: One Ui Form for multi classes

    main class (CVideoMenu)

    CVideoMenu.h
    #include "CMenuScreen.h"
    #include "CMovieMenu.h"

    class CVideoMenu : public CMenuScreen
    {
    public:
    CVideoMenu(QWidget *parent = 0);

    }
    #include "CVideoMenu.h"

    #define LABEL_COUNT 4



    CVideoMenu::CVideoMenu(QWidget *parent)
    :CMenuScreen(parent)
    {

    }
    Base class header

    #include "ui_menuscreen.h"


    class CMenuScreen : public cpage, private Ui::screen
    {
    Q_OBJECT
    public:
    CMenuScreen(QWidget *parent);
    virtual ~CMenuScreen();

    }

    CMenuScreen::CMenuScreen(QWidget *parent)
    :cpage(parent)
    {
    // TODO Auto-generated constructor stub
    setupUi(this);
    }


  4. #4
    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: One Ui Form for multi classes

    So is it CVideoMenu or mainclass? You have "mainclass" in your code... The code you pasted seems correct so you should get two widgets when you create two instances of the class.
    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.


Similar Threads

  1. Replies: 2
    Last Post: 18th June 2013, 10:31
  2. Pass variable from a form to another form
    By dark1988 in forum Qt Programming
    Replies: 5
    Last Post: 8th February 2011, 18:19
  3. Replies: 1
    Last Post: 19th March 2009, 09:41
  4. Help me to load one form over another form PushButton
    By wagmare in forum Qt Programming
    Replies: 7
    Last Post: 26th November 2008, 16:11
  5. visible main form?
    By triperzonak in forum Newbie
    Replies: 1
    Last Post: 12th June 2008, 09:00

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.