Repository: spyder-ide/spyder

Issue:
Colour Theme Editor UI Issue
<!--- **PLEASE READ:** When submitting here, please ensure you've completed the following checklist and checked the boxes to confirm. Issue reports without it may be closed. Thanks! --->

### Issue Report Checklist

* [ x] Searched the [issues page](https://github.com/spyder-ide/spyder/issues?q=is%3Aissue) for similar reports
* [x ] Read the relevant sections of the [Spyder Troubleshooting Guide](https://github.com/spyder-ide/spyder/wiki/Troubleshooting-Guide-and-FAQ) and followed its advice
* [x ] Reproduced the issue after updating with ``conda update spyder`` (or ``pip``, if not using Anaconda)
* [n/a ] Could not reproduce inside ``jupyter qtconsole`` (if console-related)
* [n/a ] Tried basic troubleshooting (if a bug/error)
    * [x ] Restarted Spyder
    * [x ] Reset preferences with ``spyder --reset``
    * [n/a ] Reinstalled the latest version of [Anaconda](https://www.anaconda.com/download/)
    * [ n/a] Tried the other applicable steps from the Troubleshooting Guide
* [x ] Completed the **Problem Description**, **Steps to Reproduce** and **Version** sections below


## Problem Description

While working on https://github.com/spyder-ide/spyder/pull/12561 I found the GUI for editing the theme for Solarized Dark was a little wrong. The colour hex value edit box is too small. See the screen shot.


### What steps reproduce the problem?

1. Open spyder.
2. Preferences - Appearance
3. Edit selected scheme

### What is the expected output? What do you see instead?

The hex edit boxes should be wider.
![SolarizedDarkEditor](https://user-images.githubusercontent.com/572141/80770292-37275780-8b93-11ea-92b8-13001fc6b7ad.png)

### Paste Traceback/Error Below (if applicable)
<!--- Copy from error dialog or View > Panes > Internal Console --->

```python-traceback

PASTE TRACEBACK HERE

```

## Versions
<!--- You can get this information from Help > About Spyder...
or (if Spyder won't launch) the "conda list" command
from the Anaconda Prompt/Terminal/command line. --->

* Spyder version: 4.1.2
* Python version: 3.8.2
* Qt version: 5.12.8
* PyQt version: 5.12.3
* Operating System name/version: Linux 5.5.0-2-amd64 #1 SMP Debian 5.5.17-1 (2020-04-15) x86_64 GNU/Linux



### Dependencies
<!--- Please go to the menu entry Help > Dependencies,
press the Copy to clipboard button and paste below --->

```
PASTE DEPENDENCIES HERE
```



Discussion:
Yes you are right!, not looking very pretty right now.  This is only on the dark theme, we need to set  the minimum width on those issues.


<img width="730" alt="Screen Shot 2020-04-30 at 21 14 49" src="https://user-images.githubusercontent.com/3627835/80776280-a5363500-8b27-11ea-8634-9f835a6a4dff.png">


Seems strange that it is only one the dark theme page. I would have thought it was a standard dialog box. I have not done any QT dev though.
Not that strange. The dark theme resets some values including minimum widths of lineedits which is the most likely culprit :-)
@steff456, an easy one for you.

Resolving patch:
diff --git a/spyder/widgets/colors.py b/spyder/widgets/colors.py
--- a/spyder/widgets/colors.py
+++ b/spyder/widgets/colors.py
@@ -7,20 +7,20 @@
 # Third party imports
 from qtpy.QtCore import Property, QSize, Signal, Slot
 from qtpy.QtGui import QColor, QIcon, QPixmap
-from qtpy.QtWidgets import QColorDialog, QHBoxLayout, QLineEdit, QPushButton
+from qtpy.QtWidgets import QColorDialog, QHBoxLayout, QLineEdit, QToolButton
 
 # Local imports
 from spyder.py3compat import is_text_string
 
 
-class ColorButton(QPushButton):
+class ColorButton(QToolButton):
     """
     Color choosing push button
     """
     colorChanged = Signal(QColor)
 
     def __init__(self, parent=None):
-        QPushButton.__init__(self, parent)
+        QToolButton.__init__(self, parent)
         self.setFixedSize(20, 20)
         self.setIconSize(QSize(12, 12))
         self.clicked.connect(self.choose_color)
@@ -74,6 +74,8 @@ def __init__(self, color, parent=None):
         QHBoxLayout.__init__(self)
         assert isinstance(color, QColor)
         self.lineedit = QLineEdit(color.name(), parent)
+        fm = self.lineedit.fontMetrics()
+        self.lineedit.setMinimumWidth(fm.width(color.name()) * 1.2)
         self.lineedit.textChanged.connect(self.update_color)
         self.addWidget(self.lineedit)
         self.colorbtn = ColorButton(parent)


Test patch: