diff --git a/source/armarx/navigation/gui-plugins/LocationGraphEditor/CMakeLists.txt b/source/armarx/navigation/gui-plugins/LocationGraphEditor/CMakeLists.txt index 3d865290897959ee93c8edb876c21f3cdcc94061..8235d2811d307784175818c8bb183a142e90828e 100644 --- a/source/armarx/navigation/gui-plugins/LocationGraphEditor/CMakeLists.txt +++ b/source/armarx/navigation/gui-plugins/LocationGraphEditor/CMakeLists.txt @@ -17,6 +17,7 @@ set(SOURCES GraphScene.cpp GuiGraph.cpp + widgets/default_colors.cpp widgets/EdgeTableWidget.cpp widgets/VertexDataWidget.cpp widgets/VertexTableWidget.cpp @@ -28,6 +29,7 @@ set(HEADERS GraphScene.h GuiGraph.h + widgets/default_colors.h widgets/EdgeTableWidget.h widgets/VertexDataWidget.h widgets/VertexTableWidget.h diff --git a/source/armarx/navigation/gui-plugins/LocationGraphEditor/widgets/EdgeTableWidget.h b/source/armarx/navigation/gui-plugins/LocationGraphEditor/widgets/EdgeTableWidget.h index b42c448027ba1ddac6c4ee849449a90f8a029e4e..f0266930f4e3b1e9e295a6825c32848ebe7f977b 100644 --- a/source/armarx/navigation/gui-plugins/LocationGraphEditor/widgets/EdgeTableWidget.h +++ b/source/armarx/navigation/gui-plugins/LocationGraphEditor/widgets/EdgeTableWidget.h @@ -22,7 +22,9 @@ #pragma once #include <armarx/navigation/gui-plugins/LocationGraphEditor/GuiGraph.h> +#include <armarx/navigation/gui-plugins/LocationGraphEditor/widgets/default_colors.h> +#include <QColor> #include <QTableWidget> @@ -48,8 +50,8 @@ namespace armarx::nav::locgrapheditor public: - QColor bgColorDefault = QColor::fromRgb(255, 255, 255); - QColor bgColorSelected = QColor::fromRgb(0, 128, 255); + QColor bgColorDefault = default_colors::tableBackgroundDefault; + QColor bgColorSelected = default_colors::tableBackgroundSelected; }; diff --git a/source/armarx/navigation/gui-plugins/LocationGraphEditor/widgets/VertexTableWidget.cpp b/source/armarx/navigation/gui-plugins/LocationGraphEditor/widgets/VertexTableWidget.cpp index 1906868bb6849768cce0becce8f43b37192dde01..12697de5958cbd8697e9cbe969bca0d7633f4126 100644 --- a/source/armarx/navigation/gui-plugins/LocationGraphEditor/widgets/VertexTableWidget.cpp +++ b/source/armarx/navigation/gui-plugins/LocationGraphEditor/widgets/VertexTableWidget.cpp @@ -39,6 +39,8 @@ namespace armarx::nav::locgrapheditor setSortingEnabled(true); setContextMenuPolicy(Qt::CustomContextMenu); + + setAlternatingRowColors(true); } @@ -59,7 +61,7 @@ namespace armarx::nav::locgrapheditor for (int col = 1; col <= 3; ++col) { - item(row, col)->setTextAlignment(Qt::AlignRight); + item(row, col)->setTextAlignment(Qt::AlignRight | Qt::AlignVCenter); } return item(row, 0); diff --git a/source/armarx/navigation/gui-plugins/LocationGraphEditor/widgets/VertexTableWidget.h b/source/armarx/navigation/gui-plugins/LocationGraphEditor/widgets/VertexTableWidget.h index 31fbed28d2fd0319e3b0a6514ddded4552097932..e00b356e3c51792bf0d71f3802aeaed94ece3d06 100644 --- a/source/armarx/navigation/gui-plugins/LocationGraphEditor/widgets/VertexTableWidget.h +++ b/source/armarx/navigation/gui-plugins/LocationGraphEditor/widgets/VertexTableWidget.h @@ -22,7 +22,9 @@ #pragma once #include <armarx/navigation/gui-plugins/LocationGraphEditor/GuiGraph.h> +#include <armarx/navigation/gui-plugins/LocationGraphEditor/widgets/default_colors.h> +#include <QColor> #include <QTableWidget> @@ -31,6 +33,7 @@ namespace armarx::nav::locgrapheditor class VertexTableWidget : public QTableWidget { + Q_OBJECT using This = VertexTableWidget; @@ -48,8 +51,9 @@ namespace armarx::nav::locgrapheditor public: - QColor bgColorDefault = QColor::fromRgb(255, 255, 255); - QColor bgColorSelected = QColor::fromRgb(0, 128, 255); + QColor bgColorDefault = default_colors::tableBackgroundDefault; + QColor bgColorSelected = default_colors::tableBackgroundSelected; + }; diff --git a/source/armarx/navigation/gui-plugins/LocationGraphEditor/widgets/default_colors.cpp b/source/armarx/navigation/gui-plugins/LocationGraphEditor/widgets/default_colors.cpp new file mode 100644 index 0000000000000000000000000000000000000000..059cb71ceaa32b1218b3d1245ea89fb357e61b88 --- /dev/null +++ b/source/armarx/navigation/gui-plugins/LocationGraphEditor/widgets/default_colors.cpp @@ -0,0 +1,33 @@ +/* + * This file is part of ArmarX. + * + * ArmarX is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * ArmarX is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + * @author Rainer Kartmann ( rainer dot kartmann at kit dot edu ) + * @date 2021 + * @copyright http://www.gnu.org/licenses/gpl-2.0.txt + * GNU General Public License + */ + +#include "default_colors.h" + +#include <QColor> + + +namespace armarx::nav::locgrapheditor +{ + + const QColor default_colors::tableBackgroundDefault = QColor::fromRgb(255, 255, 255); + const QColor default_colors::tableBackgroundSelected = QColor::fromRgb(128, 196, 255); + +} diff --git a/source/armarx/navigation/gui-plugins/LocationGraphEditor/widgets/default_colors.h b/source/armarx/navigation/gui-plugins/LocationGraphEditor/widgets/default_colors.h new file mode 100644 index 0000000000000000000000000000000000000000..0a355fa64b65335f48ce03fd9d4b90c52845e2c7 --- /dev/null +++ b/source/armarx/navigation/gui-plugins/LocationGraphEditor/widgets/default_colors.h @@ -0,0 +1,33 @@ +/* + * This file is part of ArmarX. + * + * ArmarX is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * ArmarX is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + * @author Rainer Kartmann ( rainer dot kartmann at kit dot edu ) + * @date 2021 + * @copyright http://www.gnu.org/licenses/gpl-2.0.txt + * GNU General Public License + */ + +#pragma once + +class QColor; + + +namespace armarx::nav::locgrapheditor::default_colors +{ + + extern const QColor tableBackgroundDefault; + extern const QColor tableBackgroundSelected; + +}