Doxygenize ToolBar, ToolBarLayout and ToolButton

This commit is contained in:
Aurélien Gâteau 2012-12-17 23:35:55 +01:00
parent 0020ee88bf
commit 421ce66721
3 changed files with 84 additions and 111 deletions

View File

@ -17,53 +17,23 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
/**Documented API
Inherits:
PlasmaCore.FrameSvgItem
Imports:
QtQuick 1.1
org.kde.plasma.core
Description:
A plasma theme based toolbar.
Properties:
Item tools:
The ToolBarLayout that contains the ToolButton components that
are contained in the ToolBar. ToolBarLayout is not mandatory.
The default value is NULL.
string transition:
The type of transition to be used for the ToolBar when
the page changes on the relevant PageStack.
The possible values can be one of the following:
set an instantaneous change (default)
push follows page stack push animation
pop follows page stack pop animation
replace follows page stack replace animation
Object margins:
margins from the toolbar to the contents. it had 4 properties: left, top, right, bottom
Methods:
void setTools( tools, transition ):
This sets the tools for the ToolBar and the transition type that
will be used when the page changes on the relevant PageStack.
@arg Item tools see tool property
@arg string transition see transition property
**/
import QtQuick 1.1
import org.kde.plasma.core 0.1 as PlasmaCore
/**
* A plasma theme based toolbar.
*/
Item{
id: toolBar
width: parent.width
height: (tools && enabled) ? tools.height + frameSvg.margins.top + frameSvg.margins.bottom : 0
visible: height > 0
/**
* type:Object margins
* margins from the toolbar to the contents. It has 4 properties: left,
* top, right, bottom
*/
property alias margins: frameSvg.margins
Behavior on height {
@ -74,14 +44,25 @@ Item{
}
z: 1000
// The current set of tools; null if none.
/**
* The ToolBarLayout that contains the ToolButton components that are
* contained in the ToolBar. ToolBarLayout is not mandatory.
*
* The default value is null.
*/
property Item tools
// The transition type. One of the following:
// set an instantaneous change (default)
// push follows page stack push animation
// pop follows page stack pop animation
// replace follows page stack replace animation
/**
* The type of transition to be used for the ToolBar when the page changes
* on the relevant PageStack.
*
* The possible values can be one of the following:
*
* - set: an instantaneous change (default)
* - push: follows page stack push animation
* - pop: follows page stack pop animation
* - replace: follows page stack replace animation
*/
property string transition: "set"
//This invisible item keeps all the old dismissed tools:
@ -90,7 +71,14 @@ Item{
id: oldToolsItem
visible: false
}
// Sets the tools with a transition.
/**
* This sets the tools for the ToolBar and the transition type that will be
* used when the page changes on the relevant PageStack.
*
* @param type:Item tools see tool property
* @param type:string transition see transition property
*/
function setTools(tools, transition)
{
if (toolBar.tools == tools) {

View File

@ -17,25 +17,13 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
// ToolBarLayout is a container for items on a toolbar that automatically
// implements an appropriate layout for its children.
/**Documented API
Inherits:
Row
Imports:
QtQuick 1.1
Description:
ToolBarLayout is a container for items on a toolbar that automatically implements an appropriate layout for its children.
**/
import QtQuick 1.1
import "." 0.1
/**
* ToolBarLayout is a container for items on a toolbar that automatically
* implements an appropriate layout for its children.
*/
Row {
id: root

View File

@ -18,71 +18,61 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
/**Documented API
Inherits:
Item
Imports:
QtQuick 1.1
org.kde.plasma.core
Description:
A plasma theme based toolbutton.
Properties:
bool flat:
Returns true if the button is flat.
bool checked: false
Returns true if the button is checked.
bool checkable:
Returns true if the button is checkable.
bool pressed:
Returns true if the button is pressed.
alias text:
Sets the text for the button.
variant iconSource:
Sets the icon for the button.
It can be any image from any protocol supported by the Image element, or a freedesktop-compatible icon name
string font:
Sets the font for the button.
bool enabled:
Returns whether the button is currently enabled and receives user input.
Signals:
onClicked:
The signal is being emmited when the button is being clicked.
Plasma properties:
* real minimumWidth:
This property holds the smallest width this button can be to show all the contents
* real minimumHeight:
This property holds the smallest height this button can be to show all the contents
**/
import QtQuick 1.1
import org.kde.plasma.core 0.1 as PlasmaCore
import "private" as Private
/**
* A plasma theme based toolbutton.
*/
Item {
id: button
// Commmon API
/**
* true if the button is flat.
*/
property bool flat: true
/**
* true if the button is checked.
*/
property bool checked: defaultAction ? defaultAction.checked : false
/**
* true if the button is checkable.
*/
property bool checkable: defaultAction ? defaultAction.checkable : false
/**
* type:string
* true if the button is currently pressed.
*/
property alias pressed: mouse.pressed
/**
* type:string
* The text of the button
*/
property alias text: label.text
/**
* type:variant
*
* Sets the icon for the button. It can be any image from any protocol
* supported by the Image element, or a freedesktop-compatible icon name
*/
property alias iconSource: icon.source
/**
* type:font
* The font for the button
*/
property alias font: label.font
/**
* Emited when the button is clicked.
*/
signal clicked()
// Plasma extensiuons
@ -91,10 +81,17 @@ Item {
enabled: defaultAction == undefined || defaultAction.enabled
/**
* The smallest width this button can be to show all the contents
*/
//icon + label + left margin + right margin + spacing between icon and text
//here it assumesleft margin = right top = bottom, why?
// because the right and bottom margins can be disabled, so they would return 0, but their actual size is still needed for size hints
property real minimumWidth: theme.smallIconSize + label.preferredWidth + delegate.margins.left + delegate.margins.left + ((icon.valid) ? delegate.margins.left : 0)
/**
* The smallest height this button can be to show all the contents
*/
property real minimumHeight: Math.max(theme.smallIconSize, label.paintedHeight) + delegate.margins.top + delegate.margins.top
implicitWidth: {