Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
1388ac3a
Commit
1388ac3a
authored
Oct 12, 2015
by
dogmaphobic
Browse files
Adding a palette for map buttons.
parent
6d20e85d
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/QGCPalette.cc
View file @
1388ac3a
...
...
@@ -98,6 +98,16 @@ QColor QGCPalette::_textFieldText[QGCPalette::_cThemes][QGCPalette::_cColorGroup
{
QColor
(
0x2c
,
0x2c
,
0x2c
),
QColor
(
0
,
0
,
0
)
},
};
QColor
QGCPalette
::
_mapButton
[
QGCPalette
::
_cThemes
][
QGCPalette
::
_cColorGroups
]
=
{
{
QColor
(
0x58
,
0x58
,
0x58
),
QColor
(
0
,
0
,
0
)
},
{
QColor
(
0x58
,
0x58
,
0x58
),
QColor
(
0
,
0
,
0
)
},
};
QColor
QGCPalette
::
_mapButtonHighlight
[
QGCPalette
::
_cThemes
][
QGCPalette
::
_cColorGroups
]
=
{
{
QColor
(
0x58
,
0x58
,
0x58
),
QColor
(
190
,
120
,
28
)
},
{
QColor
(
0x58
,
0x58
,
0x58
),
QColor
(
190
,
120
,
28
)
},
};
QGCPalette
::
QGCPalette
(
QObject
*
parent
)
:
QObject
(
parent
),
_colorGroupEnabled
(
true
)
...
...
src/QGCPalette.h
View file @
1388ac3a
...
...
@@ -86,6 +86,12 @@ class QGCPalette : public QObject
// Text color for TextFields
Q_PROPERTY
(
QColor
textFieldText
READ
textFieldText
NOTIFY
paletteChanged
)
/// Background color for map buttons
Q_PROPERTY
(
QColor
mapButton
READ
mapButton
NOTIFY
paletteChanged
)
/// Background color for map button in selected or hover state
Q_PROPERTY
(
QColor
mapButtonHighlight
READ
mapButtonHighlight
NOTIFY
paletteChanged
)
public:
enum
ColorGroup
{
Disabled
=
0
,
...
...
@@ -121,6 +127,9 @@ public:
QColor
textField
(
void
)
const
{
return
_textField
[
_theme
][
_colorGroupEnabled
?
1
:
0
];
}
QColor
textFieldText
(
void
)
const
{
return
_textFieldText
[
_theme
][
_colorGroupEnabled
?
1
:
0
];
}
QColor
mapButton
(
void
)
const
{
return
_mapButton
[
_theme
][
_colorGroupEnabled
?
1
:
0
];
}
QColor
mapButtonHighlight
(
void
)
const
{
return
_mapButtonHighlight
[
_theme
][
_colorGroupEnabled
?
1
:
0
];
}
static
Theme
globalTheme
(
void
)
{
return
_theme
;
}
static
void
setGlobalTheme
(
Theme
newTheme
);
...
...
@@ -154,6 +163,9 @@ private:
static
QColor
_textField
[
_cThemes
][
_cColorGroups
];
static
QColor
_textFieldText
[
_cThemes
][
_cColorGroups
];
static
QColor
_mapButton
[
_cThemes
][
_cColorGroups
];
static
QColor
_mapButtonHighlight
[
_cThemes
][
_cColorGroups
];
void
_themeChanged
(
void
);
static
QList
<
QGCPalette
*>
_paletteObjects
;
///< List of all active QGCPalette objects
...
...
src/QmlControls/DropButton.qml
View file @
1388ac3a
...
...
@@ -162,7 +162,7 @@ Item {
border.width
:
2
border.color
:
"
white
"
opacity
:
checked
?
0.95
:
0.65
color
:
checked
?
"
orange
"
:
"
black
"
color
:
checked
?
qgcPal
.
mapButtonHighlight
:
qgcPal
.
mapButton
Image
{
id
:
button
...
...
src/QmlControls/RoundButton.qml
View file @
1388ac3a
...
...
@@ -3,6 +3,7 @@ import QtQuick.Controls 1.2
import
QtQuick
.
Controls
.
Styles
1.2
import
QGroundControl
.
ScreenTools
1.0
import
QGroundControl
.
Palette
1.0
Item
{
id
:
_root
...
...
@@ -17,6 +18,8 @@ Item {
property
bool
checked
:
false
property
ExclusiveGroup
exclusiveGroup
:
null
QGCPalette
{
id
:
qgcPal
}
onExclusiveGroupChanged
:
{
if
(
exclusiveGroup
)
{
exclusiveGroup
.
bindCheckable
(
_root
)
...
...
@@ -29,7 +32,7 @@ Item {
border.width
:
2
border.color
:
"
white
"
opacity
:
checked
?
0.95
:
0.65
color
:
checked
?
"
orange
"
:
"
black
"
color
:
checked
?
qgcPal
.
mapButtonHighlight
:
qgcPal
.
mapButton
Image
{
id
:
button
anchors.fill
:
parent
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment