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

List:       kde-commits
Subject:    Re: KDE/kdepim/kontact/src
From:       David Faure <dfaure () kdab ! net>
Date:       2008-07-02 15:29:03
Message-ID: 200807021729.04871.dfaure () kdab ! net
[Download RAW message or body]

On Wednesday 02 July 2008, Rafael Fernández López wrote:
> +  factory()->plugActionList( this, QString( "navigator_actionlist" ),
> +                             *reinterpret_cast<QList<QAction*>*>( &mActionPlugins ) );

WOW this is ugly! And amazingly dangerous, I would say.

mainwindow.h:55:typedef QList<KAction*> ActionPluginList;

I would much rather see the code use a QList<QAction*> and cast individual actions
to KAction when you really need to use KAction API (to set shortcuts I assume?)

Casting a QAction pointer is safe when you know it's a KAction. Side-casting to another
type of list is not safe.

-- 
David Faure, faure@kde.org, dfaure@kdab.net
KDE/KOffice developer, Qt consultancy projects
Klarälvdalens Datakonsult AB, Platform-independent software solutions

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

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