Skip to content

Commit

Permalink
Merge pull request #79 from ignitionrobotics/2_to_3_2020-06-12
Browse files Browse the repository at this point in the history
2 ➡️ 3
Signed-off-by: Louise Poubel <[email protected]>
  • Loading branch information
chapulina authored Jun 17, 2020
2 parents 9da3dec + bc52306 commit 0f64650
Show file tree
Hide file tree
Showing 56 changed files with 381 additions and 596 deletions.
35 changes: 3 additions & 32 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -85,38 +85,9 @@ ign_find_package (Qt5
PKGCONFIG "Qt5Core Qt5Quick Qt5QuickControls2"
)

#--------------------------------------
# Find QWT (QT graphing library)
#find_path(QWT_INCLUDE_DIR NAMES qwt.h PATHS
# /usr/include
# /usr/local/include
# /usr/local/lib/qwt.framework/Headers
# ${QWT_WIN_INCLUDE_DIR}
#
# PATH_SUFFIXES qwt qwt5
#)
#if (NOT QWT_INCLUDE_DIR)
# ign_build_error("qwt5 header file was not found")
#endif()
#
#if(APPLE)
# find_library(QWT_LIBRARY NAMES qwt PATHS
# /usr/lib
# /usr/local/lib
# /usr/local/lib/qwt.framework
# ${QWT_WIN_LIBRARY_DIR}
# )
#else()
# find_library(QWT_LIBRARY NAMES qwt-qt5 PATHS
# /usr/lib
# /usr/local/lib
# /usr/local/lib/qwt.framework
# ${QWT_WIN_LIBRARY_DIR}
# )
#endif()
#if (NOT QWT_LIBRARY)
# ign_build_error("qwt5 library was not found")
#endif()
set(IGNITION_GUI_PLUGIN_INSTALL_DIR
${CMAKE_INSTALL_PREFIX}/${IGN_LIB_INSTALL_DIR}/ign-${IGN_DESIGNATION}-${PROJECT_VERSION_MAJOR}/plugins
)

#============================================================================
# Configure the build
Expand Down
4 changes: 1 addition & 3 deletions include/ignition/gui/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,5 @@ target_link_libraries(${PROJECT_LIBRARY_TARGET_NAME}
TINYXML2::TINYXML2
)

add_subdirectory(plugins)

ign_install_all_headers(EXCLUDE_DIRS plugins)
ign_install_all_headers()

33 changes: 0 additions & 33 deletions include/ignition/gui/plugins/CMakeLists.txt

This file was deleted.

7 changes: 6 additions & 1 deletion include/ignition/gui/qml/IgnCard.qml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,11 @@ Pane {
*/
property string closeIcon: "\u2715"

/**
* The plugin backgroung color. Default: transparent
*/
property string cardBackground: "#00000000"

/**
*
*/
Expand Down Expand Up @@ -446,7 +451,7 @@ Pane {
anchors.fill: parent
anchors.topMargin: card.showTitleBar ? 50 : 0
clip: true
color: "transparent"
color: cardBackground

onChildrenChanged: {
card.syncTheFamily()
Expand Down
41 changes: 41 additions & 0 deletions include/ignition/gui/qml/IgnCardSettings.qml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import QtQuick 2.9
import QtQuick.Controls 2.2
import QtQuick.Layouts 1.3
import QtQuick.Window 2.2
import QtQuick.Dialogs 1.0
import "qrc:/qml"

Dialog {
Expand Down Expand Up @@ -72,6 +73,31 @@ Dialog {
}
}

GridLayout {
width: parent.width
columns: 3
visible: !card.standalone

Label {
text: "Background Color "
}

Button {
Layout.preferredWidth: parent.width * 0.4
onClicked: colorDialog.open()
background: Rectangle {
y: 8
width: 50
height: 30
id: "bgColor"
color: cardBackground
border.color: "#000000"
border.width: 2
}
}
}


GridLayout {
width: parent.width
columns: 2
Expand Down Expand Up @@ -167,4 +193,19 @@ Dialog {
}
}
}

ColorDialog {
id: colorDialog
title: "Please choose a color"
showAlphaChannel : true
onAccepted: {
content.color = colorDialog.color
bgColor.color = colorDialog.color
cardBackground = colorDialog.color
}
onRejected: {
console.log("Canceled")
}
Component.onCompleted: visible = false
}
}
168 changes: 141 additions & 27 deletions include/ignition/gui/qml/IgnRulers.qml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ Rectangle {
// Left ruler
Rectangle {
width: rulersThickness
height: parent.height
height: parent.height - 20
visible: rulersRect.enabled
color: "transparent"
anchors.horizontalCenter: parent.left
Expand All @@ -60,13 +60,7 @@ Rectangle {
onMouseXChanged: {
if (drag.active)
{
var newCardX = Math.max(target.x + mouseX, 0)
var newCardWidth = Math.max(target.width + (target.x - newCardX),
rulersRect.minSize)
if (newCardWidth === target.width)
return;
target.x = newCardX
target.width = newCardWidth
resizeLeft(target, mouseX);
}
}
}
Expand All @@ -75,7 +69,7 @@ Rectangle {
// Right ruler
Rectangle {
width: rulersThickness
height: parent.height
height: parent.height - 20
visible: rulersRect.enabled
color: "transparent"
anchors.horizontalCenter: parent.right
Expand All @@ -88,18 +82,15 @@ Rectangle {
onMouseXChanged: {
if (drag.active)
{
target.width = Math.max(target.width + mouseX, rulersRect.minSize)

if (target.width + target.x > target.parent.width)
target.width = target.parent.width - target.x
resizeRight(target, mouseX);
}
}
}
}

// Top ruler
Rectangle {
width: parent.width
width: parent.width - 20
height: rulersThickness
visible: rulersRect.enabled
color: "transparent"
Expand All @@ -113,23 +104,15 @@ Rectangle {
onMouseYChanged: {
if (drag.active)
{
var newCardY = Math.max(target.y + mouseY, 0)
var newCardHeight = Math.max(target.height + (target.y - newCardY),
rulersRect.minSize)

if (newCardHeight === target.height)
return;

target.y = newCardY
target.height = newCardHeight
resizeTop(target, mouseY);
}
}
}
}

// Bottom ruler
Rectangle {
width: parent.width
width: parent.width - 20
height: rulersThickness
visible: rulersRect.enabled
color: "transparent"
Expand All @@ -143,12 +126,143 @@ Rectangle {
onMouseYChanged: {
if (drag.active)
{
target.height = Math.max(target.height + mouseY, rulersRect.minSize)
resizeBottom(target, mouseY);
}
}
}
}

// Top-Left Ruler
Rectangle {
width: 25
height: 25
visible: rulersRect.enabled
color: "transparent"
anchors.horizontalCenter: parent.left
anchors.verticalCenter: parent.top

MouseArea {
anchors.fill: parent
cursorShape: Qt.SizeFDiagCursor
drag { target: parent; axis: Drag.XAndYAxis }
onMouseYChanged: {
if (drag.active)
{
resizeTop(target, mouseY);
resizeLeft(target, mouseX);
}
}
}
}

// Top-Right Ruler
Rectangle {
width: 25
height: 25
visible: rulersRect.enabled
color: "transparent"
anchors.horizontalCenter: parent.right
anchors.verticalCenter: parent.top

MouseArea {
anchors.fill: parent
cursorShape: Qt.SizeBDiagCursor
drag { target: parent; axis: Drag.XAndYAxis }
onMouseYChanged: {
if (drag.active)
{
resizeTop(target, mouseY);
resizeRight(target, mouseX);
}
}
}
}

// Bottom-Left Ruler
Rectangle {
width: 25
height: 25
visible: rulersRect.enabled
color: "transparent"
anchors.horizontalCenter: parent.left
anchors.verticalCenter: parent.bottom

MouseArea {
anchors.fill: parent
cursorShape: Qt.SizeBDiagCursor
drag { target: parent; axis: Drag.XAndYAxis }
onMouseYChanged: {
if (drag.active)
{
resizeBottom(target, mouseY);
resizeLeft(target, mouseX);
}
}
}
}

// Bottom-Right Ruler
Rectangle {
width: 25
height: 25
visible: rulersRect.enabled
color: "transparent"
anchors.horizontalCenter: parent.right
anchors.verticalCenter: parent.bottom

if (target.height + target.y > target.parent.height)
target.height = target.parent.height - target.y
MouseArea {
anchors.fill: parent
cursorShape: Qt.SizeFDiagCursor
drag { target: parent; axis: Drag.XAndYAxis }
onMouseYChanged: {
if (drag.active)
{
resizeBottom(target, mouseY);
resizeRight(target, mouseX);
}
}
}
}

function resizeLeft(target, mouseX)
{
var newCardX = Math.max(target.x + mouseX, 0)
var newCardWidth = Math.max(target.width + (target.x - newCardX),
rulersRect.minSize)

if (newCardWidth === target.width)
return;

target.x = newCardX
target.width = newCardWidth
}

function resizeRight(target, mouseX)
{
target.width = Math.max(target.width + mouseX, rulersRect.minSize)

if (target.width + target.x > target.parent.width)
target.width = target.parent.width - target.x
}

function resizeTop(target, mouseY)
{
var newCardY = Math.max(target.y + mouseY, 0)
var newCardHeight = Math.max(target.height + (target.y - newCardY),
rulersRect.minSize)

if (newCardHeight === target.height)
return;

target.y = newCardY
target.height = newCardHeight
}

function resizeBottom(target, mouseY)
{
target.height = Math.max(target.height + mouseY, rulersRect.minSize)

if (target.height + target.y > target.parent.height)
target.height = target.parent.height - target.y
}
}
Loading

0 comments on commit 0f64650

Please sign in to comment.