Qt World Summit 2023: Berlin awaits! Join us now
最新版Qt 6.3已正式发布。 了解更多。
最新バージョンQt6.5がご利用いただけます。 詳細はこちら

Qt Commercial Support Weekly #6: QWebSettings Clarification and QtSQL Issues

This week we will have a shorter than usual support weekly, but next week's will be bigger (at least in theory) than ever including an example of how to provide custom interfaces with ActiveQt.


Sometimes the documentation can be, unfortunately, misleading in Qt as I am sure many of you have seen before.  One of these instances is with QWebSettings, specifically the JavascriptCanOpenWindows flag. The implication of the current documentation is that, if this is set to be false,  then it will not allow Javascript to open any windows via the window.open() command.  Unfortunately, this is not entirely true.  What it actually means is that it will only prevent the window.open() command from working if it does not come as a response from a user interaction.  Therefore, if the Javascript code is set up to call window.open() when the user clicks on something for instance, then it will still go ahead and open the window despite the JavascriptCanOpenWindows flag not being set.  If the window is opened due to a timer expiring, then it will prevent the window from being opened.


This is intentional behavior so it is not a bug in Qt, but the documentation will be updated to reflect this in the future, so that it is a lot clearer as to the intention of this flag.


In SQL news there has been some work done on the ODBC driver, specifically when connecting to SQL Server. There are some patches for that which fix the following two issues - QTBUG-8963 (https://bugreports.qt.nokia.com/browse/QTBUG-8963) and QTBUG-2192 (https://bugreports.qt.nokia.com/browse/QTBUG-2192).  Patches for these issues will be making their way back into Qt soon, but if you want the patches before hand then please contact Qt Commercial Support through the customer portal.


Also, a little tip for those using ODBC to connect to a database and running into problems relating to SQL_CURSOR_STATIC. If you are running a select query via the ODBC SQL driver then you may have a problem with SQL_CURSOR_STATIC, which may be the case if the ODBC driver you are using for the database you connect to does not have all the functionality available.  If this happens, then in order to get around this you can call QSqlQuery::setForwardOnly(true). What this does is ensure that it does not use a static cursor for navigating the result set and subsequently it will workaround the limitation.


If any of you out there have any feedback on these weekly blogs, then please feel free to comment.  If you have any comments on support itself, then you can use the customer portal or send them via your contact in Qt Commercial Sales. I will be sure to receive them then and can respond directly.