[Kde-bindings] make Qt::Object superclass of rbuic's UI class

Richard Dale rdale at foton.es
Thu Jun 25 10:15:42 UTC 2009


On Saturday 20 June 2009 12:34:49 am airh2002 wrote:
> My previous mail was too many fixes and changes.
> It's my mistake. From now, I suggest a fix and a change one by one.
No don't worry about that! It's my fault for not responding very quickly. But 
breaking it down into smaller chunks does make it easier to discuss.

> To return to the subject,
> Original Qt class without explicit superclass is subclass of QObject,
> that manages lifecycles of Qt application.
Is that right - I thought it just didn't have any C++ parent? In C++ you can 
use multiple inheritance to inherit from both the uic generated class and a 
QObject.

> But, QtRuby class without explicit superclass is subclass of Ruby's
> Object, not Qt::Object.
>
> So I suggest, UI Class generated by rbuic4 should be subclass of
> Qt::Object. This needs only changes in 2 sections. I write diff below:
>
> 
===================================================================
> --- ./kdebindings/ruby/qtruby/tools/rbuic/ruby/rbwritedeclaration.cpp
> +++ ./kdebindings/ruby/qtruby/tools/rbuic/ruby/rbwritedeclaration.cpp
> @@ -92,7 +92,7 @@
> if (namespaceList.count())
> m_output << "\n";
>
> - m_output << "class " << m_option.prefix << className << "\n";
> + m_output << "class " << m_option.prefix << className << " <
> Qt::Object\n";
>
> const QStringList connections = m_uic->databaseInfo()->connections();
> for (int i=0; i<connections.size(); ++i) {
>
> 
===================================================================
> --- ./kdebindings/ruby/qtruby/tools/rbuic/ruby/rbwriteinitialization.cpp
> +++ ./kdebindings/ruby/qtruby/tools/rbuic/ruby/rbwriteinitialization.cpp
> @@ -2435,7 +2435,7 @@
> if (sender.isEmpty() || receiver.isEmpty())
> return;
>
> - m_output << m_option.indent << "Qt::Object.connect("
> + m_output << m_option.indent << "connect("
> << sender
> << ", "
> << "SIGNAL('" << connection->elementSignal() << "')"
We could change it, but I wonder if it should be an option passed to rbuic4, 
rather than doing it by default.

-- Richard



More information about the Kde-bindings mailing list