Results 1 to 16 of 16

Thread: How to develop a multi-gui application "alternative for the stacked widget "

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Feb 2013
    Location
    Banzart
    Posts
    54
    Thanks
    17
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Question How to develop a multi-gui application "alternative for the stacked widget "

    Hello i am a beginner my objective is to develop a multi interfaces application where each interface "widget" had it's own .cpp and .h files .
    my second question is how to link them up
    i want an application which is similar in the structure and the classes to an android application where each interface has it's specifics files
    Sliver_Twist

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

    Default Re: How to develop a multi-gui application "alternative for the stacked widget "

    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
    Feb 2013
    Location
    Banzart
    Posts
    54
    Thanks
    17
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: How to develop a multi-gui application "alternative for the stacked widget "

    i know already that but the stackedwidget doesn't allow me to seperate the code of each page "widget" in a separated .cpp and .h file
    Sliver_Twist

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

    Default Re: How to develop a multi-gui application "alternative for the stacked widget "

    Of course it allows you to implement the code of each page in a separate set of files.
    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.


  5. #5
    Join Date
    Feb 2013
    Location
    Banzart
    Posts
    54
    Thanks
    17
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: How to develop a multi-gui application "alternative for the stacked widget "

    how is that ??? I have already tried it but when implement a new page in the QstackedWidget i don't get a new set of files for the new page
    Sliver_Twist

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

    Default Re: How to develop a multi-gui application "alternative for the stacked widget "

    QStackedWidget::addWidget() -- this accepts pointer to a widget. Any widget. Implemented in any file.
    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.


  7. #7
    Join Date
    Feb 2013
    Location
    Banzart
    Posts
    54
    Thanks
    17
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: How to develop a multi-gui application "alternative for the stacked widget "

    Sorry for asking again but i have a problem using this method
    i have created a new QtDesignerForm class called Widget2
    do i call this widget like this ??
    ui->stackedWidget->addWidget(Widget2 );
    Sliver_Twist

  8. #8
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,318
    Thanks
    316
    Thanked 870 Times in 857 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: How to develop a multi-gui application "alternative for the stacked widget "

    do i call this widget like this ??
    ui->stackedWidget->addWidget(Widget2 );
    No. You do this:

    Qt Code:
    1. Widget2 * newWidget2 = new Widget2;
    2. ui->stackedWidget->addWidget( newWidget2 );
    To copy to clipboard, switch view to plain text mode 

    As Wysota said, the code for "Widget2" can be implemented *anywhere*. It can even be implemented in a library (such as Qt itself) and all you need to create an instance of "Widget2" is the header file that defines the class and the library containing the compiled code.

    If you are trying to create new QWidget classes of your own and you are not ending up with new .h and .cpp files in which to implement the code for those classes, then you are not using your application development tool correctly or you have it configured wrong.
    Last edited by d_stranz; 13th March 2013 at 15:53.

  9. #9
    Join Date
    Feb 2013
    Location
    Banzart
    Posts
    54
    Thanks
    17
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: How to develop a multi-gui application "alternative for the stacked widget "

    Well at first i created in my project a new Qt Designer Form Class which is a widget called widget2 that created an new .ui/.cpp/.h files then i wrote this code in my mainwindow wich contain a QStackedWidget

    Qt Code:
    1. ui->stackedWidget->setCurrentIndex(0);
    2. Widget2 * newWidget2 = new Widget2;
    3. ui->stackedWidget->addWidget( newWidget2 );
    To copy to clipboard, switch view to plain text mode 
    but i doesn't do the job
    Last edited by sliverTwist; 14th March 2013 at 09:45. Reason: updated contents
    Sliver_Twist

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

    Default Re: How to develop a multi-gui application "alternative for the stacked widget "

    In what way "it doesn't do the job"?
    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: 1
    Last Post: 7th April 2010, 21:46
  2. Replies: 3
    Last Post: 15th February 2010, 17:27
  3. How to develop platform independ "DLL"
    By alxwang in forum Qt Programming
    Replies: 1
    Last Post: 7th March 2009, 16:02
  4. Replies: 3
    Last Post: 8th July 2008, 19:37
  5. Translation QFileDialog standart buttons ("Open"/"Save"/"Cancel")
    By victor.yacovlev in forum Qt Programming
    Replies: 4
    Last Post: 24th January 2008, 19:05

Tags for this Thread

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.