Tuesday, January 6th 2009, 12:25am UTC

You are not logged in.

  • Login
  • Register

Dear visitor, welcome to KDE-Forum.org. If this is your first visit here, please read the Help. It explains how this page works. You must be registered before you can use all the page's features. 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.
  • Go to the top of the page

e8johan male

Beginner

Posts: 27

Birthday: May 16th 1979 (29)

Gender: male

2

Wednesday, April 28th 2004, 7:05am

RE: kapplication.h uh?

Use the qApp pointer. It has a quit() slot.
  • Go to the top of the page

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.
  • Go to the top of the page

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
  • Go to the top of the page

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();
}
  • Go to the top of the page

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.
  • Go to the top of the page