Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qgroundcontrol
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
9e654007
Commit
9e654007
authored
Oct 22, 2015
by
Don Gagne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add Qml Coding Style
Plus some C++ tweaks
parent
d2c0ef2c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
87 additions
and
22 deletions
+87
-22
CodingStyle.cc
CodingStyle.cc
+3
-9
CodingStyle.h
CodingStyle.h
+7
-13
CodingStyle.qml
CodingStyle.qml
+77
-0
No files found.
CodingStyle.cc
View file @
9e654007
...
...
@@ -21,15 +21,9 @@
======================================================================*/
// The above copyright block should be at the top of every file.
/// @file
/// @brief This is an example class c++ file which is used to describe the QGroundControl
/// coding style. In general almost everything in here has some coding style meaning.
/// For example, note how this doxygen block uses the /// variant as the preferred style
/// of doxygen marker. Not all style choices are explained.
///
/// @author Don Gagne <don@thegagnes.com>
// This is an example class c++ file which is used to describe the QGroundControl
// coding style. In general almost everything in here has some coding style meaning.
// Not all style choices are explained.
#include "CodingStyle.h"
#include "QGCApplication.h"
...
...
CodingStyle.h
View file @
9e654007
...
...
@@ -21,18 +21,12 @@
======================================================================*/
// The above copyright block should be at the top of every file.
// This is an example class header file which is used to describe the QGroundControl
// coding style. In general almost everything in here has some coding style meaning.
// Not all style choices are explained.
/// @file
/// @brief This is an example class header file which is used to describe the QGroundControl
/// coding style. In general almost everything in here has some coding style meaning.
/// For example, note how this doxygen block uses the /// variant as the preferred style
/// of doxygen marker. Not all style choices are explained.
///
/// @author Don Gagne <don@thegagnes.com>
#ifndef CODINGSTYLE_H
#define CODINGSTYLE_H
#ifndef CodingStyle_H
#define CodingStyle_H
#include <QObject>
#include <QMap>
...
...
@@ -44,7 +38,7 @@
#include "Fact.h"
#include "UASInterface.h"
// Note how the Qt headers, Syste, headers and the QGroundControl headers above are kept in seperate groups
// Note how the Qt headers, Syste
m
, headers and the QGroundControl headers above are kept in seperate groups
// If you are going to use a logging category for a class it should have the same name as the class
// with a suffix of Log.
...
...
@@ -100,4 +94,4 @@ private:
static
const
int
_privateStaticVariable
;
};
#endif
\ No newline at end of file
#endif
CodingStyle.qml
0 → 100644
View file @
9e654007
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009, 2015 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the QGROUNDCONTROL project
QGROUNDCONTROL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
QGROUNDCONTROL 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 QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/
import
QtQuick
2.4
import
QtQuick
.
Controls
1.3
import
QGroundControl
1.0
import
QGroundControl
.
ScreenTools
1.0
import
QGroundControl
.
Controls
1.0
import
QGroundControl
.
Palette
1.0
/// This is an example Qml file which is used to describe the QGroundControl coding style.
/// In general almost everything in here has some coding style meaning including order of
/// code. Not all style choices are explained. If there is any confusison please ask
/// and we'll answer and update style as needed.
Item
{
// Property binding to item properties
width
:
ScreenTools
.
defaultFontPixelHeight
*
10
// No hardcoded sizing. All sizing must be relative to a ScreenTools font size
height
:
ScreenTools
.
defaultFontPixelHeight
*
20
// Property definitions available to consumers of this Qml Item come first
property
int
myIntProperty
:
10
property
real
myRealProperty
:
20.0
// Property definitions which are internal to the item are prepending with an underscore
// to signal private and come second
readonly
property
real
_rectWidth
:
ScreenTools
.
defaultFontPixelWidth
*
10
// Use readonly appropriately to increase binding performance
readonly
property
real
_rectHeight
:
ScreenTools
.
defaultFontPixelWidth
*
10
function
myFunction
()
{
console
.
log
(
"
myFunction was called
"
)
}
QGCPalette
{
id
:
qgcPal
// Not how id does not use an underscore
colorGroupEnabled
:
enabled
}
// You should always use the QGC provided variants of base control since they automatically support
// our theming and font support.
QGCButton
{
// Also not how there is no id: specified for this control. Only add id: if it is needed.
text
:
"
Button
"
onClicked
:
myFunction
()
}
Rectangle
{
width
:
_rectWidth
height
:
_rectHeight
color
:
qgcPal
.
window
// Use QGC palette colors for everything, no hardcoded colors
}
// For scoped blocks which are long include a comment so you can tell what the brace is matching.
// This is very handy when the top level brace scrolls off the screen. The endbrace comment in this
// specific file is only included as style info. This example code is not long enough to really need it.
}
// Item - CodingStyle
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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