Weird appearance of color buttons in Windows
Originally reported on Google Code with ID 86
Johan has reported this and I've confirmed it in a Windows laptop.
Actually, in the laptop I could see a portrait rectangle with the color,
but in Linux it appears perfectly square.
Reported by helder.pereira.correia
on 2007-07-23 23:02:56
<hr> * Attachment: buttons.png<br>
Comments (16)
-
Account Deleted -
Account Deleted ``` Committed, can you please check? ```
Reported by `helder.pereira.correia` on 2007-07-24 23:35:22
-
``` It looks better, as the colour is visible now, but it still lacks polish. The black rect and filling does not match and the buttons have margins on the top and bottom, but not on the sides. See attachment. ```
Reported by `e8johan` on 2007-07-25 20:57:03
<hr>
- *Attachment: cb-bug.png<br>![cb-bug.png](https://storage.googleapis.com/google-code-attachments/speedcrunch/issue-86/comment-3/cb-bug.png)*
-
Account Deleted ``` Good enough for now :) I could set as fixed, but I'll mark as milestone 0.9 so we can try to improve it later. ```
Reported by `helder.pereira.correia` on 2007-07-25 20:59:44 - Labels added: Milestone-0.9 - Labels removed: Milestone-0.8
-
Account Deleted ``` Someone should write a decent color picker. There is one in Qt Solution but not GPL.
When SpeedCrunch is optionally integrated with KDE, it's easy: just pick KDE's color picker. But we still must provide the solution for other platforms. ```
Reported by `ariya.hidayat` on 2007-07-26 11:59:42
-
Account Deleted ``` I have integrated Witold Wysota's color button widgets.
If someone can verify whether this works nicely in Windows and Mac... ```
Reported by `ariya.hidayat` on 2007-10-09 15:01:29
-
Account Deleted Reported by `helder.pereira.correia` on 2007-10-09 22:00:00 - Status changed: `Fixed`
-
``` I've tested this on Windows. The buttons look good, but I had to undefine the Q_WW_EXPORT macro and define it as any empty macro (remove it) to make this code compile properly. Otherwise I get this:
[ 69%] Building CXX object CMakeFiles/speedcrunch.dir/moc_qwwcolorbutton.obj C:\coding\johans\speedcrunch\code\trunk\src\build\moc_qwwcolorbutton.cxx:60: error: definition of static data member 'QwwColorButton::staticMetaObject' of dllimport'd class. C:\coding\johans\speedcrunch\code\trunk\src\build\moc_qwwcolorbutton.cxx:60: warning: 'QwwColorButton::staticMetaObject' defined locally after being referenced with dllimport linkage C:\coding\johans\speedcrunch\code\trunk\src\build\moc_qwwcolorbutton.cxx:135: warning: function 'void QwwColorButton::colorPicked(QColor)' is defined after prior declaration as dllimport: attribute ignored C:\coding\johans\speedcrunch\code\trunk\src\build\moc_qwwcolorbutton.cxx:135: warning: 'void QwwColorButton::colorPicked(QColor)' defined locally after being referenced with dllimport linkage mingw32-make[2]: * [CMakeFiles/speedcrunch.dir/moc_qwwcolorbutton.obj] Error 1 mingw32-make[1]: * [CMakeFiles/speedcrunch.dir/all] Error 2 mingw32-make: * [all] Error 2
I seem to recall having this issue and solving it the last time I tested the wwWidgets on Windows as well. ```
Reported by `e8johan` on 2007-10-12 16:20:23 - Status changed: `Accepted`
-
Account Deleted Reported by `helder.pereira.correia` on 2007-11-03 19:45:36 - Status changed: `Started`
-
Account Deleted Reported by `helder.pereira.correia` on 2007-11-18 17:11:55 - Labels added: Milestone-0.10 - Labels removed: Milestone-0.9
-
``` solved, patch committed to trunk. ```
Reported by `e8johan` on 2007-11-22 16:32:16
-
Reported by `e8johan` on 2007-11-22 16:32:56 - Status changed: `Fixed`
-
Account Deleted ``` wwWidgets were removed from the tree. It will be possible to choose from predefined color schemes only. ```
Reported by `helder.pereira.correia` on 2008-02-19 01:15:11
-
repo owner -
repo owner - changed component to userinterface
-
repo owner - changed status to closed
- Log in to comment
``` I guess it does not really matter whether it's square or not. But the size should not be sensible indeed.
How about this patch:
Index: configdlg.cpp
--- configdlg.cpp (revision 608) +++ configdlg.cpp (working copy) @@ -359,6 +359,20 @@ return d->color; }
+QSize ColorButton::sizeHint() const +{ + ensurePolished(); + + int w = 16, h = 16; + QStyleOptionButton opt; + opt.initFrom(this); + + QSize sh = style()->sizeFromContents(QStyle::CT_PushButton, &opt, QSize(w, h), this); + sh = sh.expandedTo(QApplication::globalStrut()); + + return sh; +} + void ColorButton::showColorPicker() { QColor newColor = QColorDialog::getColor( d->color, this ); Index: configdlg.h
--- configdlg.h (revision 608) +++ configdlg.h (working copy) @@ -42,6 +42,7 @@ ColorButton(); void setColor( QColor c ); QColor color() const; + QSize sizeHint() const;
protected slots: void showColorPicker();
```
Reported by `ariya.hidayat` on 2007-07-24 08:40:32