-
Notifications
You must be signed in to change notification settings - Fork 295
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create exanpding type header to reduce code duplication in the compon…
…ent inspector Signed-off-by: Nate Koenig <nate@openrobotics.org>
- Loading branch information
Nate Koenig
committed
Nov 5, 2021
1 parent
a90bf42
commit 27fe1da
Showing
8 changed files
with
114 additions
and
209 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
77 changes: 77 additions & 0 deletions
77
src/gui/plugins/component_inspector/ExpandingTypeHeader.qml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
/* | ||
* Copyright (C) 2021 Open Source Robotics Foundation | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
*/ | ||
import QtQuick 2.9 | ||
import QtQuick.Controls 1.4 | ||
import QtQuick.Controls 2.2 | ||
import QtQuick.Controls.Material 2.1 | ||
import QtQuick.Layouts 1.3 | ||
import QtQuick.Controls.Styles 1.4 | ||
|
||
// Header | ||
Rectangle { | ||
id: header | ||
width: parent.width | ||
height: typeHeader.height | ||
color: "transparent" | ||
|
||
// Horizontal margins | ||
property int margin: 5 | ||
|
||
// Left indentation | ||
property int indentation: 10 | ||
|
||
property string expandingHeaderText: "" | ||
property string expandingHeaderToolTip: "" | ||
|
||
RowLayout { | ||
anchors.fill: parent | ||
Item { | ||
width: margin | ||
} | ||
Image { | ||
id: icon | ||
sourceSize.height: indentation | ||
sourceSize.width: indentation | ||
fillMode: Image.Pad | ||
Layout.alignment : Qt.AlignVCenter | ||
source: content.show ? | ||
"qrc:/Gazebo/images/minus.png" : "qrc:/Gazebo/images/plus.png" | ||
} | ||
TypeHeader { | ||
id: typeHeader | ||
headerText: expandingHeaderText | ||
headerToolTip: expandingHeaderToolTip | ||
} | ||
Item { | ||
Layout.fillWidth: true | ||
} | ||
} | ||
MouseArea { | ||
anchors.fill: parent | ||
hoverEnabled: true | ||
cursorShape: Qt.PointingHandCursor | ||
onClicked: { | ||
content.show = !content.show | ||
} | ||
onEntered: { | ||
header.color = highlightColor | ||
} | ||
onExited: { | ||
header.color = "transparent" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters