[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Re: Send arguments to slot
From:       Christoffer Brodd-Reijer <ephracis () linux ! se>
Date:       2006-03-04 19:33:10
Message-ID: 4409EB76.2090702 () linux ! se
[Download RAW message or body]

Andras Mantia wrote:
> On Saturday 04 March 2006 14:53, Christoffer Brodd-Reijer wrote:
>> Hi,
>>
>> I have a slot which is called when an object is being dropped into a
>> KFileTreeView. This slot creates a menu, looking like this:
>>
>> void photoW::slotDrop(KURL::List &urlList, KURL &url) {
>> 	KPopupMenu *popup = new KPopupMenu(this, "menu");
>> 	popup->insertItem(i18n("Copy here"), this, SLOT(copyMoveFile()));
>> 	popup->insertItem(i18n("Move here"), this, SLOT(copyMoveFile()));
>> }
>>
>> Now, I want to change this so that the slot called copyMoveFile takes
>> an argument list like copyMoveFile(KURL::List&, KURL&, int) where the
>> last int is used to determine if the file should be copied or moved.
>> But how can I send arguments to a slot? Whenever I try to add
>> something I get
>>
>> no such slot photoW::copyMoveFile(1)
>>
>> for example when I try to just use just a number.
> 
> I'm not sure what you want here.
I have a slot called slotDrop() which is connected to a KFileTreeView's 
drop-signal. So the slotDrop() gets two arguments from the signal, a 
list of all the selected items and the url where they are being dropped.

I now want to show a popupmenu asking the user if he wants to copy or 
move the file(s), just like Konqueror. So I moved all the code from 
slotDrop() to a new slot, called copyMoveFile() and change the 
slotDrop() so it instead shows a popupmenu with the different 
alternatives. Since copying and moving is almost the same (except for 
one line) I thought I could just send an int as an argument which should 
be 1 or 2 for copy or move. And of course, I want to forward the 
KURL::List and KURL arguments to the copyMoveFile()-slot.

I hope I've made myself clear.

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

 
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic