Results 1 to 8 of 8

Thread: Help me to load one form over another form PushButton

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

    Question Help me to load one form over another form PushButton

    Hi Friends,
    I am new to this Qt enviroiment and my first assign task is to create a application in Qt as when i click one PushButton a new form with series of pushButton has to be opened so i dont know how to connect the form 1 pushButton to form 2 ....
    Please help me

  2. #2
    Join Date
    Mar 2008
    Posts
    141
    Thanks
    10
    Thanked 9 Times in 9 Posts

    Default Re: Help me to load one form over another form PushButton

    hi,

    you should use the designer to add signal/slot connections (if the new form is within the same widget). It's pretty easy that way.
    If it is a new, own window you can crate a slot with the name:

    Qt Code:
    1. void on_myPushButton_clicked()
    To copy to clipboard, switch view to plain text mode 

    and in the on_myPushButton_clicked() function you can open a new form/window/dialog.

  3. #3
    Join Date
    May 2008
    Location
    Kyiv, Ukraine
    Posts
    418
    Thanks
    1
    Thanked 29 Times in 27 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Help me to load one form over another form PushButton

    Take a look at Qt's examples, standard dialogs in particular.
    I'm a rebel in the S.D.G.

  4. The following user says thank you to lyuts for this useful post:

    wagmare (12th September 2008)

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

    Question Re: Help me to load one form over another form PushButton

    Quote Originally Posted by janus View Post
    hi,

    you should use the designer to add signal/slot connections (if the new form is within the same widget). It's pretty easy that way.
    If it is a new, own window you can crate a slot with the name:

    Qt Code:
    1. void on_myPushButton_clicked()
    To copy to clipboard, switch view to plain text mode 

    and in the on_myPushButton_clicked() function you can open a new form/window/dialog.
    thanks but i cant understand because i am new .... can u explain with small example please.....

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

    Question Re: Help me to load one form over another form PushButton

    hi.
    I went through the dialog examples but i still cant learn about how to connect a new dialog
    along with the parent and inside that dialog i should open pushbutton and labels...
    please help me...

  7. #6
    Join Date
    Mar 2008
    Posts
    141
    Thanks
    10
    Thanked 9 Times in 9 Posts

    Default Re: Help me to load one form over another form PushButton

    hi,

    Take a look at the QDialog Class Reference. There is some example code:

    Qt Code:
    1. void MyFirstDialog::on_myPushButton_clicked()
    2. {
    3. MySecondDialog dialog(this);
    4. dialog.exec(); //opens the second Dialog
    5. }
    To copy to clipboard, switch view to plain text mode 

  8. #7
    Join Date
    Nov 2008
    Posts
    22
    Qt products
    Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11

    Default Re: Help me to load one form over another form PushButton

    Janus:

    What about when you wan to launch a new window?, hide the parent window, but keep track of it to recall it later. I have an intro window with buttons and one of these should launch the "main window" that I call the admin window:

    Qt Code:
    1. void introWindow::adminstart() {
    2. hide();
    3. adminwin = new AdminWindow(this);
    4. }
    To copy to clipboard, switch view to plain text mode 
    my header file has the following:

    Qt Code:
    1. #ifndef INTROWINDOW_H
    2. #define INTROWINDOW_H
    3.  
    4. #include <QWidget>
    5. #include <QtGui>
    6. #include <QPushButton>
    7. #include <QtGui/QGraphicsView>
    8. #include <QtGui/QPushButton>
    9. #include <QtGui/QVBoxLayout>
    10. #include <QtGui/QHBoxLayout>
    11. //#include "adminWindow.h"
    12. class QAction;
    13. class QMenu;
    14. class AdminWindow;
    15. class introWindow : public QWidget
    16. {
    17. Q_OBJECT
    18. public:
    19. introWindow(QWidget *parent = 0);
    20. //introWindow();
    21. ~introWindow();
    22.  
    23. QGraphicsView *graphicsView;
    24. QPushButton *adminButton;
    25. QPushButton *measureButton;
    26. QPushButton *viewButton;
    27. QPushButton *quitButton;
    28. QVBoxLayout *vboxLayout;
    29. QHBoxLayout *hboxLayout;
    30. private slots:
    31. void adminstart();
    32. private:
    33. AdminWindow *adminwin;
    34. };
    35. #endif
    To copy to clipboard, switch view to plain text mode 

    when I compile I get the following error msg:
    Undefined symbols:
    "AdminWindow::AdminWindow(QWidget*)", referenced from:
    introWindow::adminstart() in introwindow.o
    ld: symbol(s) not found
    collect2: ld returned 1 exit status

  9. #8
    Join Date
    May 2007
    Location
    Lublin, Poland
    Posts
    345
    Thanks
    40
    Thanked 8 Times in 4 Posts
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Help me to load one form over another form PushButton

    Hi,

    1)If you paste the code we will surely help you( whole app or a reasonable example/minimm compilable )
    2)If you explain in detail what you want exactly I will help you as well.
    3)If you show the adminWindow implementation we can look for problems.

    The code you need is rather simple so if you provide your code or explanation surely someone will help you within a short period of time.

    Kacper
    Qt allows you to use everything you want
    wysota
    --------------------------------------------------------------------------------
    #if defined(Q_OS_UNIX) && defined(QT_DEBUG)
    abort(); // trap; generates core dump
    #else
    exit(1); // goodbye cruel world
    #endif

Similar Threads

  1. Load form mdi child plugin
    By estanisgeyer in forum Qt Programming
    Replies: 4
    Last Post: 10th February 2008, 14:27

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.