LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 02-13-2006, 11:02 AM   #1
Ephracis
Senior Member
 
Registered: Sep 2004
Location: Sweden
Distribution: Ubuntu, Debian
Posts: 1,109

Rep: Reputation: 50
Post KDE devel: XMLGUI menu executes after app is terminated


I have a application that contains a KMainWindow which first calls setXMLFile() and then initializes a number of private vars which are of KAction type, each connected to a protected slot.

In these slots I just do a simple printf() to see if anything happens when I click the post in the menu. Well, something does happen, the problem is that all those printf()s all come after I close the application.

Here's the application:

test.h:
Code:
#include <kmainwindow.h>
#include <kaction.h>

class KAction;
 
class Test : public KMainWindow {
	Q_OBJECT
public:
	Test();

private:
	KAction *a_mount;
	KAction *a_upgrade;
	KAction *a_settings;
	
protected slots:
	void s_mount();
	void s_upgrade();
	void s_settings();
};
test.cpp
Code:
#include "test.h"
#include <qtabwidget.h>
#include <kmainwindow.h>
#include <kaction.h>
#include <stdio.h>

Test::Test() : KMainWindow(0, "Test") {
	setXMLFile("testui.rc");
	a_mount		= new KAction(i18n("Mount"), 0, this, SLOT(s_mount()), actionCollection(), "mount");
	a_upgrade	= new KAction(i18n("Upgrade"), 0, this, SLOT(s_upgrade()), actionCollection(), "upgrade");
	a_settings	= new KAction(i18n("Settings"), 0, this, SLOT(s_settings()), actionCollection(), "settings");
	QTabWidget *tab = new QTabWidget(this, "tab");
	setCentralWidget(tab);
	createGUI();
}
void Test::s_mount() { }
void Test::s_upgrade() { }
void Test::s_settings() {
	printf("testing...\n");
}
I then run the application, everything looks good. I go to the menu and click on settings and nothing happens. But right after I close the window I get "testing..." in the terminal. So how can I make it execute the s_settings() while running, instead of waiting until it is terminating?
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
MacOS-like menu app - - what's the name? metcalfe Linux - Software 4 01-17-2006 03:20 PM
slackware app;lications menu paul62 Slackware 1 10-12-2005 11:40 PM
Cannot remove APP from Menu List AJones Debian 2 05-06-2005 09:10 PM
windowmaker app menu fails babag Mandriva 0 01-18-2004 06:36 PM
Adding an app to start menu in GNOME or KDE snatale1 Linux - Newbie 2 08-27-2003 12:12 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:47 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration