mirror of https://github.com/cutefishos/texteditor
Add TabCloseButton.qml
parent
9f05fb681a
commit
720c767d01
@ -0,0 +1,68 @@
|
||||
/*
|
||||
* Copyright (C) 2021 CutefishOS Team.
|
||||
*
|
||||
* Author: Reion Wong <reion@cutefishos.com>
|
||||
*
|
||||
* 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 3 of the License, or
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import QtQuick 2.12
|
||||
import QtQuick.Window 2.3
|
||||
import QtQuick.Controls 2.4
|
||||
import FishUI 1.0 as FishUI
|
||||
|
||||
Item {
|
||||
id: control
|
||||
|
||||
property var size: 32
|
||||
property var iconMargins: 0
|
||||
height: size
|
||||
width: size
|
||||
|
||||
property alias background: _background
|
||||
property color backgroundColor: "transparent"
|
||||
property color hoveredColor: "#FF5C6D"
|
||||
property color pressedColor: "#CC4A57"
|
||||
property alias source: _image.source
|
||||
property alias image: _image
|
||||
signal clicked()
|
||||
|
||||
Rectangle {
|
||||
id: _background
|
||||
anchors.fill: parent
|
||||
anchors.margins: size * 0.1
|
||||
radius: control.height / 2
|
||||
opacity: 0.9
|
||||
color: mouseArea.pressed ? pressedColor : mouseArea.containsMouse ? control.hoveredColor : control.backgroundColor
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
id: mouseArea
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
|
||||
onClicked: control.clicked()
|
||||
}
|
||||
|
||||
Image {
|
||||
id: _image
|
||||
objectName: "image"
|
||||
anchors.fill: parent
|
||||
anchors.margins: control.iconMargins
|
||||
fillMode: Image.PreserveAspectFit
|
||||
sourceSize: Qt.size(width, height)
|
||||
cache: true
|
||||
asynchronous: false
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,13 @@
|
||||
#include "highlightmodel.h"
|
||||
#include <QDebug>
|
||||
|
||||
HighlightModel::HighlightModel(QObject *parent)
|
||||
: QObject(parent)
|
||||
{
|
||||
for (KSyntaxHighlighting::Definition def : m_repository.definitions()) {
|
||||
if (def.isHidden())
|
||||
continue;
|
||||
|
||||
qDebug() << def.translatedName();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,20 @@
|
||||
#ifndef HIGHLIGHTMODEL_H
|
||||
#define HIGHLIGHTMODEL_H
|
||||
|
||||
#include <QObject>
|
||||
|
||||
#include <KSyntaxHighlighting/Repository>
|
||||
#include <KSyntaxHighlighting/Definition>
|
||||
|
||||
class HighlightModel : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit HighlightModel(QObject *parent = nullptr);
|
||||
|
||||
private:
|
||||
KSyntaxHighlighting::Repository m_repository;
|
||||
};
|
||||
|
||||
#endif // HIGHLIGHTMODEL_H
|
||||
Loading…
Reference in New Issue