Results 1 to 7 of 7

Thread: simple button

  1. #1
    Join Date
    Nov 2010
    Posts
    10
    Thanks
    7
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default simple button

    Hello everyone,

    i design all my pages in different files .UI ...

    - page1.ui
    - page2.ui
    - page3.ui


    i made a button (actually3) on my page1.ui

    what i want its to press the button 2 to go page2.ui and button 3 go to page3.ui

    and i can't find the way to make this work..

    i have this starting script for the button :

    void MainWindow:n_pushButton_clicked()
    {

    }


    and i have no idea what to write next to call my page2.ui ?!!

    im really new at Qt and its really complicated to get use to this platforme seriously - -"

    thank you for your help

    Max

  2. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: simple button

    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  3. The following user says thank you to high_flyer for this useful post:

    wreckx (19th November 2010)

  4. #3
    Join Date
    May 2010
    Location
    Romania
    Posts
    1,021
    Thanks
    62
    Thanked 260 Times in 246 Posts
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: simple button

    Also this FAQ can be helpful.

  5. The following user says thank you to Zlatomir for this useful post:

    wreckx (19th November 2010)

  6. #4
    Join Date
    Nov 2010
    Posts
    10
    Thanks
    7
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: simple button

    Thank you everyone for your replies..

    i will take a look right now ..

    Max

  7. #5
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: simple button

    It sounds like your creating a wizard - multiple pages and a button to go from one page to the next.

    If so, instead of doing that, take a look at QWizard - http://doc.qt.nokia.com/4.7/qwizard.html

  8. The following user says thank you to squidge for this useful post:

    wreckx (19th November 2010)

  9. #6
    Join Date
    Nov 2010
    Posts
    10
    Thanks
    7
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: simple button

    Thank you for your reply Squidge.

    actually i want to call my xxxx.UI pages .. 4 pages in total "just like a website"


    ok here are the plan :


    -button Map ---> go to page1.ui (Forms)

    -button Fair ---> go to page2.ui (Forms)

    -button Attraction ---> go to page3.ui (Forms)

    -button About BTS ---> go to page4.ui (Forms)


    each button goes to different Forms.UI i really need something to call the Forms.ui because i made all differentes pages with different forms .. i use that for the design

    when i create a button in my Forms.UI i insert a push button then right click and Go to slot.. then choose "Clicked()" and i have this script come out


    void MainWindow: On_pushButton_clicked()
    {

    }


    can i just write something here to call the other Form (page2.ui) page on the button ??


    like for exemple

    void MainWindow: On_pushButton_clicked()

    {

    on clicked "fair button" -> show page2.ui

    etc.....

    }


    then for page 3

    void MainWindow: On_pushButton_clicked()

    {

    on clicked "attraction button" -> show page3.ui

    etc.....

    }


    ???????????????????????????


    thank you

    Max

  10. #7
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: simple button

    All the other pages derived from QDialog? If so, just use
    Qt Code:
    1. dialogName->exec();
    To copy to clipboard, switch view to plain text mode 
    to open the form.

    like so:

    Qt Code:
    1. void MainWindow:On_pushButton_clicked()
    2. {
    3. page2->exec();
    4. }
    To copy to clipboard, switch view to plain text mode 

    of course 'page2' has be created somewhere (either on the stack or dynamically using 'new')

  11. The following user says thank you to squidge for this useful post:

    wreckx (20th November 2010)

Similar Threads

  1. Changing text of button in no relation to button
    By Sabre Runner in forum Newbie
    Replies: 22
    Last Post: 23rd September 2010, 12:29
  2. Simple chat
    By kernel.roy in forum Newbie
    Replies: 5
    Last Post: 9th September 2010, 19:37
  3. Replies: 6
    Last Post: 21st August 2010, 21:09
  4. Replies: 1
    Last Post: 2nd August 2010, 05:40
  5. Custom widget: a button within a button
    By Gnurou in forum Qt Programming
    Replies: 7
    Last Post: 18th June 2009, 09:03

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.