View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0017712 | Scribus | User Interface | public | 2025-12-17 21:33 | 2025-12-17 21:55 |
| Reporter | nitramr | Assigned To | nitramr | ||
| Priority | normal | Severity | feature | Reproducibility | N/A |
| Status | resolved | Resolution | fixed | ||
| Platform | Desktop PC | OS | Ubuntu | OS Version | 24.10 64-bit |
| Product Version | 1.7.2.svn | ||||
| Target Version | 1.7 milestone | Fixed in Version | 1.7.2.svn | ||
| Summary | 0017712: Show color model hint on color button | ||||
| Description | The following patch adds a small dot with a color model indicator to each color button. The dot is only visible if the button is set to a valid spot color. Additionally, mask and text color buttons now have a new icon displayed in front of them. | ||||
| Tags | No tags attached. | ||||
| Attached Files | colorbutton_2025-12-17_01.diff (20,564 bytes)
diff --git a/resources/iconsets/1_7_0/16/text-background-color.svg b/resources/iconsets/1_7_0/16/text-background-color.svg
new file mode 100644
index 000000000..cf9c0cd2e
--- /dev/null
+++ b/resources/iconsets/1_7_0/16/text-background-color.svg
@@ -0,0 +1,3 @@
+<svg width="16" height="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><style>@import '../colors.css';</style>
+<path d="M15 15H1V1H15V15ZM6.98633 2L2.89941 12.6074L2 12.7305V14H6V12.7305L5.03613 12.5742L5.59473 11H10.4111L10.9551 12.5742L10 12.7305V14H14V12.7305L13.1006 12.6074L9.06445 2H6.98633ZM9.75098 9.0957H6.26562L7.9873 4.33203H8.03809L9.75098 9.0957Z" fill-opacity="0.4"/>
+</svg>
diff --git a/resources/iconsets/1_7_0/1_7_0.xml b/resources/iconsets/1_7_0/1_7_0.xml
index c7604a120..3f707ec7f 100644
--- a/resources/iconsets/1_7_0/1_7_0.xml
+++ b/resources/iconsets/1_7_0/1_7_0.xml
@@ -233,7 +233,7 @@ On Dark: #e580ff; rgb(229, 128, 255); hsl(288, 100, 75)
<icon id="colorpicker-pattern" file="16/colorpicker-pattern.svg" />
<icon id="colorpicker-solid" file="16/colorpicker-solid.svg" />
<icon id="mask" file="16/color-mask.svg" />
- <icon id="text-background-color" file="16/paragraph-align-horizontal-center.svg" />
+ <icon id="text-background-color" file="16/text-background-color.svg" />
<icon id="text-color" file="16/text.svg" />
<icon id="text-outline-color" file="16/character-outline.svg" />
diff --git a/scribus/ui/colorpicker/colorpicker_gradient.cpp b/scribus/ui/colorpicker/colorpicker_gradient.cpp
index 09b180b12..d8b2ab10e 100644
--- a/scribus/ui/colorpicker/colorpicker_gradient.cpp
+++ b/scribus/ui/colorpicker/colorpicker_gradient.cpp
@@ -369,6 +369,12 @@ void ColorPickerGradient::disableGradientEditProperties()
void ColorPickerGradient::setDoc(ScribusDoc *doc)
{
m_doc = doc;
+ buttonColor1->setDoc(m_doc);
+ buttonColor2->setDoc(m_doc);
+ buttonColor3->setDoc(m_doc);
+ buttonColor4->setDoc(m_doc);
+ buttonColorMesh->setDoc(m_doc);
+ gradientEditor->setDoc(m_doc);
unitChange();
}
@@ -485,14 +491,18 @@ void ColorPickerGradient::updateFourColors()
m_gradient.Color4Shade = numberColor4Shade->value();
// render color buttons
- buttonColor1->setBrush(colorBrush(buttonColor1->circleSize(), m_gradient.Color1Name, m_gradient.Color1Shade, m_gradient.Color1Alpha));
+ buttonColor1->setColor(m_gradient.Color1Name, m_gradient.Color1Shade, 1.0 - m_gradient.Color1Alpha);
buttonColor1->setToolTip(m_gradient.Color1Name);
- buttonColor2->setBrush(colorBrush(buttonColor2->circleSize(), m_gradient.Color2Name, m_gradient.Color2Shade, m_gradient.Color2Alpha));
+ buttonColor1->updatePreview();
+ buttonColor2->setColor(m_gradient.Color2Name, m_gradient.Color2Shade, 1.0 - m_gradient.Color2Alpha);
buttonColor2->setToolTip(m_gradient.Color2Name);
- buttonColor3->setBrush(colorBrush(buttonColor3->circleSize(), m_gradient.Color3Name, m_gradient.Color3Shade, m_gradient.Color3Alpha));
+ buttonColor2->updatePreview();
+ buttonColor3->setColor(m_gradient.Color3Name, m_gradient.Color3Shade, 1.0 - m_gradient.Color3Alpha);
buttonColor3->setToolTip(m_gradient.Color3Name);
- buttonColor4->setBrush(colorBrush(buttonColor4->circleSize(), m_gradient.Color4Name, m_gradient.Color4Shade, m_gradient.Color4Alpha));
+ buttonColor3->updatePreview();
+ buttonColor4->setColor(m_gradient.Color4Name, m_gradient.Color4Shade, 1.0 - m_gradient.Color4Alpha);
buttonColor4->setToolTip(m_gradient.Color4Name);
+ buttonColor4->updatePreview();
updateGradient();
}
@@ -508,7 +518,8 @@ void ColorPickerGradient::updateMeshColor()
m_gradientMesh.Opacity = numberColorMeshAlpha->value() / 100.0;
// render color button
- buttonColorMesh->setBrush(colorBrush(buttonColorMesh->circleSize(), m_gradientMesh.Name, m_gradientMesh.Shade, m_gradientMesh.Opacity));
+ buttonColorMesh->setColor(m_gradientMesh.Name, m_gradientMesh.Shade, 1.0 - m_gradientMesh.Opacity);
+ buttonColorMesh->updatePreview();
buttonColorMesh->setToolTip(m_gradientMesh.Name);
if (gradientEditPropertiesEnabled() && (type() == Gradient_PatchMesh || type() == Gradient_Mesh))
@@ -676,14 +687,18 @@ void ColorPickerGradient::setCurrentFourColors(QString color1, QString color2, Q
QSignalBlocker sigButtonColor2(buttonColor2);
QSignalBlocker sigButtonColor3(buttonColor3);
QSignalBlocker sigButtonColor4(buttonColor4);
- buttonColor1->setBrush(colorBrush(buttonColor1->circleSize(), color1, m_gradient.Color1Shade, m_gradient.Color1Alpha));
- buttonColor1->setToolTip(color1);
- buttonColor2->setBrush(colorBrush(buttonColor2->circleSize(), color2, m_gradient.Color2Shade, m_gradient.Color2Alpha));
- buttonColor2->setToolTip(color2);
- buttonColor3->setBrush(colorBrush(buttonColor3->circleSize(), color3, m_gradient.Color3Shade, m_gradient.Color3Alpha));
- buttonColor3->setToolTip(color3);
- buttonColor4->setBrush(colorBrush(buttonColor4->circleSize(), color4, m_gradient.Color4Shade, m_gradient.Color4Alpha));
- buttonColor4->setToolTip(color4);
+ buttonColor1->setColor(m_gradient.Color1Name, m_gradient.Color1Shade, 1.0 - m_gradient.Color1Alpha);
+ buttonColor1->setToolTip(m_gradient.Color1Name);
+ buttonColor1->updatePreview();
+ buttonColor2->setColor(m_gradient.Color2Name, m_gradient.Color2Shade, 1.0 - m_gradient.Color2Alpha);
+ buttonColor2->setToolTip(m_gradient.Color2Name);
+ buttonColor2->updatePreview();
+ buttonColor3->setColor(m_gradient.Color3Name, m_gradient.Color3Shade, 1.0 - m_gradient.Color3Alpha);
+ buttonColor3->setToolTip(m_gradient.Color3Name);
+ buttonColor3->updatePreview();
+ buttonColor4->setColor(m_gradient.Color4Name, m_gradient.Color4Shade, 1.0 - m_gradient.Color4Alpha);
+ buttonColor4->setToolTip(m_gradient.Color4Name);
+ buttonColor4->updatePreview();
}
@@ -703,7 +718,8 @@ void ColorPickerGradient::setCurrentMeshPoint(QString colorName, double shade, d
m_gradientMesh.Opacity = alpha;
QSignalBlocker sigMeshColor(buttonColorMesh);
- buttonColorMesh->setBrush(colorBrush(buttonColorMesh->circleSize(), m_gradientMesh.Name, m_gradientMesh.Shade, m_gradientMesh.Opacity));
+ buttonColorMesh->setColor(m_gradientMesh.Name, m_gradientMesh.Shade, 1.0 - m_gradientMesh.Opacity);
+ buttonColorMesh->updatePreview();
buttonColorMesh->setToolTip(m_gradientMesh.Name);
}
diff --git a/scribus/ui/gradienteditor.cpp b/scribus/ui/gradienteditor.cpp
index 8036f4d75..5262df06d 100644
--- a/scribus/ui/gradienteditor.cpp
+++ b/scribus/ui/gradienteditor.cpp
@@ -144,6 +144,12 @@ void GradientEditor::setExtendVisible(bool visible)
extendLabel->setVisible(visible);
}
+void GradientEditor::setDoc(ScribusDoc *doc)
+{
+ m_doc = doc;
+ buttonColor->setDoc(m_doc);
+}
+
void GradientEditor::changePos(double v)
{
Preview->setActiveStopPosition(v / 100.0);
@@ -194,21 +200,14 @@ void GradientEditor::languageChange()
void GradientEditor::updateColorButton()
{
QString colorName = colorListBox->currentColor();
- QBrush brush;
if (colorName == CommonStrings::tr_NoneColor || colorName == CommonStrings::None)
- brush = renderEmptyPattern(buttonColor->circleSize(), devicePixelRatio());
+ buttonColor->setBrush(renderEmptyPattern(buttonColor->circleSize(), devicePixelRatio()));
else
{
- const ScColor& color = m_colorList[colorName];
-
- QColor qColorShade = ScColorEngine::getDisplayColor(color, m_colorList.document(), stopShade->value());
- QColor qColor = ScColorEngine::getDisplayColor(color, m_colorList.document(), 100.0);
-
- brush = QBrush(renderColor(buttonColor->circleSize(), devicePixelRatio(), qColor, qColorShade, stopOpacity->value() / 100.0));
+ buttonColor->setColor(colorName, stopShade->value(), 1.0 - stopOpacity->value() / 100.0);
+ buttonColor->updatePreview();
}
-
- buttonColor->setBrush(brush);
}
void GradientEditor::initExtend()
diff --git a/scribus/ui/gradienteditor.h b/scribus/ui/gradienteditor.h
index 4cf6d404b..08195af5b 100644
--- a/scribus/ui/gradienteditor.h
+++ b/scribus/ui/gradienteditor.h
@@ -59,6 +59,7 @@ public:
void setExtendVisible(bool visible);
public slots:
+ void setDoc(ScribusDoc *doc);
void setPos(double);
void changePos(double);
void slotColor(const QString& name, int shade);
@@ -79,6 +80,7 @@ signals:
protected:
ColorList m_colorList;
ColorListBox *colorListBox;
+ QPointer<ScribusDoc> m_doc;
void initExtend();
diff --git a/scribus/ui/propertiespalette_fill.cpp b/scribus/ui/propertiespalette_fill.cpp
index 6ccfe74fc..f2d8de85e 100644
--- a/scribus/ui/propertiespalette_fill.cpp
+++ b/scribus/ui/propertiespalette_fill.cpp
@@ -719,7 +719,8 @@ void PropertiesPalette_Fill::iconSetChange()
evenOdd->setIcon(im.loadIcon("fill-rule-even-odd"));
nonZero->setIcon(im.loadIcon("fill-rule-nonzero"));
- buttonFillMask->setDotIcon(im.loadIcon("mask", 8));
+ labelFillMask->setPixmap(im.loadPixmap("mask"));
+ // labelFillColor->setPixmap(im.loadPixmap("color-fill"));
}
@@ -745,7 +746,6 @@ void PropertiesPalette_Fill::toggleLabelVisibility(bool v)
labelFillMask->setLabelVisibility(v);
labelFillRule->setLabelVisibility(v);
labelBlendmode->setLabelVisibility(v);
- buttonFillMask->setHasDot(!v);
}
diff --git a/scribus/ui/propertiespalette_line.cpp b/scribus/ui/propertiespalette_line.cpp
index b0b24edca..dce1a2301 100644
--- a/scribus/ui/propertiespalette_line.cpp
+++ b/scribus/ui/propertiespalette_line.cpp
@@ -867,7 +867,9 @@ void PropertiesPalette_Line::iconSetChange()
buttonCapSquare->setIcon(im.loadIcon("stroke-cap-square"));
buttonSwapMarker->setIcon(im.loadIcon("swap"));
- buttonLineMask->setDotIcon(im.loadIcon("mask", 8));
+
+ lineMaskLabel->setPixmap(im.loadPixmap("mask"));
+ // lineColorLabel->setPixmap(im.loadPixmap("color-stroke"));
lineStyleLabel->setPixmap(im.loadPixmap("stroke-style"));
buttonLineStyleNew->setIcon(im.loadIcon("stroke-style-new"));
@@ -956,5 +958,4 @@ void PropertiesPalette_Line::toggleLabelVisibility(bool v)
lineMarkerLabel->setLabelVisibility(v);
lineMaskLabel->setLabelVisibility(v);
lineBlendmodeLabel->setLabelVisibility(v);
- buttonLineMask->setHasDot(!v);
}
diff --git a/scribus/ui/propertywidget_text.cpp b/scribus/ui/propertywidget_text.cpp
index 5726590d6..6bd48a422 100644
--- a/scribus/ui/propertywidget_text.cpp
+++ b/scribus/ui/propertywidget_text.cpp
@@ -29,18 +29,14 @@ PropertyWidget_Text::PropertyWidget_Text( QWidget* parent) : QFrame(parent)
buttonTextColor->setContext(Context::Text);
buttonTextColor->setMenuContextType(ColorButton::Floating);
buttonTextColor->setColor( CommonStrings::tr_NoneColor);
- buttonTextColor->setIconSize(QSize(20, 20));
- buttonTextColor->setApplyColorOnIcon(true);
buttonBackgroundColor->setContext(Context::TextBackground);
buttonBackgroundColor->setMenuContextType(ColorButton::Floating);
buttonBackgroundColor->setColor(CommonStrings::tr_NoneColor);
-// buttonBackgroundColor->setIconSize(QSize(16, 16));
buttonStrokeColor->setContext(Context::TextOutline);
buttonStrokeColor->setMenuContextType(ColorButton::Floating);
buttonStrokeColor->setColor(CommonStrings::tr_NoneColor);
- buttonStrokeColor->setIconSize(QSize(20, 20));
labelFontSize->setLabelVisibility(false);
labelLineSpacing->setLabelVisibility(false);
@@ -242,8 +238,9 @@ void PropertyWidget_Text::iconSetChange()
labelFontSize->setPixmap(im.loadPixmap("font-size"));
labelLineSpacing->setPixmap(im.loadPixmap("paragraph-line-height"));
- buttonTextColor->setIcon(im.loadIcon("text-color", buttonTextColor->iconSize()));
- buttonStrokeColor->setIcon(im.loadIcon("text-outline-color", buttonStrokeColor->iconSize()));
+ labelTextColor->setPixmap(im.loadPixmap("text-color"));
+ labelStrokeColor->setPixmap(im.loadPixmap("text-outline-color"));
+ labelBackgroundColor->setPixmap(im.loadPixmap("text-background-color"));
}
diff --git a/scribus/ui/widgets/color_button.cpp b/scribus/ui/widgets/color_button.cpp
index efa276aae..116c99f4d 100644
--- a/scribus/ui/widgets/color_button.cpp
+++ b/scribus/ui/widgets/color_button.cpp
@@ -6,6 +6,7 @@
#include "util_gui.h"
#include "popup_menu.h"
#include "floatingwindow.h"
+#include "iconmanager.h"
#include "scribusdoc.h"
#include "sccolorengine.h"
#include "manager/widget_manager.h"
@@ -142,6 +143,40 @@ void ColorButton::setColor(QString colorName, double shade, double opacity)
}
+void ColorButton::setColorData(const CPColorData &data)
+{
+ m_colorData = data;
+
+ IconManager &im = IconManager::instance();
+ setDotIcon(im.loadPixmap("color-cmyk"));
+ setHasDot(canShowDot());
+
+ if (!m_doc)
+ return;
+
+
+ ScColor sColor(0, 0, 0);
+
+ if (m_doc->PageColors.contains(colorName()))
+ sColor = m_doc->PageColors.value(colorName());
+
+ switch(sColor.getColorModel())
+ {
+ case colorModel::colorModelCMYK:
+ setDotIcon(im.loadPixmap("color-cmyk"));
+ break;
+ case colorModelRGB:
+ setDotIcon(im.loadPixmap("color-rgb"));
+ break;
+ case colorModelLab:
+ setDotIcon(im.loadPixmap("color-lab"));
+ break;
+ }
+
+ if (sColor.isSpotColor())
+ setDotIcon(im.loadPixmap("color-spot"));
+}
+
QColor ColorButton::color() const
{
if (!m_doc || colorName() == CommonStrings::tr_NoneColor || colorName() == CommonStrings::None)
@@ -332,6 +367,11 @@ void ColorButton::setModeByType(int type)
}
}
+bool ColorButton::canShowDot()
+{
+ return m_mode == Mode::Solid && !(colorName() == CommonStrings::tr_NoneColor || colorName() == CommonStrings::None || colorName().isEmpty());
+}
+
QColor ColorButton::colorFromName(QString colorName, double shade) const
{
ScColor sColor(0, 0, 0);
@@ -792,14 +832,14 @@ void ColorButton::paintEvent(QPaintEvent *e)
{
QIcon::Mode iMode = isEnabled() ? QIcon::Normal : QIcon::Disabled;
- int w = 8;
- int h = 8;
+ int w = 9;
+ int h = 9;
QPixmap pix = dotIcon().pixmap(QSize(w, h), iMode);
QRectF fDot(rect().right() - fSize.width() + 0.5, rect().bottom() - fSize.height() + 0.5, fSize.width(), fSize.height()); // bottom right corner
painter.setPen(QPen(palette().color(QPalette::WindowText)));
painter.setBrush(palette().color(QPalette::Base));
painter.drawEllipse(fDot.center(), fDot.width() / 2., fDot.height() / 2.);
- painter.drawPixmap(fDot.center() - QPointF(w/2, h/2), pix);
+ painter.drawPixmap(fDot.center() - QPointF(w/2 + 0.5, h/2 + 0.5), pix);
}
painter.end();
diff --git a/scribus/ui/widgets/color_button.h b/scribus/ui/widgets/color_button.h
index 67cbb5b50..8272df6a3 100644
--- a/scribus/ui/widgets/color_button.h
+++ b/scribus/ui/widgets/color_button.h
@@ -57,7 +57,7 @@ public:
// Color
void setColor(QString colorName, double shade = 100.0, double opacity = 0.0);
- void setColorData(const CPColorData& data) { m_colorData = data; }
+ void setColorData(const CPColorData& data);
CPColorData colorData() const { return m_colorData; }
QColor color() const;
QString colorName() const;
@@ -179,6 +179,7 @@ private:
QBrush renderBrush() const;
bool isMask() const;
void setModeByType(int type);
+ bool canShowDot();
QBrush brushSolid() const;
QBrush brushGradient() const;
diff --git a/scribus/ui/widgets/form_widget.cpp b/scribus/ui/widgets/form_widget.cpp
index 5cf8021b7..f1a141ecd 100644
--- a/scribus/ui/widgets/form_widget.cpp
+++ b/scribus/ui/widgets/form_widget.cpp
@@ -33,7 +33,8 @@ QSize FormWidget::minimumSizeHint() const
int b = 0;
int w = 0;
int h = 0;
- labelSize(l, t, r, b, w, h);
+ int offset = 0;
+ labelSize(l, t, r, b, w, h, offset);
return QSize(w, h).expandedTo(QWidget::minimumSizeHint());
}
@@ -52,7 +53,7 @@ void FormWidget::calculateFrame()
int b = 0;
int w = 0;
int h = 0;
- labelSize(l, t, r, b, w, h);
+ labelSize(l, t, r, b, w, h, m_labelOffset);
setContentsMargins(l, t, r, b);
update();
@@ -126,15 +127,16 @@ void FormWidget::paintEvent(QPaintEvent *e)
rIcon = QRect(0, 0, m_pixmap.deviceIndependentSize().width(), m_pixmap.deviceIndependentSize().height());
rIcon.moveCenter(rWidgets.center());
- switch (m_iconPosition){
+ switch (m_iconPosition)
+ {
default:
case Left:
rIcon.moveLeft(0);
- rLabel = rLabel.adjusted(rIcon.width() + m_space, 0, 0, 0);
+ rLabel = rLabel.adjusted(m_labelOffset, 0, 0, 0);
break;
case Right:
rIcon.moveRight(width());
- rLabel = rLabel.adjusted(0, 0, -rIcon.width() - m_space, 0);
+ rLabel = rLabel.adjusted(0, 0, -m_labelOffset, 0);
break;
case Top:
rIcon.moveTop(0);
@@ -155,7 +157,9 @@ void FormWidget::paintEvent(QPaintEvent *e)
if (canUseLabel())
{
- switch (m_position){
+ switch (m_position)
+ {
+ default:
case Left:
style->drawItemText(&painter, rLabel, Qt::AlignLeft | Qt::AlignVCenter | Qt::TextShowMnemonic, opt.palette, isEnabled(), m_label, foregroundRole());
break;
@@ -252,23 +256,33 @@ bool FormWidget::event(QEvent *e)
*
* ********************************************************************************* */
-
-void FormWidget::labelSize(int &l, int &t, int &r, int &b, int &w, int &h) const
-{
+void FormWidget::labelSize(int &l, int &t, int &r, int &b, int &w, int &h, int &offset) const
+{
l = 0;
t = 0;
r = 0;
b = 0;
w = 0;
h = 0;
+ offset = 0;
+
+ if (!layout())
+ return;
+
+ const QSize sizeContent = layout()->minimumSize();
+
+ int iconWidth = 0;
+ int iconHeight = 0;
+ int labelWidth = 0;
+ int labelHeight = 0;
+
+ bool isHorizontalIcon = (m_iconPosition == Left || m_iconPosition == Right);
+ bool fixWidth = false;
if (canUsePixmap())
{
- int iconWidth = m_pixmapSize.width() + m_space;
- int iconHeight = m_pixmapSize.height() + m_space;
-
- w += iconWidth;
- h += iconHeight;
+ iconWidth = m_pixmapSize.width() + m_space;
+ iconHeight = m_pixmapSize.height() + m_space;
switch (m_iconPosition)
{
@@ -285,7 +299,6 @@ void FormWidget::labelSize(int &l, int &t, int &r, int &b, int &w, int &h) const
b += iconHeight;
break;
}
-
}
if (canUseLabel())
@@ -294,48 +307,55 @@ void FormWidget::labelSize(int &l, int &t, int &r, int &b, int &w, int &h) const
if (m_useSmallFont)
tmpFont.setPointSize(smallFontSize());
- QFontMetrics metrics(tmpFont);
- QString label = m_label;
-
- // calculate width without hidden "&"
+ QString labelText = m_label;
if (m_hasShortcut)
- {
- int pos = 0;
- while ( pos < m_label.size())
- {
- int index = label.indexOf(QLatin1String("&"), pos);
-
- if (pos == index)
- label = label.replace(index, 1, "");
+ labelText.remove(QLatin1Char('&'));
- pos++;
- }
- }
-
- int labelWidth = metrics.horizontalAdvance(label) + metrics.horizontalAdvance(QLatin1Char(' ')) + m_space;
- int labelHeight = metrics.height() + m_space;
-
- w += labelWidth;
- h += labelHeight;
+ QFontMetrics metrics(tmpFont);
+ labelWidth = metrics.horizontalAdvance(labelText) + metrics.horizontalAdvance(QLatin1Char(' ')) + m_space;
+ labelHeight = metrics.height() + m_space;
- switch (m_position)
+ if (m_position == Left || m_position == Right)
{
- case Left:
+ if (m_position == Left)
l += labelWidth;
- break;
- case Right:
+ else
r += labelWidth;
- break;
- case Top:
+
+ if (canUsePixmap() && isHorizontalIcon)
+ offset = iconWidth;
+ }
+ else if (m_position == Top || m_position == Bottom)
+ {
+ if (m_position == Top)
t += labelHeight;
- break;
- case Bottom:
+ else
b += labelHeight;
- break;
- }
+ if (canUsePixmap() && isHorizontalIcon)
+ {
+ int diff = (sizeContent.width() < labelWidth) ? (labelWidth - sizeContent.width()) / 2 : 0;
+ int space = offset = diff > 0 ? iconWidth - diff : iconWidth;
+
+ if (m_iconPosition == Left)
+ {
+ l = space + diff;
+ r = diff;
+ }
+ else
+ {
+ r = space + diff;
+ l = diff;
+ }
+ }
+ else
+ fixWidth = true;
+ }
}
+ int maxWidth = sizeContent.width() + l + r;
+ w = fixWidth ? qMax(maxWidth, labelWidth) : maxWidth;
+ h = sizeContent.height() + t + b;
}
int FormWidget::smallFontSize() const
diff --git a/scribus/ui/widgets/form_widget.h b/scribus/ui/widgets/form_widget.h
index c82f91c30..2cf2b4814 100644
--- a/scribus/ui/widgets/form_widget.h
+++ b/scribus/ui/widgets/form_widget.h
@@ -87,6 +87,7 @@ private:
LabelPosition m_position {LabelPosition::Bottom};
LabelPosition m_iconPosition {LabelPosition::Left};
int m_space {4};
+ int m_labelOffset {0};
QSize m_pixmapSize {QSize(16,16)};
QString m_label {"Label"};
QFont m_font;
@@ -100,7 +101,7 @@ private:
void calculateFrame();
void updateShortcut();
- void labelSize(int &l, int &t, int &r, int &b, int &w, int &h) const;
+ void labelSize(int &l, int &t, int &r, int &b, int &w, int &h, int &offset) const;
};
| ||||
| Patch | Yes | ||||
| Date Modified | Username | Field | Change |
|---|---|---|---|
| 2025-12-17 21:33 | nitramr | New Issue | |
| 2025-12-17 21:33 | nitramr | File Added: colorbutton_2025-12-17_01.diff | |
| 2025-12-17 21:33 | nitramr | File Added: preview.png | |
| 2025-12-17 21:54 | cbradney | Assigned To | => cbradney |
| 2025-12-17 21:54 | cbradney | Status | new => resolved |
| 2025-12-17 21:54 | cbradney | Resolution | open => fixed |
| 2025-12-17 21:54 | cbradney | Fixed in Version | => 1.7.2.svn |
| 2025-12-17 21:55 | cbradney | Assigned To | cbradney => nitramr |