On Dec 9, 2009, at 4:29 AM, Kris Wong wrote:

hi, i am using QT 4.5 version.  My issue is how to work with multiple
ui in a project application.

Example: i have  started  a new project named  mainwindow(mainwindow
.ui) in that i placed a treewidget and added item(named colors), now
i added another window(widget i e.,color.ui ) to the same project,
when i clicked on itemtreewidget(color) then color.ui window should be
display. i am not understanding how to connect these two .ui windows.

i wrote like this at the signals
connect(ui->color,SIGNAL(itemClicked()),this,SLOT(show()));


void ECLogic::show()
{

?????????
}

Please suggest me how to open the color window when we
clicked itemtreeWidget.

You are using the wrong mailing list.
http://lists.trolltech.com/

That said, there are a couple of things to point out here. First off, the function show() is a Qt function (part of QWidget, i believe) that is used to show any given widget. As such you neither want to nor should (generally) implement it yourself (there are always exceptions, but if you need to ask this question those aren't for you ;-) ). So while your connect command looks correct, you should use a different function name there than show. Then in that function (say, openColorWindow() ) you would have something like the following:

void openColorWindow()
{
color *colorWindow=new color; //assuming the window you created in color.ui is called "color" color.show(); //notice that you did NOT implement the show function yourself - it comes with the widget
}

Assuming your project is set up correctly with all the needed includes, headers, source files, etc (i.e. color.h needs to be included in the .cpp file this function is called from), that's all you need to do to open a new window. Of course, you may want to do more, such as initializing some value in the new window before show()ing it, but that's up to you. Of course, there are other ways of doing this. For example, if the color window was a member object of your mainwindow and you instantiated it in your main window constructor (or, really, any point before calling connect), then you could just do something like:

connect(ui->color,SIGNAL(itemClicked()),colorWindow,SLOT(show()));

where colorWindow is the pointer to the color window object. Then you don't have to write any functions to open your new window since, as I already pointed out, the show() function already exists. That may or may not work for your purposes, however, as all it does is show the window. Good luck!
-----------------------------------------------
Israel Brewster
Computer Support Technician II
Frontier Flying Service Inc.
5245 Airport Industrial Rd
Fairbanks, AK 99709
(907) 450-7250 x293
-----------------------------------------------

-Kris Wong

_______________________________________________
Qt-creator mailing list
[email protected]
http://lists.trolltech.com/mailman/listinfo/qt-creator



BEGIN:VCARD
VERSION:3.0
N:Brewster;Israel;;;
FN:Israel Brewster
ORG:Frontier Flying Service;MIS
TITLE:PC Support Tech II
EMAIL;type=INTERNET;type=WORK;type=pref:[email protected]
TEL;type=WORK;type=pref:907-450-7293
item1.ADR;type=WORK;type=pref:;;5245 Airport Industrial Wy;Fairbanks;AK;99701;
item1.X-ABADR:us
CATEGORIES:General
X-ABUID:36305438-95EA-4410-91AB-45D16CABCDDC\:ABPerson
END:VCARD


_______________________________________________
Qt-creator mailing list
[email protected]
http://lists.trolltech.com/mailman/listinfo/qt-creator

Reply via email to