diff --git a/src/qml/common/ToolTip.qml b/src/qml/common/ToolTip.qml new file mode 100644 index 0000000..d07f9a8 --- /dev/null +++ b/src/qml/common/ToolTip.qml @@ -0,0 +1,43 @@ +/* + * Copyright 2017 Sebastian Gottfried + * + * This program 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 2 of + * the License, or (at your option) any later version. + * + * This program 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 this program. If not, see . + */ + +import QtQuick 2.9 +import QtQuick.Controls 2.2 as Controls +import ktouch 1.0 + +Controls.ToolTip { + id: control + + property alias colorScheme: colorScheme + + KColorScheme { + id: colorScheme + colorGroup: KColorScheme.Active + colorSet: KColorScheme.Complementary + } + + contentItem: Text { + text: control.text + font: control.font + color: colorScheme.normalText + } + + background: Rectangle { + radius: height / 6 + color: control.colorScheme.normalBackground + } +} diff --git a/src/qml/homescreen/LessonSelectorItem.qml b/src/qml/homescreen/LessonSelectorItem.qml index aed8a97..4787e40 100644 --- a/src/qml/homescreen/LessonSelectorItem.qml +++ b/src/qml/homescreen/LessonSelectorItem.qml @@ -1,157 +1,159 @@ /* * Copyright 2017 Sebastian Gottfried * * This program 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 2 of * the License, or (at your option) any later version. * * This program 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 this program. If not, see . */ import QtQuick 2.9 import QtQuick.Layouts 1.3 -import QtQuick.Controls 2.2 import ktouch 1.0 import '../common' Item { id: root property Lesson lesson property bool selected property bool editable: false property alias background: background signal clicked signal doubleClicked signal deleteButtonClicked signal editButtonClicked signal statButtonClicked clip: true KColorScheme { id: selectionColorScheme colorGroup: KColorScheme.Active colorSet: KColorScheme.Selection } Rectangle { id: background anchors.fill: parent color: selected? Qt.tint(selectionColorScheme.normalBackground, "#a0ffffff"): "#ffffff" } MouseArea { anchors.fill: parent onClicked: { root.clicked() } onDoubleClicked: { root.doubleClicked() } } GridLayout { id: content anchors.fill: parent anchors.margins: 10 Label { id: titleLabel Layout.column: 0 Layout.row: 0 Layout.fillWidth: true Layout.preferredHeight: buttonRow.implicitHeight text: lesson? lesson.title: "" color: "#000000" font.bold: true elide: Label.ElideRight verticalAlignment: Qt.AlignVCenter - ToolTip.text: titleLabel.text - ToolTip.visible: titleMouseArea.containsMouse + ToolTip { + parent: titleLabel + text: titleLabel.text + visible: titleMouseArea.containsMouse + } MouseArea { id: titleMouseArea anchors.fill: parent acceptedButtons: Qt.NoButton hoverEnabled: titleLabel.truncated } } Row { id: buttonRow Layout.column: 1 Layout.row: 0 visible: root.selected IconToolButton { id: editButton visible: root.editable icon: 'edit-entry' color: "#000000" backgroundColor: "#c0c0c0c0" onClicked: { root.editButtonClicked(); } } IconToolButton { id: deleteButton visible: root.editable icon: 'edit-delete' color: "#000000" backgroundColor: "#c0c0c0c0" onClicked: { root.deleteButtonClicked(); } } IconToolButton { icon: 'view-statistics' color: "#000000" backgroundColor: "#c0c0c0c0" onClicked: { root.statButtonClicked(); } } } Item { Layout.column: 0 Layout.row: 1 Layout.columnSpan: 2 Layout.fillHeight: true Layout.fillWidth: true clip: true Label { id: textLabel anchors.fill: parent text: lesson? lesson.text: "" color: "#000000" font.family: 'monospace' lineHeight: 1.5 scale: Math.min(1, width / implicitWidth) transformOrigin: Item.TopLeft } Rectangle { anchors.fill: parent gradient: Gradient { GradientStop { position: 0.0; color: "#00000000" } GradientStop { position: 0.8; color: Qt.rgba(background.color.r, background.color.g, background.color.b, 0) } GradientStop { position: 1.0; color: background.color } } } } } } diff --git a/src/qml/qml.qrc b/src/qml/qml.qrc index c18aca3..eb3f119 100644 --- a/src/qml/qml.qrc +++ b/src/qml/qml.qrc @@ -1,64 +1,65 @@ common/AutoTriggerButton.qml common/Balloon.qml common/Collapsable.qml common/FocusBar.qml common/GridView.qml common/Icon.qml common/IconButton.qml common/IconLabel.qml common/IconToolButton.qml common/InfoItem.qml common/InformationTable.qml common/InlineToolbar.qml common/Label.qml common/LearningProgressChart.qml common/ListItem.qml common/ListView.qml common/MessageBox.qml common/MonochromeIcon.qml common/PopupDialog.qml common/RadioButton.qml common/ScrollBar.qml common/SelectionGrip.qml common/SelectionRectangle.qml common/TextArea.qml common/TextField.qml common/ToolBar.qml common/ToolSeparator.qml + common/ToolTip.qml homescreen/CourseDescriptionItem.qml homescreen/CourseSelector.qml homescreen/CourseSelectorKeyboardLayoutItem.qml homescreen/CourseSelectorKeyboardLayoutList.qml homescreen/HomeScreen.qml homescreen/InitialProfileDialog.qml homescreen/KeyboardLayoutMismatchMessage.qml homescreen/LessonDeletedMessage.qml homescreen/LessonEditorDialog.qml homescreen/LessonLockedNotice.qml homescreen/LessonSelector.qml homescreen/LessonSelectorItem.qml homescreen/ProfileComboBox.qml homescreen/ProfileDetailsItem.qml homescreen/ProfileForm.qml homescreen/ProfileSelector.qml homescreen/StatPopupDialog.qml keyboard/KeyItem.qml keyboard/KeyLabel.qml keyboard/Keyboard.qml keyboard/KeyboardLayoutEditor.qml main.qml meters/AccuracyMeter.qml meters/CharactersPerMinuteMeter.qml meters/ElapsedTimeMeter.qml meters/Meter.qml meters/StatBox.qml scorescreen/ScoreScreen.qml trainingscreen/KeyboardUnavailableNotice.qml trainingscreen/TrainingScreen.qml trainingscreen/TrainingScreenMenuOverlay.qml trainingscreen/TrainingScreenToolbar.qml trainingscreen/TrainingWidget.qml