2011-07-06 15:48:52 +00:00
|
|
|
/**************************************************************************
|
|
|
|
|
**
|
|
|
|
|
** This file is part of Qt Creator
|
|
|
|
|
**
|
2012-01-26 18:33:46 +01:00
|
|
|
** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
2011-07-06 15:48:52 +00:00
|
|
|
**
|
2012-07-19 12:26:56 +02:00
|
|
|
** Contact: http://www.qt-project.org/
|
2011-07-06 15:48:52 +00:00
|
|
|
**
|
|
|
|
|
**
|
|
|
|
|
** GNU Lesser General Public License Usage
|
|
|
|
|
**
|
|
|
|
|
** This file may be used under the terms of the GNU Lesser General Public
|
|
|
|
|
** License version 2.1 as published by the Free Software Foundation and
|
|
|
|
|
** appearing in the file LICENSE.LGPL included in the packaging of this file.
|
|
|
|
|
** Please review the following information to ensure the GNU Lesser General
|
|
|
|
|
** Public License version 2.1 requirements will be met:
|
|
|
|
|
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
|
|
|
**
|
|
|
|
|
** In addition, as a special exception, Nokia gives you certain additional
|
|
|
|
|
** rights. These rights are described in the Nokia Qt LGPL Exception
|
|
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
|
**
|
|
|
|
|
** Other Usage
|
|
|
|
|
**
|
|
|
|
|
** Alternatively, this file may be used in accordance with the terms and
|
|
|
|
|
** conditions contained in a signed written agreement between you and Nokia.
|
|
|
|
|
**
|
|
|
|
|
**
|
|
|
|
|
**************************************************************************/
|
|
|
|
|
|
2010-04-13 11:37:57 +02:00
|
|
|
import Qt 4.7
|
2010-01-29 16:38:34 +01:00
|
|
|
import Bauhaus 1.0
|
2010-01-07 12:14:35 +01:00
|
|
|
|
2010-02-05 15:42:31 +10:00
|
|
|
QWidget { //This is a special checkBox that does color coding for states
|
2010-01-07 12:14:35 +01:00
|
|
|
|
2010-02-05 15:42:31 +10:00
|
|
|
id: checkBox;
|
2010-01-07 12:14:35 +01:00
|
|
|
|
2010-04-13 11:20:39 +02:00
|
|
|
property variant backendValue;
|
2010-01-07 12:14:35 +01:00
|
|
|
|
2010-04-13 11:20:39 +02:00
|
|
|
property variant baseStateFlag;
|
2010-02-05 15:42:31 +10:00
|
|
|
property alias checkable: localCheckBox.checkable
|
|
|
|
|
property alias text: localLabel.text
|
2010-01-07 12:14:35 +01:00
|
|
|
|
2010-02-04 12:57:57 +01:00
|
|
|
onBaseStateFlagChanged: {
|
2010-01-07 12:14:35 +01:00
|
|
|
evaluate();
|
|
|
|
|
}
|
|
|
|
|
|
2010-02-04 12:57:57 +01:00
|
|
|
onBackendValueChanged: {
|
|
|
|
|
evaluate();
|
|
|
|
|
}
|
2010-02-25 16:48:20 +01:00
|
|
|
|
2010-03-15 16:24:04 +01:00
|
|
|
property bool isInModel: backendValue.isInModel;
|
2010-02-04 12:57:57 +01:00
|
|
|
|
|
|
|
|
onIsInModelChanged: {
|
|
|
|
|
evaluate();
|
|
|
|
|
}
|
|
|
|
|
|
2010-03-15 16:24:04 +01:00
|
|
|
property bool isInSubState: backendValue.isInSubState;
|
2010-02-04 12:57:57 +01:00
|
|
|
|
|
|
|
|
onIsInSubStateChanged: {
|
|
|
|
|
evaluate();
|
|
|
|
|
}
|
|
|
|
|
|
2010-03-23 10:02:49 +01:00
|
|
|
function evaluate() {
|
|
|
|
|
if (!enabled) {
|
|
|
|
|
localLabel.setStyleSheet("color: "+scheme.disabledColor);
|
|
|
|
|
} else {
|
|
|
|
|
if (baseStateFlag) {
|
|
|
|
|
if (backendValue.isInModel)
|
|
|
|
|
localLabel.setStyleSheet("color: "+scheme.changedBaseColor);
|
|
|
|
|
else
|
|
|
|
|
localLabel.setStyleSheet("color: "+scheme.boldTextColor);
|
2010-01-08 17:17:48 +01:00
|
|
|
} else {
|
2010-03-23 10:02:49 +01:00
|
|
|
if (backendValue.isInSubState)
|
|
|
|
|
localLabel.setStyleSheet("color: "+scheme.changedStateColor);
|
|
|
|
|
else
|
|
|
|
|
localLabel.setStyleSheet("color: "+scheme.boldTextColor);
|
2010-01-08 17:17:48 +01:00
|
|
|
}
|
2010-02-04 12:57:57 +01:00
|
|
|
}
|
|
|
|
|
}
|
2010-02-25 16:48:20 +01:00
|
|
|
|
|
|
|
|
ColorScheme { id:scheme; }
|
2010-02-04 12:57:57 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
layout: HorizontalLayout {
|
|
|
|
|
spacing: 4
|
|
|
|
|
|
|
|
|
|
QCheckBox {
|
2010-02-05 15:42:31 +10:00
|
|
|
id: localCheckBox
|
2010-02-04 12:57:57 +01:00
|
|
|
checkable: true;
|
2010-03-15 16:24:04 +01:00
|
|
|
checked: backendValue.value;
|
2010-02-04 12:57:57 +01:00
|
|
|
onToggled: {
|
|
|
|
|
backendValue.value = checked;
|
|
|
|
|
}
|
2010-02-25 16:48:20 +01:00
|
|
|
maximumWidth: 30
|
2010-02-04 12:57:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QLabel {
|
2010-02-05 15:42:31 +10:00
|
|
|
id: localLabel
|
2010-02-04 12:57:57 +01:00
|
|
|
font.bold: true;
|
2010-02-25 16:48:20 +01:00
|
|
|
alignment: "Qt::AlignLeft | Qt::AlignVCenter"
|
2010-02-04 12:57:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ExtendedFunctionButton {
|
2010-02-05 15:42:31 +10:00
|
|
|
backendValue: checkBox.backendValue
|
2010-03-24 17:10:07 +01:00
|
|
|
y: 3
|
2010-02-05 15:42:31 +10:00
|
|
|
x: localCheckBox.x + 18;
|
2010-01-27 18:38:09 +01:00
|
|
|
}
|
2010-01-07 12:14:35 +01:00
|
|
|
}
|
2010-02-04 12:57:57 +01:00
|
|
|
|