[Qt] How to add new functions to qt4pas sources?

Mark Malakanov mark.malakanov at gmail.com
Tue Jan 5 06:27:40 CET 2016


Hi all,
I took sources from here 
http://users.telenet.be/Jan.Van.hijfte/qtforfpc/fpcqt4.html
I've added 2 more functions into qfiledialog_c.cpp

     C_EXPORT void QFileDialog_sidebarUrls(QFileDialogH handle, 
PPtrIntArray retval)
     {
       //qDebug() << "QFileDialog_sidebarUrls";

             QList<QUrl> t_retval;
             t_retval = ((QFileDialog *)handle)->sidebarUrls();
             copyQListTemplateToPtrIntArrayWithNew(t_retval, retval);
     }

     C_EXPORT void QFileDialog_setSidebarUrls(QFileDialogH handle, 
PPtrIntArray urls)
     {
             QList<QUrl> t_urls;
             //copyPtrIntArrayToQListTemplate(urls, t_urls); //this 
gives compilation error because QUrl should be dereferenced.
             //Replacing it with following inline code

             int len = getPtrIntArrayLength(urls);
             t_urls.clear();
             if (len>0) {
                     PTRINT *array = (PTRINT*)getPtrIntArrayAddr(urls);
                     for (int i = 0; i < len; i++){
                             QUrl* url = (QUrl*)array[i];
                             t_urls.append(*url);
                     }
             }

             ((QFileDialog *)handle)->setSidebarUrls(t_urls);

     }

Accordingly I've added to qt45.pas

procedure QFileDialog_sidebarUrls(handle:QFileDialogH; retval: 
PPtrIntArray); cdecl; external Qt4PasLib name 'QFileDialog_sidebarUrls';
procedure QFileDialog_setSidebarUrls(handle:QFileDialogH; retval: 
PPtrIntArray); cdecl; external Qt4PasLib name 'QFileDialog_setSidebarUrls';


I've tested, it works (in Linux).

How to make it added to "trunk" of the sources?

thanks,
Mark





More information about the Qt mailing list