[Development] font selection and weight/style support on OS X: (possible regression from Qt 4 to Qt 5

2015-04-18 Thread René J . V . Bertin
Hello,

The specific question: how/where is (QFontEngine *)fe->ctfont set that is read 
in QFontDialogPrivate::setFont (qfontdialog_mac.mm around line 514)?

I have been looking into an issue with the selection of fonts in weights/styles 
that don't follow the usual four suspects (Normal, Italic, Bold, Bold-Italic).
In stock Qt 4.8, selecting a Medium or Semi Bold weight (i.e. a weight between 
normal and bold) works during the initial selection (say in qtconfig's default 
font selection), but open the font dialog once more, or relaunch the 
application, and that medium weight will have been replaced by standard bold.

I think I have a fix for this in Qt 4.8, which removes the "easy shortcut" I 
found in 2 places ("there's Normal and anything heavier which becomes Bold") 
and extends the weight string parser to support most of the font weights you'll 
find on a typical OS X install.

It turns out that almost inevitably I came up with code that looks a lot like 
what had already been done for Qt 5.4 (I swear, I didn't peak :)) except that I 
didn't introduce additional const variables to complement the existing 
QFont::DemiBold etc. styles.

We're getting to the question.
When opening the font dialog with an initial font, Qt 4 calls 
QFontDialogPrivate::setFont() where Qt 5.4 uses 
QCocoaFontPanel::setCurrentFont() . Both functions (can) use [NSFontManager 
fontWithFamily:traits:weight:size], but the Qt4 version is actually called with 
fe->ctfont already set to the appropriate NSFont*. 

And that seems to work more reliably. I have several fonts on my system 
(including the Apple-provided Avenir family) where 
fontWithFamily:traits:weight:size does *not* return the requested typeface, as 
if the weight parameter is ignored. And indeed the documentation for that 
function suggests that the weight parameter is used as a hint only 
(https://developer.apple.com/library/mac/documentation/Cocoa/Reference/ApplicationKit/Classes/NSFontManager_Class/index.html#//apple_ref/occ/instm/NSFontManager/fontWithFamily:traits:weight:size:)
 though I *hope* that it's used as more than a hint when the requested weight 
actually exists.

Hence my question: where is fe->ctfont initialised? Clearly this uses a 
different method for obtaining the NSFont (or CFFontRef).

Note that I've already tried to put all chances on my side for weight: to be 
used as more than a hint. I've analysed the weights in question for all fonts 
on my system (Apple's documentation doesn't bother to document the exact value 
mapping), and came up with the following

+// RJVB
+// Thin,Light -> 3, Book -> 4
+// Normal/Regular -> 5
+// Medium/SemiBold/Demibold -> 6,7,8
+// Bold -> 9
+// Ultra/Black/Heavy -> 10,11
+QByteArray *weights = NULL;
+switch (font.weight()) {
+case QFont::Light:
+weights = new QByteArray((const char[]){3,4});
+break;
+case QFont::Normal:
+weights = new QByteArray((const char[]){5});
+break;
+case QFont::DemiBold:
+weights = new QByteArray((const char[]){6,7,8});
+break;
+case QFont::Bold:
+weights = new QByteArray((const char[]){9});
+break;
+case QFont::Black:
+weights = new QByteArray((const char[]){10,11});
+break;
 }

(evidently I did the same for Apple's other scale, that goes from -1.0 to 1.0). 
I then test each of the weights corresponding to font.weight():

+if (weights) {
+nsFont = NULL;
+for (int i = 0 ; i < weights->size() && !nsFont ; ++i) {
+weight = (int) (*weights)[i];
+nsFont = [mgr 
fontWithFamily:qt_mac_QStringToNSString(fontInfo.family())
+ traits:mask
+ weight:weight
+ size:fontInfo.pointSize()];
+}
+delete weights;
+}

the only thing I haven't yet added is an additional check whether 
fontWithFamily did indeed return the requested weight, and not the closest 
lower match (which would let DemiBold downgrade to Normal, or Ultra to Bold).

Thanks for bearing with me, and (even more :)) for any feedback!

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


[Development] Building Modules

2015-04-18 Thread mark diener
Hello:

How does one remove a submodule from a  git repository build?

(even if I already downloaded it)

In this case, I want qlalr submodule to be removed from the build process.

Qlalr does not build on Windows

Any responses, thanks.

Mark
___
Development mailing list
Development@qt-project.org
http://lists.qt-project.org/mailman/listinfo/development


[Development] Modules and skip

2015-04-18 Thread mark diener
Hello:

The following table lists the Qt essentials.

I am building Qt from scratch and I am having a bit of trouble finding

where the modules that I can remove from the build are located.

Generally in configure, there are -skip directives

For example:

configure -skip qtserialport

Where can I find the comprehensive list of names and what I can skip on
configure?

How can I remove qtnetwork when the NetworkAccessManager seems to be tied
to the

gman = view()->engine()->NetworkAccessmanager() ;

This implies the network code is not properly isolated from the GUI layer.
How to break

this linkage without major source code changes?

Thanks,

Mark


 ModuleDescription Qt Core Core
non-graphical classes used by other modules. Qt GUI
Base classes for graphical user
interface (GUI) components. Includes OpenGL. Qt Multimedia
Classes for audio, video,
radio and camera functionality. Qt Multimedia Widgets
Widget-based classes
for implementing multimedia functionality. Qt Network
Classes to make network
programming easier and more portable. Qt QML
Classes for QML and JavaScript
languages. Qt Quick A declarative
framework for building highly dynamic applications with custom user
interfaces. Qt Quick Controls
Reusable Qt Quick based
UI controls to create classic desktop-style user interfaces. Qt Quick
Dialogs Types for creating
and interacting with system dialogs from a Qt Quick application. Qt Quick
Layouts Layouts are items
that are used to arrange Qt Quick 2 based items in the user interface. Qt
SQL Classes for database
integration using SQL. Qt Test Classes
for unit testing Qt applications and libraries. Qt WebKit
Classes for a WebKit2 based
implementation and a new QML API. See also Qt WebKit Widgets in the add-on
modules. Qt WebKit Widgets
WebKit1 and QWidget
-based classes from Qt 4. Qt Widgets
Classes to extend Qt GUI with
C++ widgets.

If you use qmake  to build
your projects, the Qt Core  and Qt
GUI  modules are included by
default. To link only against Qt Core, add the following line to your .pro
file:

QT -= gui

On Windows, if you do not use qmake
 or other build tools such
as CMake , you also need to link
against the qtmain library.
 Qt Add-Ons

*Qt Add-On* modules bring additional value for specific purposes. These
modules may only be available on some development platform. Many add-on
modules are either feature-complete and exist for backwards compatibility,
or are only applicable to certain platforms. Each add-on module specifies
its compatibility promise separately.

The Qt installers include the option of downloading the add-ons. For more
information, visit the Getting Started with Qt
 page.

The following table lists the Qt add-ons:
 ModuleDevelopment PlatformsTarget PlatformsDescription Active Qt
Windows

Classes for applications which use ActiveX and COM Enginio
AllAllA Backend-as-a-Service
solution to ease the backend development for connected and data-driven
applications. Qt Android Extras
AllAndroid
Provides platform-specific APIs
for Android. Qt Bluetooth All
Android , Linux
, Blackberry
Provides access to Bluetooth hardware. Qt
Concurrent 

Classes for writing multi-threaded programs without using low-level
threading primitives. Qt D-Bus All
Classes for inter-process communication over the D-Bus protocol. Qt
Graphical Effects All
Graphical effects for use with Qt Quick 2. Qt Image Formats
All
Plugins for additional image formats: TIFF, MNG, TGA, WBMP. Qt Mac Extras


[Development] qtplugininfo install fails

2015-04-18 Thread Harri Pasanen
Just updated my 5.5 tree,  qttools/src ad31b98

Seems like qtplugininfo is ignoring the -prefix passed to configure:

cd qtplugininfo/ && ( test -e Makefile || 
/home/harri/src/qt5/qtbase/bin/qmake 
/home/harri/src/qt5/qttools/src/qtplugininfo/qtplugininfo.pro -o 
Makefile ) && make -f Makefile install
make[3]: Entering directory '/home/harri/src/qt5/qttools/src/qtplugininfo'
mkdir: cannot create directory ‘/libs’: Permission denied


Harri
___
Development mailing list
Development@qt-project.org
http://lists.qt-project.org/mailman/listinfo/development


Re: [Development] Qt 'minimal' platform no rendering alpha/opacity.

2015-04-18 Thread Agocs Laszlo
The code snippet has no relation whatsoever to what setWindowOpacity is doing. 
If you are only after having transparent (alpha == 0) areas on the window, then 
there is no difference with 'minimal' compared to any other platform. In fact 
it's much easier since you won't need to worry about having transparency 
functional on the windowing system level. Just writing out pixels with an alpha 
of 0 is good enough, f.ex.:

tlw.setAutoFillBackground(true);
tlw.setBrush(QPalette::Window, Qt::transparent);

See http://doc.qt.io/qt-5.4/qwidget.html#transparency-and-double-buffering

Cheers,
Laszlo

From: Paul Knopf mailto:theonlylawisl...@gmail.com>>
Date: Friday 17 April 2015 17:45
To: Agocs Laszlo 
mailto:laszlo.ag...@theqtcompany.com>>
Cc: "development@qt-project.org" 
mailto:development@qt-project.org>>
Subject: Re: [Development] Qt 'minimal' platform no rendering alpha/opacity.

What do you mean when you say "compositor"? Are you referring to a window 
system?

Is this something that is possible to implement with the minimal project? What 
would have to change?

I have need a custom platform that encodes the ARGB (proprietary, vendor 
specific) to the linux framebuffer, but the alpha channel has to actually be 
correct.

How come I can do this without a compositor?


QImage bitmap(widget.size(), QImage::Format_ARGB32);

bitmap.fill(Qt::transparent);

QPainter painter(&bitmap);

widget.render(&painter, QPoint(), QRegion(), QWidget::DrawChildren);

bitmap.save("file.png");

There must be a way to achieve the same result using a platform plugin.

If all else fails, I could create my own thread loop that renders the QWidget 
with the above code and outputs it to my driver manually, instead of going 
through the platform plugins, but I would like to support the platform plugin 
so that I can then switch it out to develop locally using standard Qt platforms 
(X11, etc).

On Fri, Apr 17, 2015 at 10:32 AM, Agocs Laszlo 
mailto:laszlo.ag...@theqtcompany.com>> wrote:
You do have alpha because the minimal's backingstore uses ARGB32_Premultiplied 
for the backing QImage.

What you do not have is setWindowOpacity(). You would need to implement 
QPlatformWindow::setOpacity() for that, but that is not possible with minimal 
since there is no compositor that could apply the opacity to the window 
contents during the composition step.

Best regards,
Laszlo

From: Paul Knopf mailto:theonlylawisl...@gmail.com>>
Date: Friday 17 April 2015 16:20
To: "development@qt-project.org" 
mailto:development@qt-project.org>>
Subject: [Development] Qt 'minimal' platform no rendering alpha/opacity.

I am testing the 'minimal' platform (mine is based off of it), and it seems 
that is doesn't render the alpha channel (setting opacity).

Here is a gist of my 
main function testing the opacity.

The saved images seems to have a tan background and no transparency.

Any ideas on how to get the alpha channel represented in the platform backing 
store?

--
Thanks!

~Paul



--
Thanks!

~Paul
___
Development mailing list
Development@qt-project.org
http://lists.qt-project.org/mailman/listinfo/development


Re: [Development] Modules and skip

2015-04-18 Thread Thiago Macieira
On Saturday 18 April 2015 10:02:19 mark diener wrote:
> The following table lists the Qt essentials.
> 
> I am building Qt from scratch and I am having a bit of trouble finding
> 
> where the modules that I can remove from the build are located.
> 
> Generally in configure, there are -skip directives
> 
> For example:
> 
> configure -skip qtserialport
> 
> Where can I find the comprehensive list of names and what I can skip on
> configure?

Run from the top dir:
ls

That's the list you can skip.

> How can I remove qtnetwork when the NetworkAccessManager seems to be tied
> to the
> 
> gman = view()->engine()->NetworkAccessmanager() ;

You cannot exclude QtNetwork and you cannot skip qtbase.

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

___
Development mailing list
Development@qt-project.org
http://lists.qt-project.org/mailman/listinfo/development


Re: [Development] Building Modules

2015-04-18 Thread Thiago Macieira
On Saturday 18 April 2015 09:47:28 mark diener wrote:
> Hello:
> 
> How does one remove a submodule from a  git repository build?
> 
> (even if I already downloaded it)
> 
> In this case, I want qlalr submodule to be removed from the build process.
> 
> Qlalr does not build on Windows

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

___
Development mailing list
Development@qt-project.org
http://lists.qt-project.org/mailman/listinfo/development