Merge pull request #27879 from kadet1090/fix-checked-state

Part: Make 3D View properly checkable
This commit is contained in:
Chris Hennes
2026-03-02 19:22:01 -06:00
committed by GitHub
5 changed files with 17 additions and 7 deletions
+3 -3
View File
@@ -1278,14 +1278,14 @@ QToolButton:disabled {
}
QToolButton:checked {
background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 @ButtonBottomBackgroundColor, stop:0.7 @ButtonTopBackgroundColor, stop:1 @ButtonTopBackgroundColor);
background-color: @ToolButtonCheckedBackground;
border-radius: @InputFieldBorderRadius;
border: 1px solid @AccentColor;
border: 1px solid @ToolButtonCheckedBorderColor;
}
QToolButton:checked:disabled {
background-color: @GeneralDisabledBackgroundColor;
color: @AccentColor;
border: 1px solid @ButtonBorderColor;
}
QToolButton:checked:hover {
@@ -9,6 +9,8 @@ CheckedButtonTopBackgroundColor: "darken(@ButtonTopBackgroundColor, 5)"
DefaultButtonBottomBackgroundColor: "blend(@ButtonBottomBackgroundColor, @AccentColor, 10)"
DefaultButtonTopBackgroundColor: "blend(@ButtonTopBackgroundColor, @AccentColor, 10)"
DefaultButtonBorderColor: "blend(@ButtonBorderColor, @AccentColor, 20)"
ToolButtonCheckedBorderColor: "@PrimaryColorLighten5"
ToolButtonCheckedBackground: "@CheckedButtonTopBackgroundColor"
CheckBoxBackgroundColor: "@TextEditFieldBackgroundColor"
CheckBoxBorderColor: "@GeneralBorderColor"
DialogBackgroundColor: "@PrimaryColorLighten3"
@@ -9,6 +9,8 @@ CheckedButtonTopBackgroundColor: "darken(@ButtonTopBackgroundColor, 5)"
DefaultButtonBottomBackgroundColor: "blend(@ButtonBottomBackgroundColor, @AccentColor, 5)"
DefaultButtonTopBackgroundColor: "blend(@ButtonTopBackgroundColor, @AccentColor, 5)"
DefaultButtonBorderColor: "blend(@ButtonBorderColor, @AccentColor, 40)"
ToolButtonCheckedBorderColor: "darken(@ButtonBorderColor, 15)"
ToolButtonCheckedBackground: "@CheckedButtonBottomBackgroundColor"
CheckBoxBackgroundColor: "@TextEditFieldBackgroundColor"
CheckBoxBorderColor: "@GeneralBorderColor"
DialogBackgroundColor: "@PrimaryColorLighten3"
+5 -2
View File
@@ -2533,6 +2533,9 @@ void Location::onPlacementChanged()
void Location::onViewPositionButton()
{
Gui::Document* doc = Gui::Application::Instance->activeDocument();
ui->viewPositionButton->setChecked(true);
if (!doc) {
return;
}
@@ -2560,6 +2563,7 @@ void Location::pickCallback(void* ud, SoEventCallback* n)
{
const SoMouseButtonEvent* mbe = static_cast<const SoMouseButtonEvent*>(n->getEvent());
Gui::View3DInventorViewer* view = static_cast<Gui::View3DInventorViewer*>(n->getUserData());
Location* dlg = static_cast<Location*>(ud);
// Mark all incoming mouse button events as handled, especially, to deactivate the selection node
n->getAction()->setHandled();
@@ -2569,7 +2573,6 @@ void Location::pickCallback(void* ud, SoEventCallback* n)
if (point) {
SbVec3f pnt = point->getPoint();
SbVec3f nor = point->getNormal();
Location* dlg = static_cast<Location*>(ud);
dlg->ui->XPositionQSB->setValue(pnt[0]);
dlg->ui->YPositionQSB->setValue(pnt[1]);
dlg->ui->ZPositionQSB->setValue(pnt[2]);
@@ -2585,8 +2588,8 @@ void Location::pickCallback(void* ud, SoEventCallback* n)
n->setHandled();
view->setEditing(false);
view->setRedirectToSceneGraph(false);
Location* dlg = static_cast<Location*>(ud);
dlg->activeView = nullptr;
dlg->ui->viewPositionButton->setChecked(false);
view->removeEventCallback(SoMouseButtonEvent::getClassTypeId(), pickCallback, ud);
SoNode* root = view->getSceneGraph();
if (root && root->getTypeId().isDerivedFrom(Gui::SoFCUnifiedSelection::getClassTypeId())) {
+5 -2
View File
@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>280</width>
<height>307</height>
<height>400</height>
</rect>
</property>
<property name="windowTitle">
@@ -113,6 +113,9 @@
<property name="text">
<string>Pick Position</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
@@ -269,7 +272,7 @@ the sketch plane's normal vector will be used</string>
<customwidgets>
<customwidget>
<class>Gui::QuantitySpinBox</class>
<extends>QWidget</extends>
<extends>QAbstractSpinBox</extends>
<header>Gui/QuantitySpinBox.h</header>
</customwidget>
<customwidget>