Re: [Interest] Icons on macOS

2018-10-08 Thread Mitch Curtis
The Qbs docs state that there is no direct equivalent to ICON:

https://doc.qt.io/qbs/porting-to-qbs.html#icon

I’ve got this Qbs code that points to the .xcassets directory:

Group {
name: "macOS (icons)"
condition: qbs.targetOS.contains("macos")
files: ["images/logo/slate.xcassets"]
}

This sets the icon name:

Properties {
condition: qbs.targetOS.contains("macos")
ib.appIconName: "slate-icon-mac"
//bundle.infoPlist: {
//CFBundleIconFile: 
"images/logo/slate.xcassets/slate-icon-mac.appiconset"
//}
}

When you mentioned deploying the icon file to the app bundle I double-checked 
what was in the Resources directory:

Assets.car
slate-icon-mac.icns

So it seems to be there, albeit in the form of an icns file.. not sure what’s 
going on there.

On 10/8/18, 9:58 PM, "Artem Sidyakin"  wrote:

With qmake project file it's just this one line, nothing else is required:

ICON = icon.icns

It will deploy the icon file to the app bundle and put the corresponding 
line into Info.plist.

Unfortunately, I don’t know how it is done with Qbs as I never used it.

---
Artem Sidyakin

> On 8 Oct 2018, at 19:15, Mitch Curtis  wrote:
> 
> I’m trying to add icons to an application on macOS. My Qbs file looks 
like this:
> 
> https://github.com/mitchcurtis/slate/tree/master/app/app.qbs
> 
> The generated assetcatalog_generated_info.plist file looks like this:
> 
> 
> http://www.apple.com/DTDs/PropertyList-1.0.dtd";>
> 
> 
>   CFBundleIconFile
>   slate-icon-mac
>   CFBundleIconName
>   slate-icon-mac
> 
> 
> 
> The contents of slate.xcassets:
> 
> 
https://github.com/mitchcurtis/slate/tree/master/app/images/logo/slate.xcassets
> 
> I don’t see the icon in the dock or anywhere else.
> 
> I saw this page:
> 
> http://doc.qt.io/qt-5/appicon.html#setting-the-application-icon-on-macos
> 
> It says:
> 
> “The application icon, typically displayed in the application dock area, 
is set by calling QWindow::setWindowIcon() on a window.”
> 
> However, the app that I’m basing my setup on doesn’t do that. It actually 
avoids macOS when it sets the window icon and yet still manages to get an icon 
to show up:
> 
> 
https://github.com/bjorn/tiled/blob/0b01a9c907e6cd6531204c32e36ea51af75f3bfc/src/tiled/mainwindow.cpp#L233
> 
> Another thing is that an asset catalog contains many .png files. I was 
under the impression that the point of it was for the OS to pick the correct 
image based on the metadata provided in the Contents.json file, so how would I 
know which size .png to set?
> 
> The rest of that page describes icns files, which the documentation 
explicitly says to avoid 
(https://developer.apple.com/design/human-interface-guidelines/macos/icons-and-images/app-icon/),
 so it seems like it might be a bit out-dated.
> 
> So, how is this supposed to be done?
> 
> ___
> 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] cmake and auto-generated sources

2018-10-08 Thread René J . V . Bertin
Thiago Macieira wrote:

> You should build your project once for all the generated files to be present.

I know, and it would be very useful if you didn't have to do that. The question 
was how possible this would be...

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


Re: [Interest] Icons on macOS

2018-10-08 Thread Artem Sidyakin
With qmake project file it's just this one line, nothing else is required:

ICON = icon.icns

It will deploy the icon file to the app bundle and put the corresponding line 
into Info.plist.

Unfortunately, I don’t know how it is done with Qbs as I never used it.

---
Artem Sidyakin

> On 8 Oct 2018, at 19:15, Mitch Curtis  wrote:
> 
> I’m trying to add icons to an application on macOS. My Qbs file looks like 
> this:
> 
> https://github.com/mitchcurtis/slate/tree/master/app/app.qbs
> 
> The generated assetcatalog_generated_info.plist file looks like this:
> 
> 
>  "http://www.apple.com/DTDs/PropertyList-1.0.dtd";>
> 
> 
>   CFBundleIconFile
>   slate-icon-mac
>   CFBundleIconName
>   slate-icon-mac
> 
> 
> 
> The contents of slate.xcassets:
> 
> https://github.com/mitchcurtis/slate/tree/master/app/images/logo/slate.xcassets
> 
> I don’t see the icon in the dock or anywhere else.
> 
> I saw this page:
> 
> http://doc.qt.io/qt-5/appicon.html#setting-the-application-icon-on-macos
> 
> It says:
> 
> “The application icon, typically displayed in the application dock area, is 
> set by calling QWindow::setWindowIcon() on a window.”
> 
> However, the app that I’m basing my setup on doesn’t do that. It actually 
> avoids macOS when it sets the window icon and yet still manages to get an 
> icon to show up:
> 
> https://github.com/bjorn/tiled/blob/0b01a9c907e6cd6531204c32e36ea51af75f3bfc/src/tiled/mainwindow.cpp#L233
> 
> Another thing is that an asset catalog contains many .png files. I was under 
> the impression that the point of it was for the OS to pick the correct image 
> based on the metadata provided in the Contents.json file, so how would I know 
> which size .png to set?
> 
> The rest of that page describes icns files, which the documentation 
> explicitly says to avoid 
> (https://developer.apple.com/design/human-interface-guidelines/macos/icons-and-images/app-icon/),
>  so it seems like it might be a bit out-dated.
> 
> So, how is this supposed to be done?
> 
> ___
> 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] proper (silent) exit in response to SIGHUP?

2018-10-08 Thread Thiago Macieira
On Monday, 8 October 2018 12:45:19 PDT Giuseppe D'Angelo via Interest wrote:
> Il 08/10/2018 09:50, René J.V. Bertin ha scritto:
> > That sounds real easy indeed ;)
> > 
> >> Create a QSocketNotifier on the reading end of the pipe or on the
> >> eventfd,
> >> connect its activation signal to a slot that does what you want.
> > 
> > What is the purpose of the pipe/eventfd detour? Can't I just call a
> > function or signal a slot directly?
> Given we're already in Linux-specific domain, also signalfd(2) comes
> into mind.

Please don't use that, it's a worse solution.

signalfd(2) requires that the UNIX signal in question be blocked in all 
threads, otherwise UNIX signal handlers take precedence over the signalfd. You 
can accomplish that by:

 a) blocking the signal in the main thread before any other threads are 
   started (this includes the XCB event thread, so before QApplication)
 b) ensuring no thread unblocks the signal, so you must know what each and 
   every library does, internally

Usually you can use signalfd from the application code, but it's not an 
acceptable solution for a library. That's why we don't use it in Qt. But even 
for applications, it's not meant for complex, multi-threaded ones, just like 
timerfd(2) is often a worse solution that calculating your own timeouts.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center



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


Re: [Interest] proper (silent) exit in response to SIGHUP?

2018-10-08 Thread Thiago Macieira
On Monday, 8 October 2018 10:46:31 PDT René J.V. Bertin wrote:
> Thiago Macieira wrote:
> >> What is the purpose of the pipe/eventfd detour? Can't I just call a
> >> function or signal a slot directly?
> > 
> > You can call _exit. You can't call much else. You can only call the
> > functions
> OK, got it.
> 
> I take it that the QSocketNotifier lives on the main thread and connects to
> a slot that lives there too, somehow preventing the signal handler from
> returning which could lead to the application exitting prematurely?

The slot can live in any thread, but yes in general you'd place it in the main 
thread.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center



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


Re: [Interest] proper (silent) exit in response to SIGHUP?

2018-10-08 Thread Giuseppe D'Angelo via Interest

Il 08/10/2018 09:50, René J.V. Bertin ha scritto:

That sounds real easy indeed ;)


Create a QSocketNotifier on the reading end of the pipe or on the eventfd,
connect its activation signal to a slot that does what you want.

What is the purpose of the pipe/eventfd detour? Can't I just call a function or 
signal a slot directly?



Given we're already in Linux-specific domain, also signalfd(2) comes 
into mind.


My 2 c,
--
Giuseppe D'Angelo | giuseppe.dang...@kdab.com | Senior Software Engineer
KDAB (France) S.A.S., a KDAB Group company
Tel. France +33 (0)4 90 84 08 53, http://www.kdab.com
KDAB - The Qt, C++ and OpenGL Experts



smime.p7s
Description: Firma crittografica S/MIME
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] proper (silent) exit in response to SIGHUP?

2018-10-08 Thread René J . V . Bertin
Thiago Macieira wrote:

>> What is the purpose of the pipe/eventfd detour? Can't I just call a function
>> or signal a slot directly?
> 
> You can call _exit. You can't call much else. You can only call the functions

OK, got it.

I take it that the QSocketNotifier lives on the main thread and connects to a 
slot that lives there too, somehow preventing the signal handler from returning 
which could lead to the application exitting prematurely?

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


[Interest] Icons on macOS

2018-10-08 Thread Mitch Curtis
I’m trying to add icons to an application on macOS. My Qbs file looks like this:

https://github.com/mitchcurtis/slate/tree/master/app/app.qbs

The generated assetcatalog_generated_info.plist file looks like this:


http://www.apple.com/DTDs/PropertyList-1.0.dtd";>


CFBundleIconFile
slate-icon-mac
CFBundleIconName
slate-icon-mac



The contents of slate.xcassets:

https://github.com/mitchcurtis/slate/tree/master/app/images/logo/slate.xcassets

I don’t see the icon in the dock or anywhere else.

I saw this page:

http://doc.qt.io/qt-5/appicon.html#setting-the-application-icon-on-macos

It says:

“The application icon, typically displayed in the application dock area, is set 
by calling QWindow::setWindowIcon() on a window.”

However, the app that I’m basing my setup on doesn’t do that. It actually 
avoids macOS when it sets the window icon and yet still manages to get an icon 
to show up:

https://github.com/bjorn/tiled/blob/0b01a9c907e6cd6531204c32e36ea51af75f3bfc/src/tiled/mainwindow.cpp#L233

Another thing is that an asset catalog contains many .png files. I was under 
the impression that the point of it was for the OS to pick the correct image 
based on the metadata provided in the Contents.json file, so how would I know 
which size .png to set?

The rest of that page describes icns files, which the documentation explicitly 
says to avoid 
(https://developer.apple.com/design/human-interface-guidelines/macos/icons-and-images/app-icon/),
 so it seems like it might be a bit out-dated.

So, how is this supposed to be done?

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


Re: [Interest] proper (silent) exit in response to SIGHUP?

2018-10-08 Thread Thiago Macieira
On Monday, 8 October 2018 00:50:50 PDT René J.V. Bertin wrote:
> Thiago Macieira wrote:
> 
> That sounds real easy indeed ;)
> 
> > Create a QSocketNotifier on the reading end of the pipe or on the eventfd,
> > connect its activation signal to a slot that does what you want.
> 
> What is the purpose of the pipe/eventfd detour? Can't I just call a function
> or signal a slot directly?

You can call _exit. You can't call much else. You can only call the functions 
listed in this man page from a signal handler:
http://man7.org/linux/man-pages/man7/signal-safety.7.html

NEVER allocate memory and NEVER lock a mutex in a signal handler.

> > Exiting with exit() is not expected to work with Qt. Normal exit must
> > return from main(), so you should simply ask the QCoreApplication main
> > event loop to exit (quit() slot).
> 
> A KDE dev told me a SIGHUP should already work (contrary to my experience).
> So I tried it on a complex app running locally and it turns out that it
> indeed went through its regular shut-down cycle. Including unsaved file
> alerts.

That might be a KF5 add-on. Qt doesn't do that by itself.

> This sort of YMMV is why I didn't wonder aloud why Qt doesn't attempt to
> catch SIGHUP itself, to invoke QCoreApplication::quit.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center



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


Re: [Interest] Connection problems with QNerworkAccessManager

2018-10-08 Thread ekke
have you tried 5.11.2, 5.12 Beta or 5.10.1 ?

Am 08.10.18 um 12:35 schrieb Roman Wüger:
> Hi,
>
> i use Qt 5.11.1 at the moment and have some connection problems with 
> QNetworkAccessManager.
> There are no error, sslerror or finished signals emitted, but I see the 
> traffic in Wireshark.
> The problem occurs on Windows, Mac and iOS.
>
> When I enter the url in the browser, then it is working without a problem.
>
> Any hints?
>
> Thanks in advance
> ___
> 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] Connection problems with QNerworkAccessManager

2018-10-08 Thread Roman Wüger
Hi,

i use Qt 5.11.1 at the moment and have some connection problems with 
QNetworkAccessManager.
There are no error, sslerror or finished signals emitted, but I see the traffic 
in Wireshark.
The problem occurs on Windows, Mac and iOS.

When I enter the url in the browser, then it is working without a problem.

Any hints?

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


Re: [Interest] proper (silent) exit in response to SIGHUP?

2018-10-08 Thread René J . V . Bertin
Thiago Macieira wrote:

That sounds real easy indeed ;)

> Create a QSocketNotifier on the reading end of the pipe or on the eventfd,
> connect its activation signal to a slot that does what you want.

What is the purpose of the pipe/eventfd detour? Can't I just call a function or 
signal a slot directly?

> Exiting with exit() is not expected to work with Qt. Normal exit must return
> from main(), so you should simply ask the QCoreApplication main event loop to
> exit (quit() slot).

A KDE dev told me a SIGHUP should already work (contrary to my experience). So 
I tried it on a complex app running locally and it turns out that it indeed 
went through its regular shut-down cycle. Including unsaved file alerts.

> But if you wanted that, you wouldn't need to add a signal handler, since
> SIGHUP's default behaviour is to terminate the application.

True, though I'm not sure how picky one can be if you want to avoid attempts at 
interaction with the user. I'd expect that calling the dtor on an instance of a 
document class holding an unsaved document would trigger "do you want to save 
this file" dialog. Dtors in the XCB plugin could well try to close down 
properly, making calls that block if the remote server has become unavailable.

This sort of YMMV is why I didn't wonder aloud why Qt doesn't attempt to catch 
SIGHUP itself, to invoke QCoreApplication::quit.

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