[Interest] QTemporaryFile::open()

2017-02-17 Thread Larry Martell
When I call QTemporaryFile::open() with any OpenMode flags I get an error.

Code:

  QTemporaryFile wi_file;
  if (wi_file.open(QIODevice::WriteOnly)) {


Error:

/Users/lmartell/ia/cap/workItem.cpp:877:15: error: 'open' is a
protected member of 'QTemporaryFile'
  if (wi_file.open(QIODevice::WriteOnly)) {
  ^~~~

/usr/local/Qt-5.5.1/lib/QtCore.framework/Headers/qtemporaryfile.h:88:10:
note: declared protected here
bool open(OpenMode flags) Q_DECL_OVERRIDE;

If I do not pass in any args it complies fine. From the docs it seems
I can pass in an OpenMode. What am I missing or doing wrong?
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] HTTPS with Qt

2016-10-06 Thread Larry Martell
Yup, that worked find. Easy peasy! Thanks.

On Thu, Oct 6, 2016 at 9:55 AM, Gian Maxera <gmax...@gmail.com> wrote:
> In the Qt app you just need to change http to https
> No more.
>
>> On 6 Oct 2016, at 14:51, Larry Martell <larry.mart...@gmail.com> wrote:
>>
>> I have a Qt app that sends requests to a server like this:
>>
>>  QString urlStr = "http://foo.bar.com/baz;;
>>  QUrl transferUrl(urlStr);
>>  QNetworkRequest request(transferUrl);
>>  networkReply = networkManager.get(request);
>>
>> We need to change this to use HTTPS. We have the needed certs on the
>> server. Can someone please point me at some docs that will help me get
>> the Qt app modified to work with HTTPS. From what I've been able to
>> find I need to install a root certificate, but I don't know what that
>> means or how to do it. Also, what changes do I have to make in the Qt
>> code? Is it simply changing http to https? From a browser that is all
>> I had to do, presumedly because the browser already had the root
>> certificate. Any pointers will be greatly appreciated.
>>
>> Thanks!
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


[Interest] HTTPS with Qt

2016-10-06 Thread Larry Martell
I have a Qt app that sends requests to a server like this:

  QString urlStr = "http://foo.bar.com/baz;;
  QUrl transferUrl(urlStr);
  QNetworkRequest request(transferUrl);
  networkReply = networkManager.get(request);

We need to change this to use HTTPS. We have the needed certs on the
server. Can someone please point me at some docs that will help me get
the Qt app modified to work with HTTPS. From what I've been able to
find I need to install a root certificate, but I don't know what that
means or how to do it. Also, what changes do I have to make in the Qt
code? Is it simply changing http to https? From a browser that is all
I had to do, presumedly because the browser already had the root
certificate. Any pointers will be greatly appreciated.

Thanks!
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] script invoked with QProcess cannot open files with spaces in path

2016-09-01 Thread Larry Martell
On Wed, Aug 31, 2016 at 4:34 AM, Viktor Engelmann
<viktor.engelm...@qt.io> wrote:
>
>
>
> Am 31.08.2016 um 10:28 schrieb Viktor Engelmann:
>
>
>
> Am 31.08.2016 um 02:02 schrieb Kyle Altendorf:
>
> On August 30, 2016 7:44:14 PM EDT, Kyle Altendorf <s...@fstab.net> wrote:
>
> On August 30, 2016 4:28:25 PM EDT, Larry Martell
> <larry.mart...@gmail.com> wrote:
>
> I am invoking a python script with QProcess. I have found that if the
> script tries to open a file that has spaces in the path, no error is
> thrown, but the file always appears to have 0 length. The same script
> with the same file with spaces in the path invoked from the command
> line works fine. Note that this has nothing to do with argument
> passing from the C++ code to the script via QProcess - the file path
> name is hardcoded in the script. If the file has no spaces in its path
> it is opened fine. I have tied escaping the spaces with \ but no joy.
> Anyone know why this would be happening and know a way around this?
>
> Try printing sys.executable and os.getcwd() and see if they show any
> differences that might shed some light.  I'm on my phone so hopefully I
> am remembering those correctly.
>
> Or, is the file being accessed or created by the calling C++ application?  
> Depending on how each opens it there could be a conflict of sorts there.
>
>
> Interesting idea - if the C++ code creates the file and starts python without 
> closing the file, that might explain the behavior... although the python 
> script SHOULD throw an exception or something instead of "loading" an "empty 
> file" - but such "improvements" wouldn't surprise me in python...
>
> Viktor
>
>
> Although... then it should also not work with filenames without spaces...

This indeed was the issue. The filename with spaces was being created
by the C++ code and the buffer had not been flushed. Adding a flush
fixed it. When I was testing with a filename without spaces I was not
using a file created by the C++ program. Much thanks to everyone who
replied and offered advice and suggestions.
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] script invoked with QProcess cannot open files, with spaces in path

2016-08-30 Thread Larry Martell
On Tue, Aug 30, 2016 at 7:38 PM, Roland Hughes
 wrote:
>>>
>
> I am invoking a python script with QProcess. I have found that if the
> script tries to open a file that has spaces in the path, no error is
> thrown, but the file always appears to have 0 length. The same script
> with the same file with spaces in the path invoked from the command
> line works fine. Note that this has nothing to do with argument
> passing from the C++ code to the script via QProcess - the file path
> name is hardcoded in the script. If the file has no spaces in its path
> it is opened fine. I have tied escaping the spaces with \ but no joy.
> Anyone know why this would be happening and know a way around this?
> <<
>
> QProcess() as I recall, parses the string and assumes space to mark the end
> of a command and start of the parameter list. Ran into this on Linux as
> well. You need an extra set of quotes (or some other kind of delimiter) in
> the command to stop QProcess() from "helping you out."

No parameters are being passed to QProcess. Its start method is being
called with:

("/usr/bin/python2.7", "myscript.py")

The path of the file being opened is hard coded in the python script.
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] script invoked with QProcess cannot open files with spaces in path

2016-08-30 Thread Larry Martell
On Tue, Aug 30, 2016 at 7:08 PM, Thiago Macieira
<thiago.macie...@intel.com> wrote:
> Em terça-feira, 30 de agosto de 2016, às 16:28:25 PDT, Larry Martell escreveu:
>> I am invoking a python script with QProcess. I have found that if the
>> script tries to open a file that has spaces in the path, no error is
>> thrown, but the file always appears to have 0 length. The same script
>> with the same file with spaces in the path invoked from the command
>> line works fine. Note that this has nothing to do with argument
>> passing from the C++ code to the script via QProcess - the file path
>> name is hardcoded in the script. If the file has no spaces in its path
>> it is opened fine. I have tied escaping the spaces with \ but no joy.
>> Anyone know why this would be happening and know a way around this?
>
> It's very hard to even begin to guess where the problem is. From what you've
> described the problem is on the Python side, which means my knowledge drops to
> about zero.

Yes, my initial though was that it was on the python side, but the
same script run from the command line works fine.

> Can you come up with a simple main.cpp that uses QProcess to start a simple
> python script, that exhibits this behaviour?

I will try and do that.

Thanks
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


[Interest] script invoked with QProcess cannot open files with spaces in path

2016-08-30 Thread Larry Martell
I am invoking a python script with QProcess. I have found that if the
script tries to open a file that has spaces in the path, no error is
thrown, but the file always appears to have 0 length. The same script
with the same file with spaces in the path invoked from the command
line works fine. Note that this has nothing to do with argument
passing from the C++ code to the script via QProcess - the file path
name is hardcoded in the script. If the file has no spaces in its path
it is opened fine. I have tied escaping the spaces with \ but no joy.
Anyone know why this would be happening and know a way around this?
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] including config file with macdeployqt

2016-05-17 Thread Larry Martell
On Fri, May 13, 2016 at 8:07 AM, Robert Iakobashvili
<corobe...@gmail.com> wrote:
> Sorry, I do not know this way: running macdeployqt
>  is just a step in my script.
>
> You can copy by a post-building script command cp
> or use QMAKE_BUNDLE_DATA in your pro file to copy all
> you need in your app bundle.
>
> Kinda:
>
> SomeFeature.files = ./db/SomeFeature
> SomeFeature.path = Contents/Resources/
> QMAKE_BUNDLE_DATA += SomeFeature

Thanks for the reply. We're not using qmake, and we deploy on both Mac
and Windows. So on Win we're adding the file to the installshield
manifest and on Mac we're copying the file in manually. And in my code
I have this:

#if defined _MSC_VER
#define CONFIG_PATH "Resources/cap_config.json"
#else
#define CONFIG_PATH "../Resources/cap_config.json"
#endif

QFile file(QCoreApplication::applicationDirPath() + "/" + CONFIG_PATH);

I certainly don't love it, but it works.

>
> On Fri, May 13, 2016 at 1:54 PM, Larry Martell <larry.mart...@gmail.com> 
> wrote:
>> Thanks. That answers the second part of my question.
>>
>> Is there a way to get the config automagically included when I run 
>> macdeployqt?
>>
>> On Fri, May 13, 2016 at 7:50 AM, Robert Iakobashvili
>> <corobe...@gmail.com> wrote:
>>> Dear Larry,
>>> I'd place it to Resources - so no issues at signing.
>>>
>>> Additionally, if you need some configs specific for each Mac-user,
>>> ~/Library/Application Support is the right place to arrange
>>> and entry for your company and inside entries for your software.
>>>
>>> Kind regards,
>>> Robert
>>>
>>>
>>> On Fri, May 13, 2016 at 1:42 PM, Larry Martell <larry.mart...@gmail.com> 
>>> wrote:
>>>> I am creating a bundle with macdeployqt to distribute my app. I want
>>>> to have a config file that my app will read at startup. How can I
>>>> include that config file in my bundle, and where is the proper place
>>>> for it to live on the file system on the machine the app gets
>>>> installed on?
>>>> ___
>>>> Interest mailing list
>>>> Interest@qt-project.org
>>>> http://lists.qt-project.org/mailman/listinfo/interest
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] iterate through JSON data

2016-05-16 Thread Larry Martell
On Mon, May 16, 2016 at 7:53 PM, Hamish Moffatt
<ham...@risingsoftware.com> wrote:
> On 17/05/16 08:24, Larry Martell wrote:
>>
>> I've see a lot of code that does something like this:
>>
>>  QJsonDocument document = QJsonDocument::fromJson(jsonData);
>>  QJsonObject object = document.object();
>>  QJsonValue value = object.value("capData");
>>
>> But I don't want to hard code the keys - I want to pick up and store
>> whatever happens to be in the JSON file. How can I iterate through it
>> and do that?
>>
>> Also, what would be the best object to store this in so I can later
>> access it as I want to?
>>
>
> QJsonObject has iterator methods, and for each value you can check if it is
> itself an array or an object or a simple type (QJsonValue::isArray(),
> isObject(), isString() etc).
>
> As for another object, I can't think of another with this flexibility. Why
> not leave it in the QJson* objects?

My JSON file looks like this:


{
   "capData": {
  "host": "foo.bar.com",
  "initial_port": "8000"
  "secondary_port": "8001"
   },
   "django": {
  "host": "baz.bar.com",
  "port": "8004"
   }
}


My code looks like this:


  QFile file(QCoreApplication::applicationDirPath() + "/" + CONFIG_PATH);
  QByteArray val;
  QJsonDocument config_json;
  QJsonObject config;

  if (file.open(QIODevice::ReadOnly | QIODevice::Text)) {
val = file.readAll();
file.close();
config_json = QJsonDocument::fromJson(val);
config = config_json.object();
QJsonValue value = config.value("capData");
QJsonArray array = value.toArray();
foreach (const QJsonValue & v, array)
qWarning() << v.toObject().value("host").toString();
  }

I never enter my foreach loop, so I wrote out each variable with qWarning().

When I print out val it has:

"{\n   \"capData\": {\n  \"host\": \"foo.bar.com\",\n
\"initial_port\": \"8000\"\n  \"secondary_port\": \"8001\"\n
},\n   \"django\": {\n  \"host\": \"baz.bar.com\",\n
\"port\": \"8004\"\n   }\n}\n"

But when I print out config_json I get:

QJsonDocument()

When I print out config I get:

QJsonObject()

When I print out value I get:

QJsonValue(undefined)

When I print out array I get:

QJsonArray()

I am probably doing something very simple and very stupid wrong, but I
don't know what it is.
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


[Interest] iterate through JSON data

2016-05-16 Thread Larry Martell
I am reading in a JSON file that looks like this:

{
   "capData": {
  "host": "foo.bar.com",
  "initial_port": "8000"
  "secondary_port": "8001"
   },
   "django": {
  "host": "baz.bar.com",
  "port": "8004"
   }
}

I want to iterate through it and put the data in some structure that I
can access like this:

d['capData'].host
d['django'].port

I've see a lot of code that does something like this:

QJsonDocument document = QJsonDocument::fromJson(jsonData);
QJsonObject object = document.object();
QJsonValue value = object.value("capData");

But I don't want to hard code the keys - I want to pick up and store
whatever happens to be in the JSON file. How can I iterate through it
and do that?

Also, what would be the best object to store this in so I can later
access it as I want to?
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] including config file with macdeployqt

2016-05-13 Thread Larry Martell
Thanks. That answers the second part of my question.

Is there a way to get the config automagically included when I run macdeployqt?

On Fri, May 13, 2016 at 7:50 AM, Robert Iakobashvili
<corobe...@gmail.com> wrote:
> Dear Larry,
> I'd place it to Resources - so no issues at signing.
>
> Additionally, if you need some configs specific for each Mac-user,
> ~/Library/Application Support is the right place to arrange
> and entry for your company and inside entries for your software.
>
> Kind regards,
> Robert
>
>
> On Fri, May 13, 2016 at 1:42 PM, Larry Martell <larry.mart...@gmail.com> 
> wrote:
>> I am creating a bundle with macdeployqt to distribute my app. I want
>> to have a config file that my app will read at startup. How can I
>> include that config file in my bundle, and where is the proper place
>> for it to live on the file system on the machine the app gets
>> installed on?
>> ___
>> Interest mailing list
>> Interest@qt-project.org
>> http://lists.qt-project.org/mailman/listinfo/interest
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] including config file with macdeployqt

2016-05-13 Thread Larry Martell
Yes, I know it's just a dir. I was looking for a way for the config
file to be automagically included when the bundle is made with
macdeployqt.

And as far as the location goes, I was wondering if there is some
standard place like ~/Library/... or something where the config file
should live.

On Fri, May 13, 2016 at 7:46 AM, Gian Maxera <gmax...@gmail.com> wrote:.
> Mac bundle (after all) is just a directory.
> So, you can just copy the config file where you want inside the directory and 
> access it getting the path relative to application dir path 
> (QCoreApplication::applicationDirPath()).
>
>
>> On 13 May 2016, at 12:42, Larry Martell <larry.mart...@gmail.com> wrote:
>>
>> I am creating a bundle with macdeployqt to distribute my app. I want
>> to have a config file that my app will read at startup. How can I
>> include that config file in my bundle, and where is the proper place
>> for it to live on the file system on the machine the app gets
>> installed on?
>> ___
>> Interest mailing list
>> Interest@qt-project.org
>> http://lists.qt-project.org/mailman/listinfo/interest
>
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


[Interest] including config file with macdeployqt

2016-05-13 Thread Larry Martell
I am creating a bundle with macdeployqt to distribute my app. I want
to have a config file that my app will read at startup. How can I
include that config file in my bundle, and where is the proper place
for it to live on the file system on the machine the app gets
installed on?
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Getting response from external web page

2016-05-02 Thread Larry Martell
On Mon, May 2, 2016 at 5:07 PM, Jérôme Godbout <jer...@bodycad.com> wrote:
> Hi,
> Just an idea, after you submit, does the web page change url? maybe you
> could change it if possible, that would help you know the submit is
> completed via urlChanged() signal.
>
> Not sure which version of Qt, but if you can move to qwebengineview
> http://doc.qt.io/qt-5/qwebengineview.html

If I use QWebEngineView  how can I get the response from the page?

> The web page should store the answer somewhere and make it possible to
> access it.
>
> Not sure how to achieve that with QWidgets, in Qml with WebView you can
> request runJavaScript(), maybe someone can point out any equivalent for
> QWidget.
>
> Maybe if you redirect after submit, you could plain put the answer into the
> web page where you could read the content of the page once url changed to
> answer and page is finish loaded.
>
> Not sure if you have control over the webserver side or web page here.
>
> Jerome
>
>
> On Mon, May 2, 2016 at 4:19 PM, Larry Martell <larry.mart...@gmail.com>
> wrote:
>>
>> I have a situation where I want to bring up a web page that the user
>> will interact with, and when they click on a submit button a response
>> is sent, and I want to get that response in my Qt program and then
>> destroy the view with the page. I am able to bring up the page like
>> this:
>>
>>   Dialog.resize(1500, 1000);
>>   loginView = new QWebView();
>>   loginView->setObjectName(QStringLiteral("webView"));
>>   loginView->setUrl(QUrl(QStringLiteral("http://foo.bar.com/baz/;)));
>>   Dialog.exec();
>>
>> But I have no idea how I could get the response sent when the user
>> submits the page, nor how I would destroy the page.
>>
>> Can anyone help me with this?
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


[Interest] Getting response from external web page

2016-05-02 Thread Larry Martell
I have a situation where I want to bring up a web page that the user
will interact with, and when they click on a submit button a response
is sent, and I want to get that response in my Qt program and then
destroy the view with the page. I am able to bring up the page like
this:

  Dialog.resize(1500, 1000);
  loginView = new QWebView();
  loginView->setObjectName(QStringLiteral("webView"));
  loginView->setUrl(QUrl(QStringLiteral("http://foo.bar.com/baz/;)));
  Dialog.exec();

But I have no idea how I could get the response sent when the user
submits the page, nor how I would destroy the page.

Can anyone help me with this?

Thanks!
Larry
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


[Interest] SVG gradient not working on some machines

2016-03-30 Thread Larry Martell
I have some HTML that looks like this:











\


On some machines this works fine, but on other machines the entire
rectangle is black. There are no errors in QWebInspector, but in the
app's error log I see this message:

QCoreTextFontDatabase::fontEngine: CGFontCreateWithDataProvider failed

Anyone know what that means, and if that could be the cause of the SVG
issue, and how to fix this?
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] bug with # in URL when using setUrl?

2016-03-19 Thread Larry Martell
On Thu, Mar 17, 2016 at 11:39 AM, Thiago Macieira
<thiago.macie...@intel.com> wrote:
> On quinta-feira, 17 de março de 2016 09:39:44 PDT Larry Martell wrote:
>> GET https://code.jquery.com/jquery-2.1.4.min.js SSL handshake failed
>>
>> A couple of days back Thiago said:
>> > Check if you have OpenSSL available. It might be that the requests fail
>> > because they are HTTPS and there's no SSL support.
>> >
>> > If you're compiling on Mac from source, you may try the -securetransport
>> > option, which uses the Mac API instead of OpenSSL.
>>
>> So I want to understand this - Is this error occurring because these
>> machines do not have OpenSSL installed?
>
> It's possible.
>
>> Would rebuilding Qt with that option fix this?
>
> If they are Macs, yes. You can also solve the problem by installing a recent
> version of OpenSSL.

Rebuilt Qt with -securetransport and it did not fix the problem. In
any case, that is not a good solution for us, as that option is not
available on Windows. We are building an app that will be sold and
distributed as a dmg or setup.exe file. We cannot count on the users
having any given packages, so what I have done is downloaded the
static assets to our server and changed the html to load them to the
client from our servers instead of from the internet.

I really want to thank Thiago and Konstantin for all the help you gave
me and for being so patient with my ignorance of Qt. I could never
have tracked down this issue without you 2.
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] bug with # in URL when using setUrl?

2016-03-19 Thread Larry Martell
On Wed, Mar 16, 2016 at 12:04 PM, Konstantin Tokarev <annu...@yandex.ru> wrote:
>
>
> 16.03.2016, 18:39, "Larry Martell" <larry.mart...@gmail.com>:
>>  On Wed, Mar 16, 2016 at 6:29 AM, Konstantin Tokarev <annu...@yandex.ru> 
>> wrote:
>>>   16.03.2016, 02:15, "Larry Martell" <larry.mart...@gmail.com>:
>>>>   -How can I debug the Angular code?
>>>
>>>   QtWebKit has developer tools. You need to create QWebInspector, set 
>>> QWebPage to it,
>>>   and enable QWebSettings::DeveloperExtrasEnabled
>>>
>>>   You will get error console, JS debugger, and other goodies.
>>
>>  This sounds very promising but I can't quite figure out how to use it.
>>
>>  I have this JS code that's somehow downloaded (I assume by nginx). How
>>  do I integrate QWebInspector and QWebPage into the Qt app so they can
>>  access that code?
>
> In the beginning you've mentioned that you have QWebView. That's enough, you 
> can get QWebPage using page() method, you can create QWebInspector as a 
> separate widget (see code example in docs), call its setPage() method and 
> show it somewhere

Thanks. This is what I was doing before:

ui->webView->setUrl(url);

And I commented that out and I have this now:

  Dialog = new QDialog(this);
  ui->webView->setPage(url);
  QWebPage *page = ui->webView->page();
  QWebInspector *inspector = new QWebInspector(Dialog);
  inspector->setPage(page);
  Dialog->show();

Problem is that url is a QUrl and setPage wants a QWebPage *

(If you couldn't tell I am brand new to Qt.)
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] bug with # in URL when using setUrl?

2016-03-18 Thread Larry Martell
On Thu, Mar 17, 2016 at 8:11 AM, Larry Martell <larry.mart...@gmail.com> wrote:
> On Thu, Mar 17, 2016 at 6:41 AM, Konstantin Tokarev <annu...@yandex.ru> wrote:
>>
>>
>> 17.03.2016, 07:13, "Larry Martell" <larry.mart...@gmail.com>:
>>> On Wed, Mar 16, 2016 at 12:04 PM, Konstantin Tokarev <annu...@yandex.ru> 
>>> wrote:
>>>>  16.03.2016, 18:39, "Larry Martell" <larry.mart...@gmail.com>:
>>>>>   On Wed, Mar 16, 2016 at 6:29 AM, Konstantin Tokarev <annu...@yandex.ru> 
>>>>> wrote:
>>>>>>16.03.2016, 02:15, "Larry Martell" <larry.mart...@gmail.com>:
>>>>>>>-How can I debug the Angular code?
>>>>>>
>>>>>>QtWebKit has developer tools. You need to create QWebInspector, set 
>>>>>> QWebPage to it,
>>>>>>and enable QWebSettings::DeveloperExtrasEnabled
>>>>>>
>>>>>>You will get error console, JS debugger, and other goodies.
>>>>>
>>>>>   This sounds very promising but I can't quite figure out how to use it.
>>>>>
>>>>>   I have this JS code that's somehow downloaded (I assume by nginx). How
>>>>>   do I integrate QWebInspector and QWebPage into the Qt app so they can
>>>>>   access that code?
>>>>
>>>>  In the beginning you've mentioned that you have QWebView. That's enough, 
>>>> you can get QWebPage using page() method, you can create QWebInspector as 
>>>> a separate widget (see code example in docs), call its setPage() method 
>>>> and show it somewhere
>>>
>>> Thanks. This is what I was doing before:
>>>
>>> ui->webView->setUrl(url);
>>>
>>> And I commented that out and I have this now:
>>>
>>>   Dialog = new QDialog(this);
>>>   ui->webView->setPage(url);
>>
>> It should be
>>
>> ui->webView->setUrl(url);
>
> OK, I'll try that. I thought setUrl did a show and I only wanted to
> set the url and not show it at that point.

Thanks, I was able to get this to work. It's very cool and oh so
useful. And what I saw in the console was:

GET https://code.jquery.com/jquery-2.1.4.min.js SSL handshake failed

A couple of days back Thiago said:

> Check if you have OpenSSL available. It might be that the requests fail
> because they are HTTPS and there's no SSL support.
>
> If you're compiling on Mac from source, you may try the -securetransport
> option, which uses the Mac API instead of OpenSSL.

So I want to understand this - Is this error occurring because these
machines do not have OpenSSL installed?

Would rebuilding Qt with that option fix this?
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] bug with # in URL when using setUrl?

2016-03-18 Thread Larry Martell
On Wed, Mar 16, 2016 at 6:29 AM, Konstantin Tokarev <annu...@yandex.ru> wrote:
>
>
> 16.03.2016, 02:15, "Larry Martell" <larry.mart...@gmail.com>:
>> -How can I debug the Angular code?
>
> QtWebKit has developer tools. You need to create QWebInspector, set QWebPage 
> to it,
> and enable QWebSettings::DeveloperExtrasEnabled
>
> You will get error console, JS debugger, and other goodies.

This sounds very promising but I can't quite figure out how to use it.

I have this JS code that's somehow downloaded (I assume by nginx). How
do I integrate QWebInspector and QWebPage into the Qt app so they can
access that code?
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] bug with # in URL when using setUrl?

2016-03-15 Thread Larry Martell
On Tue, Mar 15, 2016 at 9:14 PM, Thiago Macieira
<thiago.macie...@intel.com> wrote:
> On terça-feira, 15 de março de 2016 19:15:03 PDT Larry Martell wrote:
>> So that led me to these questions:
>>
>> -What runs the JS code on the client?
>
> JavaScriptCore, WebKit's JS engine.

Is that part of Qt? I googled it, and it seems it's something that
comes with Mac's, but does it also come with Qt?

I've done some more testing on 5 different machines - 4 Mac's and 1
Windows. Unfortuanly no patterns emerged that I can draw any
conclusions from:

2 macs, both running Mavericks  where Qt was built from source and it
works on those
1 Windows, running 8, where Qt was built from source and it doesn't work there
1 mac running Mavericks that has the downloaded Qt libs installed and
it doesn't work there
1 mac running Mountain Lion that is running the packaged app from a
dmg file and it doesn't work there

>> -Is there a cache for the JS code and is it the case that 8000/# will
>> only actually go out on the wire if the routeProvider code is not
>> present on the client?
>
> No cache.

Interesting. So I'm wondering why I don't see the 8000/# request go
out on the wire.

>> -How can I debug the Angular code?
>
> No idea. That's not a Qt question. It's entirely possible that the AngularJS
> code is at fault here, doing some User-Agent matching (I don't know whether
> you set an UA or whether the default QtWebKit UA differs from platform to
> platform).

So if the OS comes with a JavaScriptCore would it use that or the Qt
one? Any how do I find out what version each platform has?

> What I'd make sure is that the DOM window.location is the same in all
> platforms given the same input URL. If that's the same, try to trigger the
> same requests that you saw in a working environment, using the same JS
> functions (XML HTTP Requests, whatever).

Thanks for the pointers!
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] bug with # in URL when using setUrl?

2016-03-15 Thread Larry Martell
On Tue, Mar 15, 2016 at 12:45 PM, Thiago Macieira
<thiago.macie...@intel.com> wrote:
> On terça-feira, 15 de março de 2016 12:04:34 PDT Larry Martell wrote:
>> > To make matters short, these two URLs are different:
>> >
>> > http://foo.bar.com:8000/#/workitem/12345
>> >
>> > scheme = http
>> > authority = foo.bar.com:8000
>> > path = /
>> > fragment = /workitem/12345
>> >
>> > http://foo.bar.com:8000/%23/workitem/12345
>> >
>> > scheme = http
>> > authority = foo.bar.com:8000
>> > path = /#/workitem/12345
>>
>> Not quite.
>
> Yes, quite. There's absolutely not ambiguity or room for discussion in what I
> said above.
>
> It may not be your issue, but the decomposition above is not up for discussion
> :-)
>
>> When http://foo.bar.com:8000/#/workitem/12345/abcd is sent by the
>> client (which is what happens on a Mac) what the server sees is:
>>
>> POST /workitem/12345/abcd
>
> That is wrong. The server should see
>
> GET /
>
> As I said above, this URL decomposes to a path of "/". Calling
> QWebView::setUrl() should also trigger a GET, not a POST.
>
> Now, you said something about JS. My guess is that the JS code you downloaded
> with the setUrl() is doing something with the fragment and downloading more
> data, via POST. That means the problem is between the JS engine and code, the
> DOM structure (which should have the fragment in the window.location object)
> and the webview.

I've learned some more about this but I still don't totally understand
it nor have I fixed the bug.

The nginx config routes requests to http://foo.bar.com:8000 to code
that downloads the Angular JS code to the client. When a # is in URL
the JS code consumes the request and sends out 3 requests of its own
to a different port.

The bug I am trying to fix is that on some clients it appears that the
http://foo.bar.com:8000 never gets sent. I say 'appears' because what
I see is that the 3 requests sent by the JS code never happen. But
debugging the Qt app showed me that
the code that sends it was always being executed and the url was
always properly formed.

Then my next thought was that even though the Qt code appeared to be
sending it, it wasn't making it out on the wire. So I downloaded
wireshark and monitored the traffic. But even on the working systems I
did not see the 8000/# request go out.

So that led me to these questions:

-What runs the JS code on the client?
-Is there a cache for the JS code and is it the case that 8000/# will
only actually go out on the wire if the routeProvider code is not
present on the client?
-How can I debug the Angular code?
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] bug with # in URL when using setUrl?

2016-03-15 Thread Larry Martell
On Tue, Mar 15, 2016 at 11:54 AM, Thiago Macieira
<thiago.macie...@intel.com> wrote:
> On terça-feira, 15 de março de 2016 11:45:12 PDT Larry Martell wrote:
>> >> QString urlStr = "http://foo.bar.com:8000/#/workitem/12345;;
>> >> QUrl reportUrl(urlStr);
>> >
>> > So I'm assuming you're misusing the term and that you did want a fragment.
>>
>> I realize that using # is typically a fragment, but apparently that is
>> not how Angular uses that character. If you look at
>> http://stackoverflow.com/questions/14319967/angularjs-routing-without-the-ha
>> sh you will see what I am referring to.
>
> That page is gibberish to me. I can't understand anything of that.

Nor can I.

> To make matters short, these two URLs are different:
>
> http://foo.bar.com:8000/#/workitem/12345
> scheme = http
> authority = foo.bar.com:8000
> path = /
> fragment = /workitem/12345
>
> http://foo.bar.com:8000/%23/workitem/12345
> scheme = http
> authority = foo.bar.com:8000
> path = /#/workitem/12345

Not quite.

When http://foo.bar.com:8000/#/workitem/12345/abcd is sent by the
client (which is what happens on a Mac) what the server sees is:

POST /workitem/12345/abcd

And the request is successfully served.

But when the URL does not have the # (i.e.
http://foo.bar.com:8000/workitem/12345/abcd, which is what happens on
Windows) the server sees this:

GET /workitem/12345

And that returns a 404.

This mapping of the URL is done by the Angular code when it sees the
#. On Windows it does not get it. I tried with the %23 and that
doesn't work on either platform.
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] bug with # in URL when using setUrl?

2016-03-15 Thread Larry Martell
On Tue, Mar 15, 2016 at 11:37 AM, Thiago Macieira
<thiago.macie...@intel.com> wrote:
> On terça-feira, 15 de março de 2016 07:04:49 PDT Larry Martell wrote:
>> Sorry for not giving more details. It's not a fragment - it's an
>
> You say "it's not a fragment" and then your URL uses a fragment:
>
>> QString urlStr = "http://foo.bar.com:8000/#/workitem/12345;;
>> QUrl reportUrl(urlStr);
>
> So I'm assuming you're misusing the term and that you did want a fragment.

I realize that using # is typically a fragment, but apparently that is
not how Angular uses that character. If you look at
http://stackoverflow.com/questions/14319967/angularjs-routing-without-the-hash
you will see what I am referring to.

>> Then it emits a signal, which has that QUrl parameter which causes
>> this code to run:
>>
>>   ui->webView->setUrl(url);
> [cut]
>> The link I referenced (https://bugreports.qt.io/browse/QTWEBKIT-56)
>> mentions a bug with setUrl with URLs with a #, so I was wondering if
>> that is why we are seeing issues on Windows.
>
> It's possible. I don't know anything about webviews and how they process URLs.
> My original statement is correct (the parser is wrong), but it just happens
> it's not your code, it's QWebView.
>
> Unfortunately, if it's buggy, it will remain buggy, no fix.

:-(
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] getting symbols in deployed mac app

2016-03-15 Thread Larry Martell
On Tue, Mar 15, 2016 at 10:33 AM, Larry Martell <larry.mart...@gmail.com> wrote:
> I am building my Qt app with symbols so I can use lldb. I use this
> cmake option "-DCMAKE_BUILD_TYPE=Debug". That indeed does make an
> executable that I debug locally on the machine I built it on.
>
> But if I then use macdeployqt to generate a dmg file, the executable
> in there does not seem to have symbols, so I cannot debug it with
> lldb.
>
> Is there a way to get the symbols into the dmg executable?

I found the -use-debug-libs option to macdeployqt and with that the
executable in the dmg does have symbols and works on the machine I
build it on. But when I copy the dmg to another mac it fails with:

Library not loaded: @rpath/QtOpenGL.framework/Versions/5/QtOpenGL
  Reason: image not found

If I don't build the dmg with -use-debug-libs and copy the dmg to
another machine it does work. This seems like a bug in macdeployqt.
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


[Interest] getting symbols in deployed mac app

2016-03-15 Thread Larry Martell
I am building my Qt app with symbols so I can use lldb. I use this
cmake option "-DCMAKE_BUILD_TYPE=Debug". That indeed does make an
executable that I debug locally on the machine I built it on.

But if I then use macdeployqt to generate a dmg file, the executable
in there does not seem to have symbols, so I cannot debug it with
lldb.

Is there a way to get the symbols into the dmg executable?
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] bug with # in URL when using setUrl?

2016-03-15 Thread Larry Martell
On Tue, Mar 15, 2016 at 1:32 AM, Thiago Macieira
<thiago.macie...@intel.com> wrote:
> On segunda-feira, 14 de março de 2016 18:30:13 PDT Larry Martell wrote:
>> We have an app that emits a URL with a hashtag in it (#) and that is
>> processed by some Angular JS code we have
>> (https://docs.angularjs.org/guide/$location). That URL is emitted with
>> setUrl. It works fine on a Mac, but on Windows it acts as if the #
>> were not there. Googling I found this:
>>
>> https://bugreports.qt.io/browse/QTWEBKIT-56
>>
>> Does anyone know if this bug could be the issue I am facing?
>
> "Emits a URL" isn't enough information, so I'm going to make some assumptions.
> I'm assuming that you're emitting a signal that has a QUrl parameter and the
> URL it carries contains a fragment (that is, it has a #). In the slot, you
> process the URL.

Sorry for not giving more details. It's not a fragment - it's an
Angular JS routing thing (https://docs.angularjs.org/guide/$location,
http://stackoverflow.com/questions/14319967/angularjs-routing-without-the-hash).
I don't really understand all that, as I didn't write this code, I
just inherited it and have to support it.

The code is something like this:

QString urlStr = "http://foo.bar.com:8000/#/workitem/12345;;
QUrl reportUrl(urlStr);

Then it emits a signal, which has that QUrl parameter which causes
this code to run:

  ui->webView->setUrl(url);

The Angular JS intercepts that URL and based on the # it does some
mapping to it.

On a Mac this works fine. The Angular code gets the URL with the # and
it does whatever it's supposed to do, and the server code gets the
proper mapped URL and all is well.

On Windows the URL Angular gets does not have the #, so it does not do
what it's supposed to do, and the server gets a bad URL and the
request fails.

The link I referenced (https://bugreports.qt.io/browse/QTWEBKIT-56)
mentions a bug with setUrl with URLs with a #, so I was wondering if
that is why we are seeing issues on Windows.



>
> There are no known problems with QUrl. Therefore, the problem is in your code
> that processes the URL.
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


[Interest] bug with # in URL when using setUrl?

2016-03-14 Thread Larry Martell
We have an app that emits a URL with a hashtag in it (#) and that is
processed by some Angular JS code we have
(https://docs.angularjs.org/guide/$location). That URL is emitted with
setUrl. It works fine on a Mac, but on Windows it acts as if the #
were not there. Googling I found this:

https://bugreports.qt.io/browse/QTWEBKIT-56

Does anyone know if this bug could be the issue I am facing?
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest