PDA

View Full Version : simple button



wreckx
19th November 2010, 14:35
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::on_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

high_flyer
19th November 2010, 14:53
http://doc.trolltech.com/4.7/signalsandslots.html

Zlatomir
19th November 2010, 15:02
Also this (http://www.qtcentre.org/faq.php?faq=qt_general_category#faq_qt_designer_2f orms) FAQ can be helpful.

wreckx
19th November 2010, 15:38
Thank you everyone for your replies..

i will take a look right now ..

Max

squidge
19th November 2010, 18:04
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

wreckx
19th November 2010, 19:19
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

squidge
19th November 2010, 19:54
All the other pages derived from QDialog? If so, just use


dialogName->exec();

to open the form.

like so:



void MainWindow:On_pushButton_clicked()
{
page2->exec();
}


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