View Issue Details

IDProjectCategoryView StatusLast Update
0002272FreeCADBugpublic2015-10-07 08:27
Reporterf3nixAssigned Toickby 
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Version 
Target VersionFixed in Version0.16 
Summary0002272: QuantitySpinbox sets wrong sizeHint
DescriptionHi,
when there is no expression icon in the quantityspinbox the code sets wrong sizehint. Screenshot attached. It does not happen with all styles. This screenshot is from latest KDE Plasma. QuantitySpinBox.cpp lines 253 and 254.

Cheers,
Mateusz
Steps To Reproduce1. Run FreeCAD with ./FreeCAD -style motif
2. Create new document.
3. Open "Part Design" WB.
4. Create new sketch.

The value in quantity spinbox in "Choose orientation dialog" is partially hidden.
Additional InformationOS: Debian GNU/Linux testing (stretch)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.16.5617 (Git)
Build type: Debug
Branch: master
Hash: 90ccc1cee40d9f9dae1ed1dd5ac91955dcb24aa6
Python version: 2.7.10
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 6.8.0.oce-0.17
TagsNo tags attached.

Activities

f3nix

2015-09-23 20:39

reporter  

dialog_bug.jpg (Attachment missing)

eivindkvedalen

2015-09-25 20:03

developer   ~0006452

Could you try moving those two lines (253-254) into the bind(...) function below, to see if that helps?

f3nix

2015-09-26 00:21

reporter   ~0006457

Hi eivindkvedalen!

Yes this works. And as far as I can tell it does not break anything. E.g. resizing a dialog with expression icon keeps the icon padded and it does not cover the input value.

Thanks for the expression feature! :)

Cheers,
Mateusz


diff --git a/src/Gui/QuantitySpinBox.cpp b/src/Gui/QuantitySpinBox.cpp
index 697bdc2..e3b9c4e 100644
--- a/src/Gui/QuantitySpinBox.cpp
+++ b/src/Gui/QuantitySpinBox.cpp
@@ -250,8 +250,6 @@ QuantitySpinBox::QuantitySpinBox(QWidget *parent)
     d_ptr->iconLabel->setPixmap(pixmap);
     d_ptr->iconLabel->setStyleSheet(QString::fromAscii("QLabel { border: none; padding: 0px; }"));
     d_ptr->iconLabel->hide();
- int frameWidth = style()->pixelMetric(QStyle::PM_SpinBoxFrameWidth);
- lineEdit()->setStyleSheet(QString::fromAscii("QLineEdit { padding-right: %1px } ").arg(d_ptr->iconLabel->sizeHint().width() + frameWidth + 1));
 
     QObject::connect(d_ptr->iconLabel, SIGNAL(clicked()), this, SLOT(openFormulaDialog()));
 }
@@ -282,6 +280,9 @@ void QuantitySpinBox::bind(const App::ObjectIdentifier &_path)
 
     ExpressionBinding::bind(_path);
 
+ int frameWidth = style()->pixelMetric(QStyle::PM_SpinBoxFrameWidth);
+ lineEdit()->setStyleSheet(QString::fromAscii("QLineEdit { padding-right: %1px } ").arg(d_ptr->iconLabel->sizeHint().width() + frameWidth + 1));
+
     d->iconLabel->show();
 }

f3nix

2015-09-26 00:22

reporter  

dialog_good.png (Attachment missing)

wmayer

2015-09-26 21:47

administrator   ~0006465

Can you try with the latest changes? Quite a lot things have changed in the meantime.

f3nix

2015-09-27 05:41

reporter  

dialog_good_old.png (Attachment missing)

f3nix

2015-09-27 05:41

reporter  

dialog_wrong_new.png (Attachment missing)

f3nix

2015-09-27 05:52

reporter   ~0006466

Last edited: 2015-09-27 05:58

View 3 revisions

Hi wmayer!
Commit 98ed315b2d129abb0fe63629fc697347d9ba17de solves this issue. But I think it creates a new one.

The expression icon can now cover the value in the input field.

This image shows the old behaviour: dialog_good_old.png

This image shows the new bahaviour: dialog_wrong_new.png

If it is not a bug then this issue may be closed.

Thanks.

Cheers,
Mateusz

PS. The fix suggested by eivindkvedalen works ok and does not create this new issue.

wmayer

2015-09-27 08:24

administrator   ~0006467

Does moving the lines 248 - 256 + 258 into the bind() method solve this issue?

wmayer

2015-09-27 08:38

administrator   ~0006468

OK, I can see this behaviour on Windows and Ubuntu, too. However, this is not a bug because a line edit doesn't expand itself to fit the whole text.

The only question is if you get the truncated text when you open the dialog or do you have to actively shrink the dialog. In the latter case this can be closed, in the former case it would be good to make the initial size bigger by the width of the icon.

When I test ./FreeCAD -style motif then dialog is big enough to not truncate the text.

Related Changesets

FreeCAD: master 98ed315b

2015-09-24 19:40:37

Stefan Tröger


Committer: wmayer Details Diff
Enhance expression icon
- fix size and position on kubuntu
- different icon for set or unset expression for better visual feedback
Affected Issues
0002272
add - src/Gui/Icons/bound-expression-unset.svg Diff File
mod - src/Gui/Icons/resource.qrc Diff File
mod - src/Gui/QuantitySpinBox.cpp Diff File

Issue History

Date Modified Username Field Change
2015-09-23 20:39 f3nix New Issue
2015-09-23 20:39 f3nix File Added: dialog_bug.jpg
2015-09-25 20:03 eivindkvedalen Note Added: 0006452
2015-09-26 00:21 f3nix Note Added: 0006457
2015-09-26 00:22 f3nix File Added: dialog_good.png
2015-09-26 21:47 wmayer Note Added: 0006465
2015-09-27 05:41 f3nix File Added: dialog_good_old.png
2015-09-27 05:41 f3nix File Added: dialog_wrong_new.png
2015-09-27 05:52 f3nix Note Added: 0006466
2015-09-27 05:54 f3nix Note Edited: 0006466 View Revisions
2015-09-27 05:58 f3nix Note Edited: 0006466 View Revisions
2015-09-27 08:24 wmayer Note Added: 0006467
2015-09-27 08:38 wmayer Note Added: 0006468
2015-09-27 08:41 wmayer Changeset attached => FreeCAD Master master 98ed315b
2015-09-27 14:52 wmayer Status new => feedback
2015-10-07 08:27 wmayer Status feedback => closed
2015-10-07 08:27 wmayer Assigned To => ickby
2015-10-07 08:27 wmayer Resolution open => fixed
2015-10-07 08:27 wmayer Fixed in Version => 0.16