[Frogface-general] Adding Menus to the GUI
Status: Planning
Brought to you by:
declanmcgrath
|
From: Declan M. <dec...@fr...> - 2007-04-28 12:34:48
|
Hi Ganesh,
=46inally got around to taking a proper look at your email. Had a bit of a =
crazy=20
week at work. You gotta hate deadlines but I guess they're a necessary evil!
I'm (obviously!) posting this to the frogface mailing list. I hope that thi=
s=20
list will work ok - This is effectively the first testing of this mailing=20
list since I switched web hosting companies. So there may be some teething=
=20
problems with this list.
Anyway, I think your suggestion to inherit from QMainWindow is the best=20
approach. Perhaps call the inherited class something like FroggieMainWindow=
-=20
I was going to suggest calling it DiveDashboardMainWindow but I think we ha=
ve=20
enough confusing DiveDashboard classes already! Then you should be able to=
=20
implement the about() functionality like you said. Is this ok?
Regards,
Dec
On Saturday 28 April 2007 23:33, you wrote:
> Hi Dec,
>
> A few doubts,
>
> *Shall I create a new class mainwindow which inherits QMainWindow and
> keep all the main window things like about() in it? Or should I keep
> it within main() all these things?
>
> If you want me to do it within main().Then, all those examples given
> in QT are used by creating new classes. Can you tell =A0me any
> suggestions for it?
> I guess, if I paste the code till what I did might give an idea of
> what I'm actually asking you for..
>
> Here's the code:
> QMenu *menu =3D mainWin.menuBar()->addMenu(QObject::tr("&File"));
> =A0 =A0 menu->addAction(QObject::tr("&Quit"), &app, SLOT(quit()));
> =A0 =A0 menu->addSeparator();
> =A0 =A0 QMenu *helpMenu =3D mainWin.menuBar()->addMenu(QObject::tr("&Help=
"));
> =A0 =A0 helpMenu->addAction(QObject::tr("&About"), &app, SLOT(about()));
>
> So, the Quit works fine. Also, A help menu is created which pops out
> an 'about' menu but for that function, where should that QMessageBox
> be present?
>
> Normally in the examples given, They have created a class which
> inherits QMainWindow and then created an about() in which QMessageBox
> is given.So, when in above code, about() is called, it invokes that
> function and displays the message.
>
> Thanks,
|