Fix color buttons disappearing in windows when alpha is set (fix #10187)

Here's a fix for 10187, where colour buttons disappear completely when the colour has an alpha set on Windows. This bug is cause by user's temporary folder path being returned in short file name format by QTemporaryFile (and also by all QDir::tempPath and similar functions). Most qt functions handle short filename paths without issue, but trying to include short filename paths in stylesheets results in qt rejecting the stylesheet and not rendering the button at all. This patch uses the windows api GetLongPathName function to expand out the temporary file's path to a full long pathname, which means the stylesheet is parsed correctly and the button drawn.
Just go with what is there now.  It's not a breaking feature if it doesn't
work with unicode right away.

- Nathan


On Sat, Jun 7, 2014 at 7:05 PM, Nyall Dawson <notifications@github.com>
wrote:

> In src/gui/qgscolorbutton.cpp:
>
> > @@ -26,6 +26,25 @@
> >  #include <QMenu>
> >  #include <QClipboard>
> >
> > +#ifdef Q_OS_WIN
> > +#include <windows.h>
> > +QString QgsColorButton::fullPath( const QString &path )
> > +{
> > +  TCHAR buf[MAX_PATH];
> > +  int len = GetLongPathName( path.toUtf8().constData(), buf, MAX_PATH );
>
> @NathanW2 <https://github.com/NathanW2> I can't get a build working using
> GetLongPathNameW. This would require use of QString::toWCharArray, but if I
> attempt to build using that I get a bunch of linker errors. There's a
> solution to this, but it's out of my comfort zone (
> http://stackoverflow.com/questions/5625884/conversion-of-stdwstring-to-qstring-throws-linker-error
> )
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/qgis/QGIS/pull/1392/files#r13518724>.
>