Sign in Join

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

Mailing lists / qt / 2011-06

QT application without libQt4Pas

2 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

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

Krzysztof

Hi,

On lazarus QT wiki page (http://wiki.lazarus.freepascal.org/Qt_Interface) i found this info:

"It is being reported that it may be possible to link to Qt 4 directly, using some tricks. Many think it is not. This is yet to be tested. It is expected that any such binding will be compatible with the currently utilized one, so the interface code won?t have to be changed."

Where can I find this tricks? Are plans to add this feature?

Regards
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/qt/attachments/20110628/4f9fec83/attachment.html>

Den Jean
to Krzysztof
Krzysztof wrote 6 lines
"It is being reported that it may be possible to link to Qt 4 directly, using some tricks. Many think it is not. This is yet to be tested. It is expected that any such binding will be compatible with the currently utilized one, so the interface code won?t have to be changed." Where can I find this tricks? Are plans to add this feature?

There are no such plans as it is useless.

There is much more to a binding than only
calling methods of a C++ class.

A function available in the Qt C++ library like
QWidget::setMaximumWidth(int)
is directly available under
_ZN7QWidget15setMaximumWidthEi
This mangled name is however C++ compiler dependant.

Some of the functionality of Qt C++ is available to the C++ programmer via the header and not via the dll. Namely all inline code and template stuff. These things cannot be solved by directly calling the C++ library from Pascal.

e.g You will not find the QWidget::width function in the Qt libtrary(dll) as it is inlined.

qwidget.h extract:
inline int QWidget::width() const
{ return data->crect.width(); }

Furthermore this binding alleviates some of the problems of dealing with C++ types by auto converting between pascal and C++.

binding source extract:
C_EXPORT void QWidget_setWindowTitle(QWidgetH handle, PWideString p1) {

	QString t_p1;
	copyPWideStringToQString(p1, t_p1);
	((QWidget *)handle)->setWindowTitle(t_p1);

}

Here the Pascal programmer can provide a Pascal string type (WideString) and the binding source code converts it to a QString C++ class.

regards,

Den Jean