[Qt] New qt bugfix patch

zeljko at holobit.net zeljko at holobit.net
Mon Jul 2 19:55:26 CEST 2007


Quoting Den Jean <Den.Jean at telenet.be>:

> On Monday 02 July 2007 09:38:14 am zeljko wrote:
>> AFAIK he said that he'll return on 29.06.2007. Hey Den you lazy man where
>> are you ? ;)))))
>
> I am back and I am looking into the widestring problem.

Hi,
Nice to see you here again :)
I think that you've seen what have to be done with pwidestrings in bindings.
Another thing we have to do is small changes in bindings code.
1. This have to be added for QWidget, QMainWindow & QMdiSubWindow
Why ? Because QWidget's closeEvent() call is per default accepted, so  
we cannot control it via LCL.
before QWidget_create you should add this code.
QWidget_create doesn't need to be changed like here, but can be added  
another constructor like QWidget_createLCL() which returns QWidgetHack  
(it can be named QWidgetLCL) ...
/* QWidgetHack class is "howto" override some protected functions for  
our bindings
    or howto get some voids into class public.
  */
class QWidgetHack: public QWidget
    {
	public:
         QWidgetHack(QWidget* parent, Qt::WindowFlags f): QWidget(parent, f) {
         }
         protected:
         void closeEvent(QCloseEvent* event)
	{
          /* our qt bindings windows are happy now
            but we should take care of QEvent::accept()
            or QEvent::ignore() !*/
          };
     };

QWidgetH QWidget_create(QWidgetH parent, unsigned int f)
{
/* here we  create our hack widget */
	return (QWidgetH) new QWidgetHack ((QWidget*)parent, (Qt::WindowFlags)f);
}

Same thing have to be maded for QMainWindow (QMainWindowHack) and  
QMdiSubWindow (QMdiSubWindowHack)



2.Add helper functions for QStringList
here they are:
class QStringListHack: public QStringList
{
     public:
     QStringListHack(): QStringList(){
     };
     public:
     int base_count(){
       return count();
     };
     void base_append(QString &value){
      append(value);
     };
     void base_begin(){
     begin();
     };
     void base_clear(){
     clear();
     };
     void base_end(){
     end();
     };
     void base_insert(int i, QString value){
     insert(i, value);
     }
     bool base_Empty(){
     return empty();
     };
     QString base_last(){
     return last();
     };
     void base_move(int from, int to){
      move(from, to);
     };
     void base_removeAt(int i){
      removeAt(i);
     }
     QString base_value(int i){
      return value(i);
     };

};

QStringListH QStringList_create()
{
   /* we create hacked stringlist by default */
	return (QStringListH) new QStringListHack();
}

with this QStringList hack we get basic QStringList handling, so it will be
easy to make converter function TStringList2QStringList() and  
QStringList2TStringList()

All changes are tested and works nice.


zeljko








More information about the Qt mailing list