LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
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 11-23-2004, 07:29 PM   #1
maldini1010
Member
 
Registered: Sep 2004
Location: Montreal
Posts: 53

Rep: Reputation: 15
kde programming


Hi

I have created a GUI using kdevope 3 with kde libraries Now I want that when the users clicks the name in the menu bar(ie disconnect) the disconnectMe() function would be executed in my code.

I saw many examples on the net, but they all seem to use QT style connect & slot

Note: In order to insert the item I used

QPopupMenu *systemmenu = new QPopupMenu(this);
systemmenu->insertItem(i18n("Connect"),1);

where the 1 is just an index number.

Thanks alot
 
Old 11-24-2004, 03:47 AM   #2
rjlee
Senior Member
 
Registered: Jul 2004
Distribution: Ubuntu 7.04
Posts: 1,994

Rep: Reputation: 76
You do need to use Qt's connect and slot to do this, as far as I am aware.
libkde is built on top of libqt; the moc and everything else all work for KDE.

Basically, just add Q_OBJECT to the top of the declaration of the class, and instead of making the disconnectMe() method public: you should declare it as protected slot:

You will need to convert the .cpp file through moc, and then compile the .moc.cpp object along with the original .cpp; KDevelop will handle this for you if you re-run automake and friends for your project.

The alternative is to subclass the InsertItem class and re-implement the clicked() handler to call back the disconnectMe() method; but, being a slot, I don't know if that will work or not.

The connect() method is a lot easier to use in the long run.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Programming using a Canon PowerShot A70 in KDE Gnarg Programming 5 08-22-2005 06:47 AM
KDE / GNOME programming Question chanwing Programming 1 04-13-2005 01:54 AM
Programming KDE applications??? Hachaso Linux - Software 1 10-04-2004 10:01 AM
KIOSLAVE (Kde Protocol Programming) jinksys Programming 0 03-11-2004 06:07 PM
I have a little problem with KDE, bad programming, or just me? natalinasmpf Linux - General 0 02-27-2004 10:33 PM

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

All times are GMT -5. The time now is 02:55 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