You are not logged in.

Dear visitor, welcome to KDE-Forum.org. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

M77

Unregistered

1

Wednesday, April 28th 2004, 12:51am

kapplication.h uh?

I want to put a shutdown button in my application, but I can't get it to work. Could someone help me with that? I'm new to c++ so maybe may hole problem is how to get a KApplication objet.

Thanks.

e8johan

Beginner

Posts: 27

Location: Sweden

  • Send private message

2

Wednesday, April 28th 2004, 7:05am

RE: kapplication.h uh?

Use the qApp pointer. It has a quit() slot.

M77

Unregistered

3

Wednesday, April 28th 2004, 8:19pm

RE: kapplication.h uh?

The shutdown button is for the hole system not only for that app.

anda_skoa

Professional

Posts: 1,273

Location: Graz, Austria

Occupation: Software Developer

  • Send private message

4

Wednesday, April 28th 2004, 9:11pm

Well, the KApplication instance is created in your main() function.
After that you can always access it by using the static KApplication method

Source code

1
KApplication::kApplication()


Cheers,
_
Qt/KDE Developer
Debian User

M77

Unregistered

5

Thursday, April 29th 2004, 12:11am

still lost

I have seen the k_mnu.cpp code to see how they get it done. Here is the relative code... my question is... where did they get kapp from?

if (kapp->authorize("logout"))
insertItem(SmallIconSet("exit"), i18n("Logout \"%1\"...").arg(username), this, SLOT(slotLogout()));




void PanelKMenu::slotLogout()
{
QApplication::syncX();
kapp->requestShutDown();
}

dfaure

Beginner

Posts: 16

Location: France

  • Send private message

6

Thursday, April 29th 2004, 4:33pm

RE: still lost

kapp is a global macro defined in <kapplication.h>
David Faure, KDE developer, Klaralvdalens-Datakonsult AB.