[Qt-interest] unused parameter in retranslateUi()

Nathan Carter ncarter at bentley.edu
Wed Jun 3 20:01:21 CEST 2009


Dear List,

I'm using Designer to make a .ui file, and then use it in my code via  
the subclassing approach.  So I have a .cpp file that looks like this.


	#include <foo.h>
	#include <ui_foo.h>

	class Foo : public QMainWindow, public Ui::Foo
	{
		...
	};


Compilation always gives me several compiler warnings in some uic- 
generated code, all of which look like this:

	.ui/ui_foo.h:[line number]: warning: unused parameter ‘Foo’

The line in question is like the following one.

	void retranslateUi(QMainWindow *Foo)
	{
		...

I know that I have at least two options here.

1. Put up with these warnings; ignore them.  But it's nice to fix  
compiler warnings when they show up, so that you don't later forget  
which ones are ignorable and which ones aren't.

2. Pass a compiler switch to ignore all warnings of this type.  But of  
course this throws away potentially helpful warnings too.

So is there a third option?  E.g., a way to get uic to use the  
Q_UNUSED() macro, or something?

Thanks!

Nathan





More information about the Qt-interest-old mailing list