Hi all!
Is there any way to pass default parameters values to any slot?
I read over there something baout adding an "=", but doesn't work
connect(ui.actionZoom_1X, SIGNAL(triggered()), d, SLOT(UpdateCameraZoom(=1.0)));
Any idea?
Thanks in advance.
 Intermediate user
					
					
						Intermediate user
					
					
                                        
					
						
							
								 
							
						
					
					
						 
    
    
    
    
    
    
   
    
    
       
    
    
       
    
    
    
    
   Is there any way to pass default parameters values to any slot?
 Is there any way to pass default parameters values to any slot?
		Hi all!
Is there any way to pass default parameters values to any slot?
I read over there something baout adding an "=", but doesn't work
connect(ui.actionZoom_1X, SIGNAL(triggered()), d, SLOT(UpdateCameraZoom(=1.0)));
Any idea?
Thanks in advance.
 Re: Is there any way to pass default parameters values to any slot?
 Re: Is there any way to pass default parameters values to any slot?
		Qt Code:
class Foo
{
public slots:
void UpdateCameraZoom(qreal level = 1.0);
};
void Foo::UpdateCameraZoom(qreal level)
{
// ...
}
connect(ui.actionZoom_1X, SIGNAL(triggered()), d, SLOT(UpdateCameraZoom()));To copy to clipboard, switch view to plain text mode
J-P Nurmi
 Intermediate user
					
					
						Intermediate user
					
					
                                        
					
						
							
								 
							
						
					
					
						 
    
    
    
    
    
    
   
    
    
       
    
    
       
    
    
    
    
   Re: Is there any way to pass default parameters values to any slot?
 Re: Is there any way to pass default parameters values to any slot?
		Oh my god! I didn't realise I could do that. Works perfectly for me. Thanks
But let's say different default parameters with differente signals calling the same slot. How would you do it?
Thanks.
 Re: Is there any way to pass default parameters values to any slot?
 Re: Is there any way to pass default parameters values to any slot?
		You could use for example QSignalMapper, QObject::sender() or QButtonGroup to map/identify the sender.
J-P Nurmi
 Re: Is there any way to pass default parameters values to any slot?
 Re: Is there any way to pass default parameters values to any slot?
		It should be added that the kind of method declaration jpn presented is a feature of C++ and can be used for all kind of methods in C++. No matter if the method is a Qt slot or just a totally normal method of a simple class.
ricardo (5th May 2009)
Bookmarks