Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / qt / 2016-01

How to add new functions to qt4pas sources?

1 message · 1 person ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Mark Malakanov

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