Commit Graph

43 Commits

Author SHA1 Message Date
wmayer
af0a014cf2 Qt6 port:
* QApplication::setFallbackSessionManagementEnabled has been removed
* QString::medRef() has been removed. Use QString::mid() again.
* QTextStream::setCodec has been removed
* Use operator QVariant of the QFont class to make code Qt5 and Qt6 compatible
* Signature of QTreeWidget::mimeData() has changed in Qt6. Remove TreeWidget::mimeData() because it doesn't change the implementation
* QLayout::setMargin() is deprecated in Qt5 and has been removed in Qt6. Use QLayout::setContentsMargins()
* QDateTime::toTime_t() is deprecated in Qt5 and has been removed in Qt6. Use QDateTime::toSecsSinceEpoch()
* QDesktopWidget is deprecated in Qt5 and has been removed in Qt6. Use QScreen
2022-11-01 16:55:40 +01:00
Uwe
16c86a6d08 [Sketch] remove superfluous nullptr checks 2022-07-18 02:51:49 +02:00
Chris Hennes
1ee046788d Sketcher: PR6497 move return statement to new line 2022-03-29 13:25:06 -05:00
wmayer
ead5154b18 Sketcher: modernize C++11
* use nullptr
2022-03-23 19:26:15 +01:00
Abdullah Tahiri
3661ffe7fb Sketcher: Constraint icons and fonts in 3D View
===============================================

Based on PRs #4146 #4155.

PR #4155 proposes a scaling factor to be used to scale up constraint icons and the subindex font of icons. The
scaling factor is a parameter.

PR #4146 proposes to derive the constraint icon size from the system font size via function of the dpi. The
constraint icon subindex is a factor of the constraint size.

Observations:
- PR #4146 identifies the need for a scaling factor too, but this is a hardcoded 1.25 factor.
- PR #4146 appears to mix font points and font pixels when deriving the sizes.
- PR #4155 deals exclusively with icon size and subindex font, not with constraint label

Useful concepts:
- Font point is a physical distance. There are 72 points in one inch.
- Monitors have pixels with varying pixel densities. The number of pixels in one point varies
with pixel density. Hence the need for a correction based on the dpi of the monitor.

API constraints:
- While QT's configuration can be obtained in points or pixels, coin3D sets the font size in points.

Solution:
- Continue relying on the local font setting from preferences for coin3d font, albeit by converting from pixels to points.
- Introduce a sketcher wide 3D view scaling factor, as per #4155. This factor is however used for geometry, not for fonts.
- Geometry is scaled to compensate for the scaling factor and the monitor pixel density (the scaling factor is the product
of both scaling factors).
- Derive the 3D view icon size to be 80% (hardcoded) of the 3D view font size. Having constraint icons proportional to contraint label
font size gives consistency to the interface, as constraint icons also have subindices. I do not think it is worth to provide this 80%
as a configurable parameter
- The constraint icon subindex, being a special case of font relative to the accompanying icon, is set to be the 80% of the
icon size (hardcoded). I think it is not worth to provide this as a configurable parameter.

Bonus:
- ViewProviderSketch implements an observer of parameter group and tracks view scaling factor parameter and marker size.
- On change of parameter the inventor nodes are updated and the 3D view redrawn.
- Size information is moved to edit structure for consistency with Marker size.
2021-01-07 12:11:01 +01:00
wmayer
1ee3d79d7c Qt5: 'int QFontMetrics::width' is deprecated since Qt 5.11: Use QFontMetrics::horizontalAdvance [-Wdeprecated-declarations] 2020-06-12 17:51:33 +02:00
wmayer
d0d92b0801 force strict ISO C++ (-Wpedantic)
for Fem, Import, PartDesign, Robot, Sketcher, TechDraw
2019-09-18 14:18:07 +02:00
Abdullah Tahiri
dc32a0685b Sketcher: GUI PCH 2019-05-02 07:12:51 +02:00
wmayer
51811e4bf4 PVS: V688 A local variable possesses the same name as one of the class members, which can result in a confusion 2019-03-13 11:58:43 +01:00
Abdullah Tahiri
2e33aba01e Sketcher: Double arrow label for Diameter Constraint 2018-07-30 00:47:20 +02:00
wmayer
378a1e4f58 Qt5: workaround for undocking of mdi view
fix minor issues reported by clang static analyzer
2017-05-03 22:01:46 +02:00
Kunda
784edd3f82 Typo fixes for doxygen and source comments
issue #0002914
2017-03-31 11:25:57 -03:00
Kunda
99c99006b8 source typo fixes pt4 (only on py3 merged code) 2017-03-02 13:47:21 +01:00
wmayer
10191e9086 fixes #0002921, fixes #0002922 2017-02-24 19:54:16 +01:00
wmayer
15d7ae5e2c fix -Wextra in Sketcher 2016-09-22 18:34:35 +02:00
Mateusz Skowroński
cd2db00f22 QString::fromAscii() is obsolete in Qt5. Replace it with fromLatin1().
This change is Qt4/Qt5 neutral.
2016-01-05 16:07:25 +01:00
wmayer
979d1299cc + fix various warnings with gcc 2015-09-01 19:29:39 +02:00
wmayer
e753af2fd7 + fix possible scaling problem of datum label 2014-11-08 15:55:47 +01:00
Abdullah Tahiri
749abc5ed7 Sketcher fixes: Symmetry arrows properly scaled, fixed icon in constraint taskbar list contextual menu 2014-09-18 16:01:34 +02:00
Abdullah Tahiri
02cb12db52 Sketcher enhancement: Constraint icons visible over lines 2014-09-17 18:49:40 +02:00
Abdullah Tahiri
0adfa0a7ed Sketcher Bug fix: Arrows for symmetry constraint are back
The arrows were there in the code, but at a certain point, code was written to set the this->imgHeight value programatically, based on
whether it had text or not. As symmetry constraint does not have text the variable failed to initialize. Being zero, it did not pass
the ASSERT in the render function, so it was not rendered.

This includes Werner's fix for improver cast of a SoRayPickAction to SoGLRenderAction:
SbVec2s vp_size = static_cast<SoGLRenderAction*>(action)->getViewportRegion().getWindowSize();
to
SbVec2s vp_size = SoViewportRegionElement::get(state).getWindowSize();

At least sometimes tt is a SoRayPickAction because:

When you move with the mouse over the sketcher (when in edit mode) you enter the method ViewProviderSketch::mouseMove.
Inside there the method getPointOnRay is called to get a picked point underneath the cursor. Inside the latter method
an instance of SoRayPickAction is created to traverse the scene graph. After a long cascade of function calls you
finally enter SoDatumLabel::generatePrimitives(SoAction*).
2014-09-17 18:48:54 +02:00
wmayer
346e5c6a77 + fix more compiler warnings 2014-08-27 13:26:44 +02:00
wmayer
81bfcc8717 + fix issues with angle constraints 2014-05-17 18:27:56 +02:00
Stefan Tröger
8106f8437c fix sketcher arrow size and make them independend from window size 2014-05-14 22:43:31 +02:00
Stefan Tröger
e451efd9c4 fix inverted sketcher font-size issue and make font size undependend of window size 2014-05-13 18:20:38 +02:00
wmayer
7eeebbed53 fixes #0001191: Cannot manipulate length if moved away from between the 'red lines' 2014-01-14 11:48:34 +01:00
wmayer
847b6b79e0 + Replace math.h with cmath 2014-01-05 11:25:40 +01:00
jriegel
d5d9ea9c30 Add unti support to Sketcher 2013-12-15 22:47:47 +01:00
wmayer
e8f752ec2d 0001246: Constraint datum dimension label shown as gray box vice number in transparent background. 2013-10-21 10:05:23 +02:00
wmayer
629e76426f 0000971: Tracing over a background image in Sketcher: image is overwritten by first dimensional constraint text 2013-10-13 18:35:27 +02:00
wmayer
2e31e177a8 Apply fix from mrlukeparry for datum labels 2013-05-27 11:25:50 +02:00
Yorik van Havre
0ea6862601 Sketcher: small fix to allow to use SoDatumLabel in python 2013-03-04 15:56:17 -03:00
wmayer
09866ae81b 0000721: massive memory leak when dragging an unconstrained model 2012-11-15 00:24:40 +01:00
wmayer
07a17af70a Fix some memory leaks 2012-11-14 17:12:42 +01:00
unknown
9c974969f5 Fix possible crash in various view providers, fix formatting of Coin debug output, fix warning and compiler errors with Coin2 in SoDatumLabel 2012-07-18 10:40:36 +02:00
mrlukeparry
14562ba540 Sketcher: fix incorrect datum text flip for non xy-plane sketches 2012-07-17 23:15:58 +02:00
mrlukeparry
cba94b2660 Sketcher: improve symmetric constraint visual 2012-07-17 12:40:22 +02:00
mrlukeparry
da7528c5b9 Sketcher, 0000466: improve visualization of constraints 2012-07-15 13:23:59 +02:00
mrlukeparry
20f8a50909 Remove un-necessary GL command that seemed to cause rendering artifacts.
git-svn-id: https://free-cad.svn.sourceforge.net/svnroot/free-cad/trunk@5372 e8eeb9e2-ec13-0410-a4a9-efa5cf37419d
2011-12-31 20:01:24 +00:00
logari81
3d9c7771f8 + fix indentation, untabify and strip trailing spaces
git-svn-id: https://free-cad.svn.sourceforge.net/svnroot/free-cad/trunk@5054 e8eeb9e2-ec13-0410-a4a9-efa5cf37419d
2011-10-22 11:57:49 +00:00
mrlukeparry
87dd7826c7 Improved Datum Visuals.
DepthTest works correctly.
Datum label selection colour works correctly. 
Made labels slightly smaller to prevent stretch

git-svn-id: https://free-cad.svn.sourceforge.net/svnroot/free-cad/trunk@5052 e8eeb9e2-ec13-0410-a4a9-efa5cf37419d
2011-10-22 08:50:30 +00:00
logari81
b252fe7e1f + improve coding style and fix typos
+ fix positioning of symmetry constraint icon


git-svn-id: https://free-cad.svn.sourceforge.net/svnroot/free-cad/trunk@5002 e8eeb9e2-ec13-0410-a4a9-efa5cf37419d
2011-10-10 21:41:30 +00:00
wmayer
120ca87015 + unify DLL export defines to namespace names
git-svn-id: https://free-cad.svn.sourceforge.net/svnroot/free-cad/trunk@5000 e8eeb9e2-ec13-0410-a4a9-efa5cf37419d
2011-10-10 13:44:52 +00:00