forked from openkylin/qt5-ukui-platformtheme
!18 Import openkylin/yangtze 3.1.4.1~0509-ok10 2022.08.23
Merge pull request !18 from tanjing/tanjing_openkylin/yangtze
This commit is contained in:
commit
0ccca7aa82
|
@ -327,7 +327,7 @@ bool DefaultSlideAnimator::filterTmpPage(QObject *obj, QEvent *e)
|
|||
if (this->state() == QAbstractAnimation::Running) {
|
||||
QPainter p(w);
|
||||
auto value = this->currentValue().toDouble();
|
||||
p.setRenderHints(QPainter::Antialiasing);
|
||||
p.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
|
||||
p.setCompositionMode(QPainter::CompositionMode_Source);
|
||||
|
||||
//do a horizon slide.
|
||||
|
|
|
@ -159,11 +159,11 @@ const QColor HighLightEffect::getCurrentSymbolicColor()
|
|||
|
||||
const QColor HighLightEffect::defaultStyleDark(const QStyleOption *option)
|
||||
{
|
||||
auto windowText = qApp->palette().windowText().color();
|
||||
auto windowText = qApp->palette().color(QPalette::Active, QPalette::WindowText);
|
||||
qreal h, s, v;
|
||||
|
||||
if (option) {
|
||||
windowText = option->palette.windowText().color();
|
||||
windowText = option->palette.color(QPalette::Active, QPalette::WindowText);
|
||||
}
|
||||
|
||||
windowText.getHsvF(&h, &s, &v);
|
||||
|
@ -186,8 +186,7 @@ QPixmap HighLightEffect::generatePixmap(const QPixmap &pixmap, const QStyleOptio
|
|||
return pixmap;
|
||||
|
||||
QPainter p(&target);
|
||||
p.setRenderHint(QPainter::Antialiasing);
|
||||
p.setRenderHint(QPainter::SmoothPixmapTransform);
|
||||
p.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
|
||||
p.setCompositionMode(QPainter::CompositionMode_SourceIn);
|
||||
if (option->state & QStyle::State_MouseOver ||
|
||||
option->state & QStyle::State_Selected ||
|
||||
|
@ -246,8 +245,7 @@ QPixmap HighLightEffect::generatePixmap(const QPixmap &pixmap, const QStyleOptio
|
|||
return target;
|
||||
|
||||
QPainter p(&target);
|
||||
p.setRenderHint(QPainter::Antialiasing);
|
||||
p.setRenderHint(QPainter::SmoothPixmapTransform);
|
||||
p.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
|
||||
p.setCompositionMode(QPainter::CompositionMode_SourceIn);
|
||||
p.fillRect(target.rect(), option->palette.highlightedText());
|
||||
return target;
|
||||
|
@ -260,8 +258,7 @@ QPixmap HighLightEffect::generatePixmap(const QPixmap &pixmap, const QStyleOptio
|
|||
return target;
|
||||
|
||||
QPainter p(&target);
|
||||
p.setRenderHint(QPainter::Antialiasing);
|
||||
p.setRenderHint(QPainter::SmoothPixmapTransform);
|
||||
p.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
|
||||
p.setCompositionMode(QPainter::CompositionMode_SourceIn);
|
||||
p.fillRect(target.rect(), mode ? option->palette.text() : defaultStyleDark(option));
|
||||
return target;
|
||||
|
@ -303,8 +300,7 @@ QPixmap HighLightEffect::ordinaryGeneratePixmap(const QPixmap &pixmap, const QSt
|
|||
}
|
||||
|
||||
QPainter p(&target);
|
||||
p.setRenderHint(QPainter::Antialiasing);
|
||||
p.setRenderHint(QPainter::SmoothPixmapTransform);
|
||||
p.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
|
||||
p.setCompositionMode(QPainter::CompositionMode_SourceIn);
|
||||
p.fillRect(target.rect(), color.isValid() ? color : (mode ? option->palette.text() : defaultStyleDark(option)));
|
||||
return target;
|
||||
|
@ -338,8 +334,7 @@ QPixmap HighLightEffect::hoverGeneratePixmap(const QPixmap &pixmap, const QStyle
|
|||
|
||||
QPainter p(&target);
|
||||
if (overOrDown) {
|
||||
p.setRenderHint(QPainter::Antialiasing);
|
||||
p.setRenderHint(QPainter::SmoothPixmapTransform);
|
||||
p.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
|
||||
p.setCompositionMode(QPainter::CompositionMode_SourceIn);
|
||||
p.fillRect(target.rect(), color.isValid() ? color : option->palette.highlightedText());
|
||||
}
|
||||
|
@ -377,13 +372,11 @@ QPixmap HighLightEffect::bothOrdinaryAndHoverGeneratePixmap(const QPixmap &pixma
|
|||
|
||||
QPainter p(&target);
|
||||
if (overOrDown) {
|
||||
p.setRenderHint(QPainter::Antialiasing);
|
||||
p.setRenderHint(QPainter::SmoothPixmapTransform);
|
||||
p.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
|
||||
p.setCompositionMode(QPainter::CompositionMode_SourceIn);
|
||||
p.fillRect(target.rect(), hoverColor.isValid() ? hoverColor : option->palette.highlightedText());
|
||||
} else {
|
||||
p.setRenderHint(QPainter::Antialiasing);
|
||||
p.setRenderHint(QPainter::SmoothPixmapTransform);
|
||||
p.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
|
||||
p.setCompositionMode(QPainter::CompositionMode_SourceIn);
|
||||
p.fillRect(target.rect(), defaultColor.isValid() ? defaultColor : (mode ? option->palette.text() : defaultStyleDark(option)));
|
||||
}
|
||||
|
|
|
@ -64,6 +64,7 @@ static const QStringList useDarkPaletteList() {
|
|||
l<<"ukui-flash-disk";
|
||||
// l<<"ukui-bluetooth";
|
||||
l<<"mktip";
|
||||
l<<"kylin-video";
|
||||
|
||||
return l;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<schemalist>
|
||||
<schema id="org.ukui.style" path="/org/ukui/style/" gettext-domain="style">
|
||||
<key type="s" name="style-name">
|
||||
<default>"ukui-default"</default>
|
||||
<default>"ukui-light"</default>
|
||||
<summary>Current Qt Style</summary>
|
||||
<description>Set style for UKUI desktop environment. Have ukui-dark ukui-default ukui-light</description>
|
||||
</key>
|
||||
|
@ -70,7 +70,7 @@
|
|||
<key type="s" name="theme-color">
|
||||
<default>"daybreakBlue"</default>
|
||||
<summary> theme color</summary>
|
||||
<description>Set theme color for UKUI desktop environment.</description>
|
||||
<description>Set theme color for UKUI desktop environment.include default,daybreakBlue,jamPurple,magenta,sunRed,sunsetOrange,dustGold,polarGreen</description>
|
||||
</key>
|
||||
<key type="b" name="cursor-blink">
|
||||
<default>true</default>
|
||||
|
|
|
@ -87,7 +87,11 @@ Qt5UKUIPlatformTheme::Qt5UKUIPlatformTheme(const QStringList &args)
|
|||
* become very small. I handle the wizard title
|
||||
* in ProxyStyle::polish().
|
||||
*/
|
||||
QApplication::setFont(m_system_font);
|
||||
//Skip QGuiApplication avoid it crash when we setfont
|
||||
auto *app = qobject_cast<QApplication *>(qApp);
|
||||
if(app != nullptr) {
|
||||
QApplication::setFont(m_system_font);
|
||||
}
|
||||
|
||||
connect(settings, &QGSettings::changed, this, [=](const QString &key){
|
||||
if (key == "iconThemeName") {
|
||||
|
@ -104,6 +108,11 @@ Qt5UKUIPlatformTheme::Qt5UKUIPlatformTheme(const QStringList &args)
|
|||
}
|
||||
|
||||
if (key == "systemFont") {
|
||||
//Skip QGuiApplication avoid it crash when we setfont
|
||||
auto *app = qobject_cast<QApplication *>(qApp);
|
||||
if(app == nullptr)
|
||||
return;
|
||||
|
||||
QString font = settings->get("system-font").toString();
|
||||
QFontDatabase db;
|
||||
if (db.families().contains(font)) {
|
||||
|
@ -115,6 +124,11 @@ Qt5UKUIPlatformTheme::Qt5UKUIPlatformTheme(const QStringList &args)
|
|||
}
|
||||
}
|
||||
if (key == "systemFontSize") {
|
||||
//Skip QGuiApplication avoid it crash when we setfont
|
||||
auto *app = qobject_cast<QApplication *>(qApp);
|
||||
if(app == nullptr)
|
||||
return;
|
||||
|
||||
if (qApp->property("noChangeSystemFontSize").isValid() && qApp->property("noChangeSystemFontSize").toBool())
|
||||
return;
|
||||
double fontSize = settings->get("system-font-size").toString().toDouble();
|
||||
|
@ -126,13 +140,15 @@ Qt5UKUIPlatformTheme::Qt5UKUIPlatformTheme(const QStringList &args)
|
|||
QApplication::setFont(oldFont);
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
// add qqc2 style
|
||||
if (QFile::exists(QString("%1/kf5/kirigami/org.kylin.style.so").arg(QT_PLUGIN_INSTALL_DIRS))) {
|
||||
QQuickStyle::setStyle("org.kylin.style");
|
||||
}
|
||||
// // add qqc2 style
|
||||
// if (QFile::exists(QString("%1/kf5/kirigami/org.kylin.style.so").arg(QT_PLUGIN_INSTALL_DIRS))) {
|
||||
// QQuickStyle::setStyle("org.kylin.style");
|
||||
// }
|
||||
QQuickStyle::setStyle("org.ukui.style");
|
||||
}
|
||||
|
||||
Qt5UKUIPlatformTheme::~Qt5UKUIPlatformTheme()
|
||||
|
@ -186,6 +202,10 @@ QVariant Qt5UKUIPlatformTheme::themeHint(ThemeHint hint) const
|
|||
case QPlatformTheme::IconThemeSearchPaths:
|
||||
//FIXME:
|
||||
return QStringList()<<".local/share/icons"<<"/usr/share/icons"<<"/usr/local/share/icons";
|
||||
// case WheelScrollLines:
|
||||
// {
|
||||
// return QVariant(1);
|
||||
// }break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
#
|
||||
#-------------------------------------------------
|
||||
|
||||
QT += widgets dbus gui-private widgets-private x11extras quick quickcontrols2
|
||||
QT += widgets dbus gui-private widgets-private x11extras quick quickcontrols2 KWindowSystem
|
||||
|
||||
greaterThan(QT_MAJOR_VERSION, 5)|greaterThan(QT_MINOR_VERSION, 7): \
|
||||
QT += theme_support-private
|
||||
|
@ -15,7 +15,7 @@ TARGET = qt5-ukui-platformtheme
|
|||
TEMPLATE = lib
|
||||
CONFIG += plugin
|
||||
CONFIG += c++11 link_pkgconfig
|
||||
PKGCONFIG += gsettings-qt Qt5XdgIconLoader
|
||||
PKGCONFIG += gsettings-qt Qt5XdgIconLoader kysdk-waylandhelper
|
||||
|
||||
include(../libqt5-ukui-style/libqt5-ukui-style.pri)
|
||||
|
||||
|
|
|
@ -32,6 +32,8 @@
|
|||
#include <QStyleOption>
|
||||
#include <qpa/qplatformdialoghelper.h>
|
||||
#include <QtWidgets/qdialogbuttonbox.h>
|
||||
#include "ukuistylehelper/ukuistylehelper.h"
|
||||
#include "windowmanager/windowmanager.h"
|
||||
|
||||
#include "private/qlabel_p.h"
|
||||
#include "private/qdialog_p.h"
|
||||
|
@ -51,7 +53,7 @@
|
|||
#include <QGridLayout>
|
||||
#include <QSpacerItem>
|
||||
#include <QScrollArea>
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
|
||||
enum Button
|
||||
|
@ -114,7 +116,8 @@ public:
|
|||
QLabel* mIconLabel; // qt 显示图标
|
||||
QDialogButtonBox* mButtonBox; // qt 按钮框
|
||||
QPushButton* mDetailButton; // 详细情况按钮
|
||||
QPushButton *mCloseButtton;
|
||||
QPushButton* mCloseButtton; //标题栏关闭按钮
|
||||
QLabel* mTitleText; //标题文本
|
||||
|
||||
QByteArray mMemberToDisconnectOnClose;
|
||||
QByteArray mSignalToDisconnectOnClose;
|
||||
|
@ -244,6 +247,7 @@ void MessageBox::addButton(QAbstractButton *button, QMessageBox::ButtonRole role
|
|||
return;
|
||||
|
||||
removeButton(button);
|
||||
d->mOptions->addButton(button->text(), static_cast<QPlatformDialogHelper::ButtonRole>(role), button);
|
||||
d->mButtonBox->addButton(button, (QDialogButtonBox::ButtonRole)role);
|
||||
d->mCustomButtonList.append(button);
|
||||
d->mAutoAddOkButton = false;
|
||||
|
@ -466,11 +470,8 @@ void MessageBox::setDetailedText(const QString &text)
|
|||
|
||||
void MessageBox::setWindowTitle(const QString &title)
|
||||
{
|
||||
#ifndef Q_OS_MAC
|
||||
QDialog::setWindowTitle(title);
|
||||
#else
|
||||
Q_UNUSED(title);
|
||||
#endif
|
||||
Q_D(MessageBox);
|
||||
d->mTitleText->setText(title);
|
||||
}
|
||||
|
||||
void MessageBox::setWindowModality(Qt::WindowModality windowModality)
|
||||
|
@ -552,8 +553,9 @@ void MessageBox::showEvent(QShowEvent *event)
|
|||
addButton(QMessageBox::Ok);
|
||||
}
|
||||
|
||||
if (d->mDetailButton)
|
||||
if (d->mDetailButton) {
|
||||
addButton(d->mDetailButton, QMessageBox::ActionRole);
|
||||
}
|
||||
|
||||
d->detectEscapeButton();
|
||||
d->updateSize();
|
||||
|
@ -730,10 +732,11 @@ void MessageBoxPrivate::init(const QString &title, const QString &text)
|
|||
q->close();
|
||||
});
|
||||
|
||||
mTitleText = new QLabel(q);
|
||||
mTitleText->setText(title);
|
||||
|
||||
q->setModal(true);
|
||||
mIcon = QMessageBox::NoIcon;
|
||||
|
||||
Q_UNUSED(title);
|
||||
}
|
||||
|
||||
void MessageBoxPrivate::setupLayout()
|
||||
|
@ -782,10 +785,17 @@ void MessageBoxPrivate::setupLayout()
|
|||
contentLayout->addWidget(mDetail);
|
||||
}
|
||||
|
||||
QHBoxLayout *titleLayout = new QHBoxLayout;
|
||||
titleLayout->setContentsMargins(20,0,4,0);
|
||||
titleLayout->addWidget(mTitleText, Qt::AlignLeft);
|
||||
titleLayout->addWidget(mCloseButtton, Qt::AlignRight);
|
||||
|
||||
QVBoxLayout *layout = new QVBoxLayout;
|
||||
layout->setContentsMargins(4, 4, 4, 4);
|
||||
layout->setSpacing(4);
|
||||
layout->addWidget(mCloseButtton, 0, Qt::AlignRight);
|
||||
// layout->addWidget(mCloseButtton, 0, Qt::AlignRight);
|
||||
layout->addLayout(titleLayout);
|
||||
layout->addSpacing(5);
|
||||
layout->addLayout(contentLayout);
|
||||
|
||||
q->setLayout(layout);
|
||||
|
@ -1288,10 +1298,12 @@ void MessageBoxHelper::hide()
|
|||
|
||||
bool MessageBoxHelper::show(Qt::WindowFlags windowFlags, Qt::WindowModality windowModality, QWindow *parent)
|
||||
{
|
||||
initDialog();
|
||||
initDialog(windowFlags, windowModality, parent);
|
||||
|
||||
if (parent) {
|
||||
if (QWidget *p = mMessageBox->find(parent->winId())) {
|
||||
|
||||
//QMessageBox checkbox
|
||||
if (p->findChild<QCheckBox *>()) {
|
||||
for (QMessageBox *mb : p->findChildren<QMessageBox *>()) {
|
||||
if (mb->icon() == options()->icon() && mb->windowTitle() == options()->windowTitle() && mb->text() == options()->text()
|
||||
|
@ -1304,22 +1316,41 @@ bool MessageBoxHelper::show(Qt::WindowFlags windowFlags, Qt::WindowModality wind
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
//QMessageBox custom icon
|
||||
if (mMessageBox->icon() == QMessageBox::NoIcon) {
|
||||
for (QMessageBox *mb : p->findChildren<QMessageBox *>()) {
|
||||
if (mb->icon() == options()->icon() && mb->windowTitle() == options()->windowTitle() && mb->text() == options()->text()
|
||||
&& mb->informativeText() == options()->informativeText() && mb->detailedText() == options()->detailedText()) {
|
||||
if (!mb->iconPixmap().isNull()) {
|
||||
mMessageBox->setIconPixmap(mb->iconPixmap());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
mMessageBox->setuplayout();
|
||||
|
||||
if (parent) {
|
||||
if (parent && !mMessageBox->isVisible()) {
|
||||
mMessageBox->move(QPoint((parent->width() - mMessageBox->width()) / 2, (parent->height() - mMessageBox->height()) / 2)
|
||||
+ QPoint(parent->x(), parent->y()));
|
||||
}
|
||||
|
||||
//mMessageBox->setWindowModality(windowModality);
|
||||
|
||||
MotifWmHints hints;
|
||||
hints.flags = MWM_HINTS_FUNCTIONS | MWM_HINTS_DECORATIONS;
|
||||
hints.functions = MWM_FUNC_ALL;
|
||||
hints.decorations = MWM_DECOR_BORDER;
|
||||
XAtomHelper::getInstance()->setWindowMotifHint(mMessageBox->winId(), hints);
|
||||
//remove header
|
||||
QString platform = QGuiApplication::platformName();
|
||||
if(platform.startsWith(QLatin1String("wayland"),Qt::CaseInsensitive))
|
||||
{
|
||||
kdk::UkuiStyleHelper::self()->removeHeader(mMessageBox);
|
||||
} else {
|
||||
MotifWmHints hints;
|
||||
hints.flags = MWM_HINTS_FUNCTIONS | MWM_HINTS_DECORATIONS;
|
||||
hints.functions = MWM_FUNC_ALL;
|
||||
hints.decorations = MWM_DECOR_BORDER;
|
||||
XAtomHelper::getInstance()->setWindowMotifHint(mMessageBox->winId(), hints);
|
||||
}
|
||||
|
||||
foreach (QAbstractButton *ab, mMessageBox->buttons()) {
|
||||
if (QPushButton *pb = qobject_cast<QPushButton *>(ab)) {
|
||||
|
@ -1338,8 +1369,11 @@ bool MessageBoxHelper::show(Qt::WindowFlags windowFlags, Qt::WindowModality wind
|
|||
return true;
|
||||
}
|
||||
|
||||
void MessageBoxHelper::initDialog()
|
||||
void MessageBoxHelper::initDialog(Qt::WindowFlags windowFlags, Qt::WindowModality windowModality, QWindow *parent)
|
||||
{
|
||||
if(!mMessageBox->isVisible())
|
||||
mMessageBox->setWindowModality(windowModality);
|
||||
|
||||
mMessageBox->setIcon((QMessageBox::Icon)options()->icon());
|
||||
mMessageBox->setText(options()->text());
|
||||
mMessageBox->setInformativeText(options()->informativeText());
|
||||
|
|
|
@ -153,7 +153,7 @@ Q_SIGNALS:
|
|||
void clicked(QPlatformDialogHelper::StandardButton button, QPlatformDialogHelper::ButtonRole role);
|
||||
|
||||
private:
|
||||
void initDialog ();
|
||||
void initDialog (Qt::WindowFlags windowFlags, Qt::WindowModality windowModality, QWindow *parent);
|
||||
|
||||
private:
|
||||
MessageBox* mMessageBox = nullptr;
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
TEMPLATE = subdirs
|
||||
|
||||
SUBDIRS += \
|
||||
ukui-qqc2-style \
|
||||
ukui-qml-style-helper \
|
||||
qt5-ukui-platformtheme \
|
||||
ukui-styles \
|
||||
libqt5-ukui-style \
|
||||
|
|
|
@ -0,0 +1,105 @@
|
|||
#include "KyIcon.h"
|
||||
#include <QStyleOption>
|
||||
#include <QStyle>
|
||||
#include <QPainter>
|
||||
#include <QApplication>
|
||||
#include "highlight-effect.h"
|
||||
#include <QGSettings/QGSettings>
|
||||
|
||||
QStyle *KyIcon::style()
|
||||
{
|
||||
return qApp->style();
|
||||
}
|
||||
|
||||
KyIcon::KyIcon(QQuickPaintedItem *parent)
|
||||
: QQuickPaintedItem(parent),
|
||||
m_hover(false),
|
||||
m_selected(false),
|
||||
m_focus(false),
|
||||
m_active(true),
|
||||
m_sunken(false),
|
||||
m_on(false),
|
||||
m_icontype("default")
|
||||
{
|
||||
if (QGSettings::isSchemaInstalled("org.ukui.style")) {
|
||||
QGSettings* styleSettings = new QGSettings("org.ukui.style", QByteArray(), this);
|
||||
connect(styleSettings, &QGSettings::changed, this, [&](){
|
||||
emit hoverChanged();
|
||||
emit selectedChanged();
|
||||
emit hasFocusChanged();
|
||||
emit activeChanged();
|
||||
emit sunkenChanged();
|
||||
emit onChanged();
|
||||
emit icontypeChanged();
|
||||
update();
|
||||
});
|
||||
}
|
||||
connect(this, &KyIcon::hoverChanged, this, &KyIcon::updateItem);
|
||||
connect(this, &KyIcon::selectedChanged, this, &KyIcon::updateItem);
|
||||
connect(this, &KyIcon::hasFocusChanged, this, &KyIcon::updateItem);
|
||||
connect(this, &KyIcon::activeChanged, this, &KyIcon::updateItem);
|
||||
connect(this, &KyIcon::sunkenChanged, this, &KyIcon::updateItem);
|
||||
connect(this, &KyIcon::onChanged, this, &KyIcon::updateItem);
|
||||
connect(this, &KyIcon::icontypeChanged, this, &KyIcon::updateItem);
|
||||
|
||||
}
|
||||
|
||||
|
||||
void KyIcon::setIcon(const QIcon &icon)
|
||||
{
|
||||
m_icon = icon;
|
||||
}
|
||||
|
||||
void KyIcon::setIconName(const QString &iconName)
|
||||
{
|
||||
if(!QIcon::hasThemeIcon(iconName))
|
||||
{
|
||||
m_icon = QIcon();
|
||||
qWarning() << "未找到名为 " << iconName << " 的图标!";
|
||||
return;
|
||||
}
|
||||
m_icon = QIcon::fromTheme(iconName);
|
||||
}
|
||||
|
||||
void KyIcon::paint(QPainter *painter)
|
||||
{
|
||||
|
||||
if(m_icon.isNull())
|
||||
return;
|
||||
QWidget wid;
|
||||
QStyleOption opt;
|
||||
opt.state = {};
|
||||
if (isEnabled()) {
|
||||
opt.state |= QStyle::State_Enabled;
|
||||
}
|
||||
if (m_hover)
|
||||
opt.state |= QStyle::State_MouseOver;
|
||||
if (m_selected)
|
||||
opt.state |= QStyle::State_Selected;
|
||||
if (m_focus)
|
||||
opt.state |= QStyle::State_HasFocus;
|
||||
if (m_active)
|
||||
opt.state |= QStyle::State_Active;
|
||||
if (m_sunken)
|
||||
opt.state |= QStyle::State_Sunken;
|
||||
if (m_on)
|
||||
opt.state |= QStyle::State_On;
|
||||
|
||||
QPixmap pixmap = m_icon.pixmap(QSize(width(), height()));
|
||||
|
||||
if (m_icontype == "ordinary") {
|
||||
pixmap = HighLightEffect::ordinaryGeneratePixmap(pixmap, &opt, &wid); /* 主题切换做处理*/
|
||||
}
|
||||
if (m_icontype == "hover") {
|
||||
pixmap = HighLightEffect::hoverGeneratePixmap(pixmap, &opt, &wid); /* 选中点击做处理*/
|
||||
}
|
||||
if (m_icontype == "filledSymbolicColor") {
|
||||
pixmap = HighLightEffect::filledSymbolicColoredGeneratePixmap(pixmap, &opt, &wid); /* 非纯色图标主题切换且选中点击做处理*/
|
||||
}
|
||||
else if (m_icontype == "default") {
|
||||
pixmap = HighLightEffect::bothOrdinaryAndHoverGeneratePixmap(pixmap, &opt, &wid); /* 主题切换且选中点击做处理*/
|
||||
}
|
||||
|
||||
KyIcon::style()->drawItemPixmap(painter, boundingRect().toRect(), Qt::AlignCenter,pixmap);
|
||||
|
||||
}
|
|
@ -0,0 +1,90 @@
|
|||
#ifndef KYICON_H
|
||||
#define KYICON_H
|
||||
#include <QQuickPaintedItem>
|
||||
#include <QIcon>
|
||||
#include <QStyle>
|
||||
#include <QPointer>
|
||||
|
||||
class QStyle;
|
||||
class KyIcon : public QQuickPaintedItem
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QString iconName WRITE setIconName)
|
||||
Q_PROPERTY(QIcon icon READ icon WRITE setIcon)
|
||||
Q_PROPERTY( bool hover READ hover WRITE setHover NOTIFY hoverChanged)
|
||||
Q_PROPERTY( bool selected READ selected WRITE setSelected NOTIFY selectedChanged)
|
||||
Q_PROPERTY( bool hasFocus READ hasFocus WRITE sethasFocus NOTIFY hasFocusChanged)
|
||||
Q_PROPERTY( bool active READ active WRITE setActive NOTIFY activeChanged)
|
||||
Q_PROPERTY( bool sunken READ sunken WRITE setSunken NOTIFY sunkenChanged)
|
||||
Q_PROPERTY( bool on READ on WRITE setOn NOTIFY onChanged)
|
||||
Q_PROPERTY( QString icontype READ icontype WRITE seticontype NOTIFY icontypeChanged)
|
||||
|
||||
|
||||
public:
|
||||
KyIcon(QQuickPaintedItem *parent = nullptr);
|
||||
|
||||
QIcon icon() { return m_icon; }
|
||||
void setIcon(const QIcon &icon);
|
||||
|
||||
void setIconName(const QString &iconName);
|
||||
|
||||
bool hover() const { return m_hover; }
|
||||
void setHover(bool hover) { if (m_hover != hover) {m_hover = hover ; emit hoverChanged();}}
|
||||
|
||||
bool selected() const { return m_selected; }
|
||||
void setSelected(bool selected) {
|
||||
if (m_selected!= selected) {
|
||||
m_selected = selected;
|
||||
emit selectedChanged();
|
||||
}
|
||||
}
|
||||
|
||||
bool hasFocus() const { return m_focus; }
|
||||
void sethasFocus(bool focus) { if (m_focus != focus) {m_focus = focus; emit hasFocusChanged();}}
|
||||
|
||||
bool active() const { return m_active; }
|
||||
void setActive(bool active) { if (m_active!= active) {m_active = active; emit activeChanged();}}
|
||||
|
||||
bool sunken() const { return m_sunken; }
|
||||
void setSunken(bool sunken) { if (m_sunken != sunken) {m_sunken = sunken; emit sunkenChanged();}}
|
||||
|
||||
bool on() const { return m_on; }
|
||||
void setOn(bool on) { if (m_on != on) {m_on = on ; emit onChanged();}}
|
||||
|
||||
QString icontype() const { return m_icontype;}
|
||||
void seticontype(QString icontype) {
|
||||
m_icontype = icontype ;
|
||||
emit icontypeChanged();
|
||||
}
|
||||
|
||||
void paint(QPainter *painter);
|
||||
|
||||
static QStyle *style();
|
||||
|
||||
public Q_SLOTS:
|
||||
void updateItem(){update();}
|
||||
|
||||
Q_SIGNALS:
|
||||
void hoverChanged();
|
||||
void selectedChanged();
|
||||
void hasFocusChanged();
|
||||
void activeChanged();
|
||||
void sunkenChanged();
|
||||
void onChanged();
|
||||
void icontypeChanged();
|
||||
|
||||
protected:
|
||||
bool m_hover;
|
||||
bool m_selected;
|
||||
bool m_focus;
|
||||
bool m_active;
|
||||
bool m_sunken;
|
||||
bool m_on;
|
||||
QString m_icontype;
|
||||
|
||||
private:
|
||||
QIcon m_icon;
|
||||
|
||||
};
|
||||
|
||||
#endif // KYICON_H
|
|
@ -0,0 +1,47 @@
|
|||
#ifndef KYQUICKPADDING_P_H
|
||||
#define KYQUICKPADDING_P_H
|
||||
|
||||
#include <qobject.h>
|
||||
|
||||
class KyQuickPadding : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
Q_PROPERTY(int left READ left WRITE setLeft NOTIFY leftChanged)
|
||||
Q_PROPERTY(int top READ top WRITE setTop NOTIFY topChanged)
|
||||
Q_PROPERTY(int right READ right WRITE setRight NOTIFY rightChanged)
|
||||
Q_PROPERTY(int bottom READ bottom WRITE setBottom NOTIFY bottomChanged)
|
||||
|
||||
int m_left;
|
||||
int m_top;
|
||||
int m_right;
|
||||
int m_bottom;
|
||||
|
||||
public:
|
||||
KyQuickPadding(QObject *parent = nullptr) :
|
||||
QObject(parent),
|
||||
m_left(0),
|
||||
m_top(0),
|
||||
m_right(0),
|
||||
m_bottom(0) {}
|
||||
|
||||
int left() const { return m_left; }
|
||||
int top() const { return m_top; }
|
||||
int right() const { return m_right; }
|
||||
int bottom() const { return m_bottom; }
|
||||
|
||||
public Q_SLOTS:
|
||||
void setLeft(int arg) { if (m_left != arg) {m_left = arg; emit leftChanged();}}
|
||||
void setTop(int arg) { if (m_top != arg) {m_top = arg; emit topChanged();}}
|
||||
void setRight(int arg) { if (m_right != arg) {m_right = arg; emit rightChanged();}}
|
||||
void setBottom(int arg) {if (m_bottom != arg) {m_bottom = arg; emit bottomChanged();}}
|
||||
|
||||
Q_SIGNALS:
|
||||
void leftChanged();
|
||||
void topChanged();
|
||||
void rightChanged();
|
||||
void bottomChanged();
|
||||
};
|
||||
|
||||
|
||||
#endif // KYQUICKPADDING_P_H
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,310 @@
|
|||
#ifndef KYQUICKSTYLEITEM_H
|
||||
#define KYQUICKSTYLEITEM_H
|
||||
|
||||
#include "kyquickpadding_p.h"
|
||||
#include <PlatformTheme>
|
||||
|
||||
#include <QQuickItem>
|
||||
#include <QQuickImageProvider>
|
||||
|
||||
#include <QPixmap>
|
||||
#include <QPointer>
|
||||
#include <QImage>
|
||||
|
||||
|
||||
class QStyle;
|
||||
class QStyleOption;
|
||||
|
||||
class QQuickTableRowImageProvider1 : public QQuickImageProvider
|
||||
{
|
||||
public:
|
||||
QQuickTableRowImageProvider1()
|
||||
: QQuickImageProvider(QQuickImageProvider::Pixmap) {}
|
||||
QPixmap requestPixmap(const QString &id, QSize *size, const QSize &requestedSize) override;
|
||||
};
|
||||
|
||||
class KyQuickStyleItem: public QQuickItem
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
Q_PROPERTY(KyQuickPadding* border READ border CONSTANT)
|
||||
|
||||
Q_PROPERTY( bool sunken READ sunken WRITE setSunken NOTIFY sunkenChanged)
|
||||
Q_PROPERTY( bool raised READ raised WRITE setRaised NOTIFY raisedChanged)
|
||||
Q_PROPERTY( bool active READ active WRITE setActive NOTIFY activeChanged)
|
||||
Q_PROPERTY( bool selected READ selected WRITE setSelected NOTIFY selectedChanged)
|
||||
Q_PROPERTY( bool hasFocus READ hasFocus WRITE sethasFocus NOTIFY hasFocusChanged)
|
||||
Q_PROPERTY( bool on READ on WRITE setOn NOTIFY onChanged)
|
||||
Q_PROPERTY( bool hover READ hover WRITE setHover NOTIFY hoverChanged)
|
||||
Q_PROPERTY( bool horizontal READ horizontal WRITE setHorizontal NOTIFY horizontalChanged)
|
||||
Q_PROPERTY( bool isTransient READ isTransient WRITE setTransient NOTIFY transientChanged)
|
||||
|
||||
Q_PROPERTY( QString elementType READ elementType WRITE setElementType NOTIFY elementTypeChanged)
|
||||
Q_PROPERTY( QString text READ text WRITE setText NOTIFY textChanged)
|
||||
Q_PROPERTY( QString activeControl READ activeControl WRITE setActiveControl NOTIFY activeControlChanged)
|
||||
Q_PROPERTY( QString styleName READ styleName NOTIFY styleNameChanged)
|
||||
Q_PROPERTY( QVariantMap hints READ hints WRITE setHints NOTIFY hintChanged RESET resetHints)
|
||||
Q_PROPERTY( QVariantMap properties READ properties WRITE setProperties NOTIFY propertiesChanged)
|
||||
Q_PROPERTY( QFont font READ font NOTIFY fontChanged)
|
||||
|
||||
// For range controls
|
||||
Q_PROPERTY( int minimum READ minimum WRITE setMinimum NOTIFY minimumChanged)
|
||||
Q_PROPERTY( int maximum READ maximum WRITE setMaximum NOTIFY maximumChanged)
|
||||
Q_PROPERTY( int value READ value WRITE setValue NOTIFY valueChanged)
|
||||
Q_PROPERTY( int step READ step WRITE setStep NOTIFY stepChanged)
|
||||
Q_PROPERTY( int paintMargins READ paintMargins WRITE setPaintMargins NOTIFY paintMarginsChanged)
|
||||
|
||||
Q_PROPERTY( int contentWidth READ contentWidth WRITE setContentWidth NOTIFY contentWidthChanged)
|
||||
Q_PROPERTY( int contentHeight READ contentHeight WRITE setContentHeight NOTIFY contentHeightChanged)
|
||||
|
||||
Q_PROPERTY( int textureWidth READ textureWidth WRITE setTextureWidth NOTIFY textureWidthChanged)
|
||||
Q_PROPERTY( int textureHeight READ textureHeight WRITE setTextureHeight NOTIFY textureHeightChanged)
|
||||
|
||||
Q_PROPERTY( int leftPadding READ leftPadding NOTIFY leftPaddingChanged)
|
||||
Q_PROPERTY( int topPadding READ topPadding NOTIFY topPaddingChanged)
|
||||
Q_PROPERTY( int rightPadding READ rightPadding NOTIFY rightPaddingChanged)
|
||||
Q_PROPERTY( int bottomPadding READ bottomPadding NOTIFY bottomPaddingChanged)
|
||||
|
||||
Q_PROPERTY( QString buttonType READ buttonType WRITE setbuttonType NOTIFY buttonTypeChanged)
|
||||
|
||||
Q_PROPERTY( QQuickItem *control READ control WRITE setControl NOTIFY controlChanged)
|
||||
|
||||
KyQuickPadding* border() { return &m_border; }
|
||||
|
||||
public:
|
||||
KyQuickStyleItem(QQuickItem *parent = nullptr);
|
||||
~KyQuickStyleItem() override;
|
||||
|
||||
enum MenuItemType {
|
||||
SeparatorType = 0,
|
||||
ItemType,
|
||||
MenuType,
|
||||
ScrollIndicatorType
|
||||
};
|
||||
|
||||
enum Type {
|
||||
Undefined,
|
||||
Button,
|
||||
RadioButton,
|
||||
CheckBox,
|
||||
ComboBox,
|
||||
ComboBoxItem,
|
||||
Dial,
|
||||
ToolBar,
|
||||
ToolButton,
|
||||
Tab,
|
||||
TabFrame,
|
||||
Frame,
|
||||
FocusFrame,
|
||||
FocusRect,
|
||||
SpinBox,
|
||||
Slider,
|
||||
ScrollBar,
|
||||
ProgressBar,
|
||||
Edit,
|
||||
GroupBox,
|
||||
Header,
|
||||
Item,
|
||||
ItemRow,
|
||||
ItemBranchIndicator,
|
||||
Splitter,
|
||||
Menu,
|
||||
MenuItem,
|
||||
Widget,
|
||||
StatusBar,
|
||||
ScrollAreaCorner,
|
||||
MacHelpButton,
|
||||
MenuBar,
|
||||
MenuBarItem
|
||||
};
|
||||
|
||||
void paint(QPainter *);
|
||||
|
||||
bool sunken() const { return m_sunken; }
|
||||
bool raised() const { return m_raised; }
|
||||
bool active() const { return m_active; }
|
||||
bool selected() const { return m_selected; }
|
||||
bool hasFocus() const { return m_focus; }
|
||||
bool on() const { return m_on; }
|
||||
bool hover() const { return m_hover; }
|
||||
bool horizontal() const { return m_horizontal; }
|
||||
bool isTransient() const { return m_transient; }
|
||||
|
||||
int minimum() const { return m_minimum; }
|
||||
int maximum() const { return m_maximum; }
|
||||
int step() const { return m_step; }
|
||||
int value() const { return m_value; }
|
||||
int paintMargins() const { return m_paintMargins; }
|
||||
|
||||
QString elementType() const { return m_type; }
|
||||
QString text() const { return m_text; }
|
||||
QString activeControl() const { return m_activeControl; }
|
||||
QVariantMap hints() const { return m_hints; }
|
||||
QVariantMap properties() const { return m_properties; }
|
||||
QFont font() const { return m_font;}
|
||||
QString styleName() const;
|
||||
|
||||
void setSunken(bool sunken) { if (m_sunken != sunken) {m_sunken = sunken; emit sunkenChanged();}}
|
||||
void setRaised(bool raised) { if (m_raised!= raised) {m_raised = raised; emit raisedChanged();}}
|
||||
void setActive(bool active) { if (m_active!= active) {m_active = active; emit activeChanged();}}
|
||||
void setSelected(bool selected) { if (m_selected!= selected) {m_selected = selected; emit selectedChanged();}}
|
||||
void sethasFocus(bool focus) { if (m_focus != focus) {m_focus = focus; emit hasFocusChanged();}}
|
||||
void setOn(bool on) { if (m_on != on) {m_on = on ; emit onChanged();}}
|
||||
void setHover(bool hover) { if (m_hover != hover) {m_hover = hover ; emit hoverChanged();}}
|
||||
void setHorizontal(bool horizontal) { if (m_horizontal != horizontal) {m_horizontal = horizontal; emit horizontalChanged();}}
|
||||
void setTransient(bool transient) { if (m_transient != transient) {m_transient = transient; emit transientChanged();}}
|
||||
void setMinimum(int minimum) { if (m_minimum!= minimum) {m_minimum = minimum; emit minimumChanged();}}
|
||||
void setMaximum(int maximum) { if (m_maximum != maximum) {m_maximum = maximum; emit maximumChanged();}}
|
||||
void setValue(int value) { if (m_value!= value) {m_value = value; emit valueChanged();}}
|
||||
void setStep(int step) { if (m_step != step) { m_step = step; emit stepChanged(); }}
|
||||
void setPaintMargins(int value) { if (m_paintMargins!= value) {m_paintMargins = value; emit paintMarginsChanged(); } }
|
||||
void setElementType(const QString &str);
|
||||
void setText(const QString &str) { if (m_text != str) {m_text = str; emit textChanged();}}
|
||||
void setActiveControl(const QString &str) { if (m_activeControl != str) {m_activeControl = str; emit activeControlChanged();}}
|
||||
void setHints(const QVariantMap &str);
|
||||
void setProperties(const QVariantMap &props) { if (m_properties != props) { m_properties = props; emit propertiesChanged(); } }
|
||||
void resetHints();
|
||||
|
||||
int contentWidth() const { return m_contentWidth; }
|
||||
void setContentWidth(int arg);
|
||||
|
||||
int contentHeight() const { return m_contentHeight; }
|
||||
void setContentHeight(int arg);
|
||||
|
||||
virtual void initStyleOption ();
|
||||
void resolvePalette();
|
||||
|
||||
int leftPadding() const;
|
||||
int topPadding() const;
|
||||
int rightPadding() const;
|
||||
int bottomPadding() const;
|
||||
|
||||
Q_INVOKABLE qreal textWidth(const QString &);
|
||||
Q_INVOKABLE qreal textHeight(const QString &);
|
||||
|
||||
int textureWidth() const { return m_textureWidth; }
|
||||
void setTextureWidth(int w);
|
||||
|
||||
int textureHeight() const { return m_textureHeight; }
|
||||
void setTextureHeight(int h);
|
||||
|
||||
QQuickItem *control() const;
|
||||
void setControl(QQuickItem *control);
|
||||
|
||||
static QStyle *style();
|
||||
|
||||
QString buttonType() const { return m_buttonType;}
|
||||
void setbuttonType(QString buttonType) {
|
||||
m_buttonType = buttonType ;
|
||||
emit buttonTypeChanged();
|
||||
}
|
||||
|
||||
public Q_SLOTS:
|
||||
int pixelMetric(const QString&);
|
||||
QVariant styleHint(const QString&);
|
||||
void updateSizeHint();
|
||||
void updateRect();
|
||||
void updateBaselineOffset();
|
||||
void updateItem(){polish();}
|
||||
QString hitTest(int x, int y);
|
||||
QRectF subControlRect(const QString &subcontrolString);
|
||||
QString elidedText(const QString &text, int elideMode, int width);
|
||||
bool hasThemeIcon(const QString &) const;
|
||||
|
||||
Q_SIGNALS:
|
||||
void elementTypeChanged();
|
||||
void textChanged();
|
||||
void sunkenChanged();
|
||||
void raisedChanged();
|
||||
void activeChanged();
|
||||
void selectedChanged();
|
||||
void hasFocusChanged();
|
||||
void onChanged();
|
||||
void hoverChanged();
|
||||
void horizontalChanged();
|
||||
void transientChanged();
|
||||
void minimumChanged();
|
||||
void maximumChanged();
|
||||
void stepChanged();
|
||||
void valueChanged();
|
||||
void activeControlChanged();
|
||||
void infoChanged();
|
||||
void styleNameChanged();
|
||||
void paintMarginsChanged();
|
||||
void hintChanged();
|
||||
void propertiesChanged();
|
||||
void fontChanged();
|
||||
void controlChanged();
|
||||
|
||||
void contentWidthChanged(int arg);
|
||||
void contentHeightChanged(int arg);
|
||||
|
||||
void textureWidthChanged(int w);
|
||||
void textureHeightChanged(int h);
|
||||
|
||||
void leftPaddingChanged();
|
||||
void topPaddingChanged();
|
||||
void rightPaddingChanged();
|
||||
void bottomPaddingChanged();
|
||||
|
||||
void buttonTypeChanged();
|
||||
|
||||
protected:
|
||||
bool event(QEvent *) override;
|
||||
QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *) override;
|
||||
void updatePolish() override;
|
||||
bool eventFilter(QObject *watched, QEvent *event) override;
|
||||
|
||||
private:
|
||||
const char* classNameForItem() const;
|
||||
QSize sizeFromContents(int width, int height);
|
||||
qreal baselineOffset();
|
||||
void styleChanged();
|
||||
|
||||
protected:
|
||||
QStyleOption *m_styleoption;
|
||||
QPointer<QQuickItem> m_control;
|
||||
QPointer<QWindow> m_window;
|
||||
Type m_itemType;
|
||||
|
||||
QString m_type;
|
||||
QString m_text;
|
||||
QString m_activeControl;
|
||||
QVariantMap m_hints;
|
||||
QVariantMap m_properties;
|
||||
QFont m_font;
|
||||
|
||||
bool m_sunken;
|
||||
bool m_raised;
|
||||
bool m_active;
|
||||
bool m_selected;
|
||||
bool m_focus;
|
||||
bool m_hover;
|
||||
bool m_on;
|
||||
bool m_horizontal;
|
||||
bool m_transient;
|
||||
bool m_sharedWidget;
|
||||
|
||||
int m_minimum;
|
||||
int m_maximum;
|
||||
int m_value;
|
||||
int m_step;
|
||||
int m_paintMargins;
|
||||
|
||||
int m_contentWidth;
|
||||
int m_contentHeight;
|
||||
|
||||
int m_textureWidth;
|
||||
int m_textureHeight;
|
||||
|
||||
Qt::FocusReason m_lastFocusReason;
|
||||
|
||||
QImage m_image;
|
||||
KyQuickPadding m_border;
|
||||
|
||||
static QStyle *s_style;
|
||||
|
||||
QString m_buttonType;
|
||||
};
|
||||
|
||||
#endif // KYQUICKSTYLEITEM_H
|
|
@ -0,0 +1,31 @@
|
|||
#include "kystylehelper.h"
|
||||
|
||||
#include <QQuickWindow>
|
||||
#include <QGSettings/QGSettings>
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
KyStyleHelper::KyStyleHelper(QQuickItem *parent)
|
||||
: QQuickItem(parent)
|
||||
{
|
||||
if (QGSettings::isSchemaInstalled("org.ukui.style")) {
|
||||
QGSettings* styleSettings = new QGSettings("org.ukui.style", QByteArray(), this);
|
||||
connect(styleSettings, &QGSettings::changed, this, [&](const QString &key){
|
||||
if (key == "styleName") {
|
||||
emit paletteChanged();
|
||||
emit qcolorChanged();
|
||||
}
|
||||
if (key == "systemFontSize" || key == "systemFont") {
|
||||
emit fontChanged();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
KyStyleHelper::~KyStyleHelper() {}
|
||||
|
||||
KyStyleHelper* KyStyleHelper::qmlAttachedProperties(QObject *parent)
|
||||
{
|
||||
auto p = qobject_cast<QQuickItem*>(parent);
|
||||
return new KyStyleHelper(p);
|
||||
}
|
|
@ -0,0 +1,128 @@
|
|||
#ifndef KYSTYLEHELPER_H
|
||||
#define KYSTYLEHELPER_H
|
||||
|
||||
#include <QApplication>
|
||||
#include <QQuickItem>
|
||||
#include <QPalette>
|
||||
#include <QColor>
|
||||
|
||||
class KyStyleHelper : public QQuickItem
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_DISABLE_COPY(KyStyleHelper)
|
||||
|
||||
Q_PROPERTY(QPalette palette READ palette NOTIFY paletteChanged)
|
||||
Q_PROPERTY(QFont font READ font NOTIFY fontChanged)
|
||||
|
||||
Q_PROPERTY(QColor buttoncolorrole READ buttoncolor NOTIFY qcolorChanged)
|
||||
Q_PROPERTY(QColor windowcolorrole READ windowcolor NOTIFY qcolorChanged)
|
||||
Q_PROPERTY(QColor darkcolorrole READ darkcolor NOTIFY qcolorChanged)
|
||||
Q_PROPERTY(QColor windowtextcolorrole READ windowtextcolor NOTIFY qcolorChanged)
|
||||
Q_PROPERTY(QColor basecolorrole READ basecolor NOTIFY qcolorChanged)
|
||||
Q_PROPERTY(QColor textcolorrole READ textcolor NOTIFY qcolorChanged)
|
||||
Q_PROPERTY(QColor buttontextcolorrole READ buttontextcolor NOTIFY qcolorChanged)
|
||||
Q_PROPERTY(QColor highlightcolorrole READ highlightcolor NOTIFY qcolorChanged)
|
||||
Q_PROPERTY(QColor highlightedtextcolorrole READ highlightedtextcolor NOTIFY qcolorChanged)
|
||||
Q_PROPERTY(QColor tooltipbasecolorrole READ tooltipbasecolor NOTIFY qcolorChanged)
|
||||
Q_PROPERTY(QColor tooltiptextcolorrole READ tooltiptextcolor NOTIFY qcolorChanged)
|
||||
Q_PROPERTY(QColor lightcolorrole READ lightcolor NOTIFY qcolorChanged)
|
||||
Q_PROPERTY(QColor midlightcolorrole READ midlightcolor NOTIFY qcolorChanged)
|
||||
Q_PROPERTY(QColor midcolorrole READ midcolor NOTIFY qcolorChanged)
|
||||
Q_PROPERTY(QColor shadowcolorrole READ shadowcolor NOTIFY qcolorChanged)
|
||||
Q_PROPERTY(QColor alternatebasecolorrole READ alternatebasecolor NOTIFY qcolorChanged)
|
||||
Q_PROPERTY(QColor linkcolorrole READ linkcolor NOTIFY qcolorChanged)
|
||||
Q_PROPERTY(QColor linkvisitedcolorrole READ linkvisitedcolor NOTIFY qcolorChanged)
|
||||
|
||||
Q_PROPERTY( QString buttonType READ buttonType WRITE setbuttonType NOTIFY buttonTypeChanged)
|
||||
|
||||
public:
|
||||
explicit KyStyleHelper(QQuickItem *parent = nullptr);
|
||||
~KyStyleHelper() override;
|
||||
|
||||
static KyStyleHelper* qmlAttachedProperties(QObject* parent);
|
||||
|
||||
QString buttonType() const { return m_buttonType;}
|
||||
void setbuttonType(QString buttonType) {
|
||||
m_buttonType = buttonType ;
|
||||
emit buttonTypeChanged();
|
||||
}
|
||||
|
||||
/* Get palette */
|
||||
QPalette palette() {
|
||||
return qApp->palette();
|
||||
}
|
||||
|
||||
/* Get font */
|
||||
QFont font() {
|
||||
return qApp->font();
|
||||
}
|
||||
|
||||
/* Get different type of color */
|
||||
QColor buttoncolor() {
|
||||
return qApp->palette().button().color();
|
||||
}
|
||||
QColor windowcolor() {
|
||||
return qApp->palette().window().color();
|
||||
}
|
||||
QColor darkcolor() {
|
||||
return qApp->palette().dark().color();
|
||||
}
|
||||
QColor windowtextcolor() {
|
||||
return qApp->palette().windowText().color();
|
||||
}
|
||||
QColor basecolor() {
|
||||
return qApp->palette().base().color();
|
||||
}
|
||||
QColor textcolor() {
|
||||
return qApp->palette().text().color();
|
||||
}
|
||||
QColor buttontextcolor() {
|
||||
return qApp->palette().buttonText().color();
|
||||
}
|
||||
QColor highlightcolor() {
|
||||
return qApp->palette().highlight().color();
|
||||
}
|
||||
QColor highlightedtextcolor() {
|
||||
return qApp->palette().highlightedText().color();
|
||||
}
|
||||
QColor tooltipbasecolor() {
|
||||
return qApp->palette().toolTipBase().color();
|
||||
}
|
||||
QColor tooltiptextcolor() {
|
||||
return qApp->palette().toolTipText().color();
|
||||
}
|
||||
QColor lightcolor() {
|
||||
return qApp->palette().light().color();
|
||||
}
|
||||
QColor midlightcolor() {
|
||||
return qApp->palette().midlight().color();
|
||||
}
|
||||
QColor midcolor() {
|
||||
return qApp->palette().mid().color();
|
||||
}
|
||||
QColor shadowcolor() {
|
||||
return qApp->palette().shadow().color();
|
||||
}
|
||||
QColor alternatebasecolor() {
|
||||
return qApp->palette().alternateBase().color();
|
||||
}
|
||||
QColor linkcolor() {
|
||||
return qApp->palette().link().color();
|
||||
}
|
||||
QColor linkvisitedcolor() {
|
||||
return qApp->palette().linkVisited().color();
|
||||
}
|
||||
|
||||
|
||||
signals:
|
||||
void paletteChanged();
|
||||
void fontChanged();
|
||||
void qcolorChanged();
|
||||
void buttonTypeChanged();
|
||||
|
||||
protected:
|
||||
QString m_buttonType;
|
||||
};
|
||||
|
||||
QML_DECLARE_TYPEINFO(KyStyleHelper, QML_HAS_ATTACHED_PROPERTIES)
|
||||
#endif // KYSTYLEHELPER_H
|
|
@ -0,0 +1,2 @@
|
|||
module org.ukui.qqc2style.private
|
||||
plugin ukui-qml-style-helper
|
|
@ -0,0 +1,13 @@
|
|||
#include "qqc2styleplugin.h"
|
||||
#include "kyquickstyleitem.h"
|
||||
#include "kystylehelper.h"
|
||||
#include "KyIcon.h"
|
||||
|
||||
void Qqc2StylePlugin::registerTypes(const char *uri)
|
||||
{
|
||||
Q_ASSERT(QLatin1String(uri) == QLatin1String("org.ukui.qqc2style.private"));
|
||||
// @uri org.ukui.qqc2style.private
|
||||
qmlRegisterType<KyQuickStyleItem>(uri, 1, 0, "StyleItem");
|
||||
qmlRegisterType<KyStyleHelper>(uri, 1, 0, "StyleHelper");
|
||||
qmlRegisterType<KyIcon>(uri, 1, 0, "KyIcon");
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
#ifndef QQC2STYLEPLUGIN_H
|
||||
#define QQC2STYLEPLUGIN_H
|
||||
|
||||
#include <QQmlExtensionPlugin>
|
||||
|
||||
class Qqc2StylePlugin : public QQmlExtensionPlugin
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid)
|
||||
|
||||
public:
|
||||
void registerTypes(const char *uri) override;
|
||||
};
|
||||
|
||||
#endif // QQC2STYLEPLUGIN_H
|
|
@ -0,0 +1,47 @@
|
|||
TEMPLATE = lib
|
||||
TARGET = ukui-qml-style-helper
|
||||
QT += KConfigCore Kirigami2 quick widgets
|
||||
|
||||
CONFIG += plugin c++11 link_pkgconfig
|
||||
|
||||
TARGET = $$qtLibraryTarget($$TARGET)
|
||||
uri = org.ukui.qqc2style.private
|
||||
|
||||
PKGCONFIG += gsettings-qt
|
||||
INCLUDEPATH += /usr/include/KF5/Kirigami2
|
||||
LIBS += -L/usr/lib -L$$[QT_INSTALL_LIBS] -lKF5Kirigami2
|
||||
|
||||
include(../libqt5-ukui-style/effects/effects.pri)
|
||||
|
||||
# Input
|
||||
SOURCES += \
|
||||
KyIcon.cpp \
|
||||
kyquickstyleitem.cpp \
|
||||
kystylehelper.cpp \
|
||||
qqc2styleplugin.cpp
|
||||
|
||||
HEADERS += \
|
||||
KyIcon.h \
|
||||
kyquickpadding_p.h \
|
||||
kyquickstyleitem.h \
|
||||
kystylehelper.h \
|
||||
qqc2styleplugin.h
|
||||
|
||||
DISTFILES = qmldir
|
||||
|
||||
!equals(_PRO_FILE_PWD_, $$OUT_PWD) {
|
||||
copy_qmldir.target = $$OUT_PWD/qmldir
|
||||
copy_qmldir.depends = $$_PRO_FILE_PWD_/qmldir
|
||||
copy_qmldir.commands = $(COPY_FILE) "$$replace(copy_qmldir.depends, /, $$QMAKE_DIR_SEP)" "$$replace(copy_qmldir.target, /, $$QMAKE_DIR_SEP)"
|
||||
QMAKE_EXTRA_TARGETS += copy_qmldir
|
||||
PRE_TARGETDEPS += $$copy_qmldir.target
|
||||
}
|
||||
|
||||
qmldir.files = qmldir
|
||||
unix {
|
||||
# installPath = $$[QT_INSTALL_QML]/$$replace(uri, \., /)
|
||||
installPath = $$[QT_INSTALL_LIBS]/qt5/qml/org/ukui/qqc2style/private/
|
||||
qmldir.path = $$installPath
|
||||
target.path = $$installPath
|
||||
INSTALLS += target qmldir
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
# kylin-qqc2-style
|
||||
|
||||
kylin qquick control 2
|
||||
|
||||
|
||||
## Description
|
||||
|
||||
kylin-qqc2-style 是参考 qqc2-desktop-style 实现的一个 qml 主题,主要包括以下几部分:
|
||||
> 1. org.kylin.style: 提供 qml style org.kylin.style,可以通过 QQuickStyle::setStyle 或其他方式设置 qml 应用使用次样式
|
||||
> 2. qqc2-style-plugin: 提供一个自定义的 QQuickItem 供 org.kylin.style 使用
|
||||
|
||||
## Depends
|
||||
|
||||
qtbase
|
||||
qquick
|
||||
kirigami2-dev
|
||||
KIconLoader
|
||||
KColorScheme
|
||||
KSharedConfig
|
||||
KConfigGroup
|
||||
|
||||
## build & install
|
||||
|
||||
mkdir build
|
||||
cd build
|
||||
qmake ..
|
||||
make
|
||||
sudo make install
|
|
@ -0,0 +1,22 @@
|
|||
|
||||
import QtQuick 2.12
|
||||
import QtQuick.Window 2.12
|
||||
import QtQuick.Controls 2.12
|
||||
import QtQuick.Controls.impl 2.12
|
||||
import QtQuick.Templates 2.12 as T
|
||||
import org.ukui.qqc2style.private 1.0 as StylePrivate
|
||||
|
||||
T.ApplicationWindow {
|
||||
id: window
|
||||
|
||||
color: palette.window
|
||||
palette: StylePrivate.StyleHelper.palette
|
||||
overlay.modal: Rectangle {
|
||||
color: Color.transparent(window.palette.shadow, 0.5)
|
||||
}
|
||||
|
||||
overlay.modeless: Rectangle {
|
||||
color: Color.transparent(window.palette.shadow, 0.12)
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
|
||||
import QtQuick 2.6
|
||||
import QtQuick.Templates 2.5 as T
|
||||
import org.ukui.qqc2style.private 1.0 as StylePrivate
|
||||
|
||||
|
||||
T.Button {
|
||||
id: controlRoot
|
||||
palette: StylePrivate.StyleHelper.palette
|
||||
|
||||
/* The value type of buttonType are "CloseButton","MaxButton","MinButton","blueButton","Default". */
|
||||
StylePrivate.StyleHelper.buttonType: "Default"
|
||||
|
||||
|
||||
implicitWidth: background.implicitWidth
|
||||
implicitHeight: background.implicitHeight
|
||||
|
||||
hoverEnabled: true //Qt.styleHints.useHoverEffects TODO: how to make this work in 5.7?
|
||||
|
||||
contentItem: Item {}
|
||||
|
||||
background: StylePrivate.StyleItem {
|
||||
id: styleitem
|
||||
anchors.fill: parent
|
||||
buttonType: controlRoot.StylePrivate.StyleHelper.buttonType
|
||||
control: controlRoot
|
||||
elementType: "button"
|
||||
sunken: controlRoot.pressed || (controlRoot.checkable && controlRoot.checked)
|
||||
raised: !(controlRoot.pressed || (controlRoot.checkable && controlRoot.checked))
|
||||
hover: controlRoot.hovered
|
||||
text: controlRoot.text
|
||||
hasFocus: controlRoot.activeFocus
|
||||
activeControl: controlRoot.isDefault ? "default" : "f"
|
||||
properties: {
|
||||
"icon": controlRoot.icon && controlRoot.display !== T.AbstractButton.TextOnly ? (controlRoot.icon.name || controlRoot.icon.source) : "",
|
||||
"iconWidth": controlRoot.icon && controlRoot.icon.width ? controlRoot.icon.width : 0,
|
||||
"iconHeight": controlRoot.icon && controlRoot.icon.height ? controlRoot.icon.height : 0,
|
||||
"flat": controlRoot.flat
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
|
||||
import QtQuick 2.12
|
||||
import QtQuick.Controls 2.12
|
||||
import QtQuick.Controls.impl 2.12
|
||||
import QtQuick.Templates 2.12 as T
|
||||
|
||||
import org.ukui.qqc2style.private 1.0 as StylePrivate
|
||||
|
||||
T.Label {
|
||||
id:control
|
||||
|
||||
color:StylePrivate.StyleHelper.windowtextcolorrole
|
||||
linkColor: control.palette.link
|
||||
|
||||
font: StylePrivate.StyleHelper.font
|
||||
|
||||
}
|
|
@ -0,0 +1,97 @@
|
|||
|
||||
import QtQuick 2.7
|
||||
import QtQuick.Layouts 1.2
|
||||
import QtGraphicalEffects 1.0
|
||||
import QtQuick.Controls 2.5
|
||||
import QtQuick.Templates 2.5 as T
|
||||
import org.ukui.qqc2style.private 1.0 as StylePrivate
|
||||
|
||||
T.Menu {
|
||||
id: control
|
||||
|
||||
palette: StylePrivate.StyleHelper.palette
|
||||
font: StylePrivate.StyleHelper.font
|
||||
|
||||
implicitWidth: Math.max(background ? background.implicitWidth : 0,
|
||||
contentItem ? contentItem.implicitWidth + leftPadding + rightPadding : 0)
|
||||
implicitHeight: Math.max(background ? background.implicitHeight : 0,
|
||||
contentItem ? contentItem.implicitHeight : 0) + topPadding + bottomPadding
|
||||
|
||||
margins: 0
|
||||
|
||||
delegate: MenuItem { onImplicitWidthChanged: control.contentItem.contentItem.childrenChanged() }
|
||||
|
||||
contentItem: ListView {
|
||||
implicitHeight: contentHeight
|
||||
property bool hasCheckables: false
|
||||
property bool hasIcons: false
|
||||
model: control.contentModel
|
||||
|
||||
implicitWidth: {
|
||||
var maxWidth = 0;
|
||||
for (var i = 0; i < contentItem.children.length; ++i) {
|
||||
maxWidth = Math.max(maxWidth, contentItem.children[i].implicitWidth);
|
||||
}
|
||||
return maxWidth;
|
||||
}
|
||||
interactive: ApplicationWindow.window ? contentHeight > ApplicationWindow.window.height : false
|
||||
clip: true
|
||||
currentIndex: control.currentIndex || 0
|
||||
keyNavigationEnabled: true
|
||||
keyNavigationWraps: true
|
||||
|
||||
ScrollBar.vertical: ScrollBar {}
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: control.contentItem.contentItem
|
||||
onChildrenChanged: {
|
||||
for (var i in control.contentItem.contentItem.children) {
|
||||
var child = control.contentItem.contentItem.children[i];
|
||||
if (child.checkable) {
|
||||
control.contentItem.hasCheckables = true;
|
||||
}
|
||||
if (child.icon && child.icon.hasOwnProperty("name") && (child.icon.name.length > 0 || child.icon.source.length > 0)) {
|
||||
control.contentItem.hasIcons = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
enter: Transition {
|
||||
NumberAnimation {
|
||||
property: "opacity"
|
||||
from: 0
|
||||
to: 1
|
||||
easing.type: Easing.InOutQuad
|
||||
duration: 150
|
||||
}
|
||||
}
|
||||
|
||||
exit: Transition {
|
||||
NumberAnimation {
|
||||
property: "opacity"
|
||||
from: 1
|
||||
to: 0
|
||||
easing.type: Easing.InOutQuad
|
||||
duration: 150
|
||||
}
|
||||
}
|
||||
|
||||
background: Rectangle {
|
||||
radius: 2
|
||||
|
||||
color: control.palette.window
|
||||
|
||||
layer.enabled: true
|
||||
|
||||
layer.effect: DropShadow {
|
||||
transparentBorder: true
|
||||
radius: 8
|
||||
samples: 8
|
||||
horizontalOffset: 0
|
||||
verticalOffset: 2
|
||||
color: Qt.rgba(0, 0, 0, 0.3)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,125 @@
|
|||
|
||||
import QtQuick 2.6
|
||||
import QtQuick.Layouts 1.2
|
||||
import QtQuick.Templates 2.5 as T
|
||||
import org.ukui.qqc2style.private 1.0 as StylePrivate
|
||||
import QtQuick.Controls 2.5
|
||||
|
||||
T.MenuItem {
|
||||
id: controlRoot
|
||||
|
||||
palette: StylePrivate.StyleHelper.palette
|
||||
font: StylePrivate.StyleHelper.font
|
||||
|
||||
implicitWidth: Math.max(background ? background.implicitWidth : 0,
|
||||
contentItem.implicitWidth + leftPadding + rightPadding + (arrow ? arrow.implicitWidth : 0))
|
||||
implicitHeight: visible ? Math.max(background ? background.implicitHeight : 0,
|
||||
Math.max(contentItem.implicitHeight,
|
||||
indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding) : 0
|
||||
baselineOffset: contentItem.y + contentItem.baselineOffset
|
||||
|
||||
width: parent ? parent.width : implicitWidth
|
||||
|
||||
Layout.fillWidth: true
|
||||
padding: 6
|
||||
|
||||
|
||||
property int gridUnit: fontMetrics.height
|
||||
property string icontype: "default"
|
||||
|
||||
|
||||
leftPadding: Math.floor(gridUnit/4)*2
|
||||
rightPadding: Math.floor(gridUnit/4)*2
|
||||
hoverEnabled: true
|
||||
|
||||
Shortcut {
|
||||
//in case of explicit & the button manages it by itself
|
||||
enabled: !(RegExp(/\&[^\&]/).test(controlRoot.text))
|
||||
|
||||
onActivated: {
|
||||
if (controlRoot.checkable) {
|
||||
controlRoot.toggle();
|
||||
} else {
|
||||
controlRoot.clicked();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
contentItem: RowLayout {
|
||||
Item {
|
||||
Layout.preferredWidth: (controlRoot.ListView.view && controlRoot.ListView.view.hasCheckables) || controlRoot.checkable ? controlRoot.indicator.width : Math.floor(gridUnit/4)
|
||||
}
|
||||
|
||||
StylePrivate.KyIcon {
|
||||
iconName: controlRoot.icon.name
|
||||
width: controlRoot.icon.width
|
||||
height: controlRoot.icon.height
|
||||
sunken: controlRoot.pressed || (controlRoot.checkable && controlRoot.checked)
|
||||
hover: controlRoot.hovered
|
||||
hasFocus: controlRoot.activeFocus
|
||||
icontype: controlRoot.icontype
|
||||
}
|
||||
Label {
|
||||
id: label
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
Layout.fillWidth: true
|
||||
|
||||
text: controlRoot.text
|
||||
font: controlRoot.font
|
||||
|
||||
elide: Text.ElideRight
|
||||
visible: controlRoot.text
|
||||
horizontalAlignment: Text.AlignLeft
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
}
|
||||
Label {
|
||||
id: shortcut
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
|
||||
visible: controlRoot.action && controlRoot.action.hasOwnProperty("shortcut") && controlRoot.action.shortcut !== undefined
|
||||
text: visible ? controlRoot.action.shortcut : ""
|
||||
font: controlRoot.font
|
||||
color: label.color
|
||||
horizontalAlignment: Text.AlignRight
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
}
|
||||
Item {
|
||||
Layout.preferredWidth: Math.floor(gridUnit/4)
|
||||
}
|
||||
}
|
||||
|
||||
background: Item {
|
||||
anchors.fill: parent
|
||||
implicitWidth: gridUnit * 8
|
||||
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
opacity: (controlRoot.highlighted || controlRoot.hovered) ? 1 : 0
|
||||
|
||||
color: controlRoot.palette.highlight
|
||||
}
|
||||
}
|
||||
property variant fontMetrics: TextMetrics {
|
||||
text: "M"
|
||||
function roundedIconSize(size) {
|
||||
if (size < 16) {
|
||||
return size;
|
||||
} else if (size < 22) {
|
||||
return 16;
|
||||
} else if (size < 32) {
|
||||
return 22;
|
||||
} else if (size < 48) {
|
||||
return 32;
|
||||
} else if (size < 64) {
|
||||
return 48;
|
||||
} else {
|
||||
return size;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,61 @@
|
|||
|
||||
import QtQuick 2.6
|
||||
import QtGraphicalEffects 1.0
|
||||
import QtQuick.Templates 2.5 as T
|
||||
import org.ukui.qqc2style.private 1.0 as StylePrivate
|
||||
|
||||
T.Popup {
|
||||
id: control
|
||||
|
||||
palette: StylePrivate.StyleHelper.palette
|
||||
font: StylePrivate.StyleHelper.font
|
||||
|
||||
implicitWidth: Math.max(background ? background.implicitWidth : 0,
|
||||
contentWidth > 0 ? contentWidth + leftPadding + rightPadding : 0)
|
||||
implicitHeight: Math.max(background ? background.implicitHeight : 0,
|
||||
contentWidth > 0 ? contentHeight + topPadding + bottomPadding : 0)
|
||||
|
||||
contentWidth: contentItem.implicitWidth || (contentChildren.length === 1 ? contentChildren[0].implicitWidth : 0)
|
||||
contentHeight: contentItem.implicitHeight || (contentChildren.length === 1 ? contentChildren[0].implicitHeight : 0)
|
||||
|
||||
padding: 12
|
||||
clip: true
|
||||
|
||||
enter: Transition {
|
||||
NumberAnimation {
|
||||
property: "opacity"
|
||||
from: 0
|
||||
to: 1
|
||||
easing.type: Easing.InOutQuad
|
||||
duration: 250
|
||||
}
|
||||
}
|
||||
|
||||
exit: Transition {
|
||||
NumberAnimation {
|
||||
property: "opacity"
|
||||
from: 1
|
||||
to: 0
|
||||
easing.type: Easing.InOutQuad
|
||||
duration: 250
|
||||
}
|
||||
}
|
||||
|
||||
contentItem: Item { }
|
||||
|
||||
background: Rectangle {
|
||||
radius: 2
|
||||
color: control.palette.window
|
||||
border.color: control.palette.dark
|
||||
layer.enabled: true
|
||||
|
||||
layer.effect: DropShadow {
|
||||
transparentBorder: true
|
||||
radius: 8
|
||||
samples: 16
|
||||
horizontalOffset: 0
|
||||
verticalOffset: 4
|
||||
color: Qt.rgba(0, 0, 0, 0.3)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,56 @@
|
|||
|
||||
import QtQuick 2.12
|
||||
import QtQuick.Controls 2.12
|
||||
import QtQuick.Controls.impl 2.12
|
||||
import QtQuick.Templates 2.12 as T
|
||||
import org.ukui.qqc2style.private 1.0 as StylePrivate
|
||||
|
||||
T.ScrollBar {
|
||||
id: control
|
||||
|
||||
palette: StylePrivate.StyleHelper.palette
|
||||
font: StylePrivate.StyleHelper.font
|
||||
|
||||
|
||||
implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
|
||||
implicitContentWidth + leftPadding + rightPadding)
|
||||
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
|
||||
implicitContentHeight + topPadding + bottomPadding)
|
||||
|
||||
hoverEnabled: true
|
||||
|
||||
|
||||
|
||||
padding: 2
|
||||
visible: control.policy !== T.ScrollBar.AlwaysOff
|
||||
|
||||
|
||||
|
||||
contentItem: Rectangle {
|
||||
implicitWidth: control.interactive ? 6 : 2
|
||||
implicitHeight: control.interactive ? 6 : 2
|
||||
|
||||
radius: width / 2
|
||||
color: control.palette.shadow
|
||||
|
||||
opacity: 0.3
|
||||
|
||||
|
||||
states: State {
|
||||
name: "active"
|
||||
when: control.policy === T.ScrollBar.AlwaysOn || (control.active && control.size < 1.0)
|
||||
PropertyChanges { target: control.contentItem; implicitWidth:8.5; implicitHeight:8.5; opacity:0.5}
|
||||
}
|
||||
|
||||
transitions: Transition {
|
||||
from: "active"
|
||||
SequentialAnimation {
|
||||
PauseAnimation { duration: 200 }
|
||||
NumberAnimation { target: control.contentItem; duration: 80; property: "opacity"; to: 0.3}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
|
||||
import QtQuick 2.9
|
||||
import QtQuick.Controls 2.5
|
||||
import QtQuick.Templates 2.5 as T
|
||||
import org.ukui.qqc2style.private 1.0 as StylePrivate
|
||||
|
||||
|
||||
T.ScrollView {
|
||||
id: controlRoot
|
||||
|
||||
palette: StylePrivate.StyleHelper.palette
|
||||
font: StylePrivate.StyleHelper.font
|
||||
implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
|
||||
contentWidth + leftPadding + rightPadding)
|
||||
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
|
||||
contentHeight + topPadding + bottomPadding)
|
||||
|
||||
|
||||
|
||||
ScrollBar.vertical: ScrollBar {
|
||||
parent: controlRoot
|
||||
x: controlRoot.mirrored ? 0 : controlRoot.width - width
|
||||
y: controlRoot.topPadding
|
||||
height: controlRoot.availableHeight
|
||||
active: controlRoot.ScrollBar.horizontal || controlRoot.ScrollBar.horizontal.active
|
||||
|
||||
}
|
||||
|
||||
ScrollBar.horizontal: ScrollBar {
|
||||
parent: controlRoot
|
||||
x: controlRoot.leftPadding
|
||||
y: controlRoot.height - height
|
||||
width: controlRoot.availableWidth
|
||||
active: controlRoot.ScrollBar.vertical || controlRoot.ScrollBar.vertical.active
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
|
||||
import QtQuick 2.6
|
||||
import QtQml.Models 2.1
|
||||
import QtQuick.Controls 2.5
|
||||
import org.ukui.qqc2style.private 1.0 as StylePrivate
|
||||
import QtQuick.Templates 2.5 as T
|
||||
|
||||
T.TabButton {
|
||||
id: controlRoot
|
||||
palette: StylePrivate.StyleHelper.palette
|
||||
font: StylePrivate.StyleHelper.font
|
||||
|
||||
//Some qstyles like fusion don't have correct pixel metrics here and just return 0
|
||||
implicitWidth: Math.max(styleitem.implicitWidth, textMetrics.width + textMetrics.height * 2)
|
||||
implicitHeight: styleitem.implicitHeight || textMetrics.height * 2
|
||||
baselineOffset: contentItem.y + contentItem.baselineOffset
|
||||
|
||||
//This width: is important to make the tabbar internals not assume
|
||||
//all tabs have the same width
|
||||
width: implicitWidth
|
||||
padding: 0
|
||||
|
||||
hoverEnabled: true
|
||||
|
||||
contentItem: Item {}
|
||||
|
||||
|
||||
background: StylePrivate.StyleItem {
|
||||
id: styleitem
|
||||
|
||||
TextMetrics {
|
||||
id: textMetrics
|
||||
|
||||
text: controlRoot.text
|
||||
}
|
||||
|
||||
control: controlRoot
|
||||
anchors.fill: parent
|
||||
elementType: "tab"
|
||||
paintMargins: 0
|
||||
|
||||
properties: {
|
||||
"hasFrame" : true,
|
||||
"icon": control.icon ? (control.icon.name || control.icon.source) : "",
|
||||
"iconWidth": controlRoot.icon && controlRoot.icon.width ? controlRoot.icon.width : 0,
|
||||
"iconHeight": controlRoot.icon && controlRoot.icon.height ? controlRoot.icon.height : 0,
|
||||
"flat": controlRoot.flat
|
||||
|
||||
}
|
||||
|
||||
|
||||
enabled: controlRoot.enabled
|
||||
selected: controlRoot.checked
|
||||
text: controlRoot.text
|
||||
hover: controlRoot.hovered
|
||||
hasFocus: controlRoot.activeFocus
|
||||
}
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
import QtQuick.Controls 2.5
|
||||
import QtQuick 2.6
|
||||
import QtQuick.Templates 2.5 as T
|
||||
import org.ukui.qqc2style.private 1.0 as StylePrivate
|
||||
|
||||
T.ToolButton {
|
||||
id: controlRoot
|
||||
|
||||
palette: StylePrivate.StyleHelper.palette
|
||||
font: StylePrivate.StyleHelper.font
|
||||
|
||||
property string icontype: "default"
|
||||
|
||||
implicitWidth: text.length > 0 ? background.implicitWidth : implicitHeight
|
||||
implicitHeight: background.implicitHeight
|
||||
|
||||
hoverEnabled: true //Qt.styleHints.useHoverEffects TODO: how to make this work in 5.7?
|
||||
|
||||
flat: true
|
||||
contentItem: Item {}
|
||||
|
||||
StylePrivate.KyIcon {
|
||||
id:icon
|
||||
iconName: controlRoot.icon.name
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
width: controlRoot.icon.width
|
||||
height: controlRoot.icon.height
|
||||
sunken: controlRoot.pressed || (controlRoot.checkable && controlRoot.checked)
|
||||
hover: controlRoot.hovered
|
||||
hasFocus: controlRoot.activeFocus
|
||||
icontype: controlRoot.icontype
|
||||
}
|
||||
|
||||
background: StylePrivate.StyleItem {
|
||||
id: styleitem
|
||||
anchors.fill: parent
|
||||
control: controlRoot
|
||||
elementType: controlRoot.flat ? "toolbutton" : "button"
|
||||
on: controlRoot.pressed || (controlRoot.checkable && controlRoot.checked)
|
||||
hover: controlRoot.hovered
|
||||
text: controlRoot.text
|
||||
hasFocus: false
|
||||
activeControl: controlRoot.isDefault ? "default" : "f"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,60 @@
|
|||
|
||||
import QtQuick 2.6
|
||||
import QtGraphicalEffects 1.0
|
||||
import QtQuick.Controls 2.5 as Controls
|
||||
import QtQuick.Templates 2.5 as T
|
||||
import org.ukui.qqc2style.private 1.0 as StylePrivate
|
||||
|
||||
|
||||
T.ToolTip {
|
||||
id: controlRoot
|
||||
|
||||
palette: StylePrivate.StyleHelper.palette
|
||||
font: StylePrivate.StyleHelper.font
|
||||
|
||||
|
||||
x: parent ? Math.round((parent.width - implicitWidth) / 2) : 0
|
||||
y: -implicitHeight - 3
|
||||
|
||||
// Always show the tooltip on top of everything else
|
||||
z: 999
|
||||
|
||||
implicitWidth: contentItem.implicitWidth + leftPadding + rightPadding
|
||||
implicitHeight: contentItem.implicitHeight + topPadding + bottomPadding
|
||||
|
||||
margins: 6
|
||||
padding: 6
|
||||
|
||||
|
||||
// Timeout based on text length, from QTipLabel::restartExpireTimer
|
||||
timeout: 10000 + 40 * Math.max(0, text.length - 100)
|
||||
|
||||
closePolicy: T.Popup.CloseOnEscape | T.Popup.CloseOnPressOutsideParent | T.Popup.CloseOnReleaseOutsideParent
|
||||
|
||||
contentItem: Controls.Label {
|
||||
text: controlRoot.text
|
||||
wrapMode: Text.WordWrap
|
||||
font: controlRoot.font
|
||||
color: controlRoot.palette.windowText
|
||||
}
|
||||
|
||||
|
||||
background: Rectangle {
|
||||
radius: 3
|
||||
|
||||
//border.color: controlRoot.palette.dark
|
||||
color: controlRoot.palette.toolTipBase
|
||||
|
||||
layer.enabled: true
|
||||
layer.effect: DropShadow {
|
||||
transparentBorder: true
|
||||
radius: 4
|
||||
samples: 8
|
||||
horizontalOffset: 0
|
||||
verticalOffset: 0
|
||||
color: Qt.rgba(0, 0, 0, 0.3)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
/*
|
||||
* Copyright 2017 Marco Martin <mart@kde.org>
|
||||
* Copyright 2017 The Qt Company Ltd.
|
||||
*
|
||||
* GNU Lesser General Public License Usage
|
||||
* Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
* General Public License version 3 as published by the Free Software
|
||||
* Foundation and appearing in the file LICENSE.LGPLv3 included in the
|
||||
* packaging of this file. Please review the following information to
|
||||
* ensure the GNU Lesser General Public License version 3 requirements
|
||||
* will be met: https://www.gnu.org/licenses/lgpl.html.
|
||||
*
|
||||
* GNU General Public License Usage
|
||||
* Alternatively, this file may be used under the terms of the GNU
|
||||
* General Public License version 2.0 or later as published by the Free
|
||||
* Software Foundation and appearing in the file LICENSE.GPL included in
|
||||
* the packaging of this file. Please review the following information to
|
||||
* ensure the GNU General Public License version 2.0 requirements will be
|
||||
* met: http://www.gnu.org/licenses/gpl-2.0.html.
|
||||
*/
|
||||
|
||||
|
||||
import QtQuick 2.1
|
||||
import org.kde.kirigami 2.4 as Kirigami
|
||||
|
||||
Rectangle {
|
||||
id: background
|
||||
color: highlighted || (controlRoot.pressed && !controlRoot.checked && !controlRoot.sectionDelegate) ? Kirigami.Theme.highlightColor : Kirigami.Theme.backgroundColor
|
||||
|
||||
visible: controlRoot.ListView.view ? controlRoot.ListView.view.highlight === null : true
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
color: Kirigami.Theme.highlightColor
|
||||
opacity: controlRoot.hovered && !controlRoot.pressed ? 0.2 : 0
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
/*
|
||||
* Copyright 2018 Kai Uwe Broulik <kde@privat.broulik.de>
|
||||
* Copyright 2017 The Qt Company Ltd.
|
||||
*
|
||||
* GNU Lesser General Public License Usage
|
||||
* Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
* General Public License version 3 as published by the Free Software
|
||||
* Foundation and appearing in the file LICENSE.LGPLv3 included in the
|
||||
* packaging of this file. Please review the following information to
|
||||
* ensure the GNU Lesser General Public License version 3 requirements
|
||||
* will be met: https://www.gnu.org/licenses/lgpl.html.
|
||||
*
|
||||
* GNU General Public License Usage
|
||||
* Alternatively, this file may be used under the terms of the GNU
|
||||
* General Public License version 2.0 or later as published by the Free
|
||||
* Software Foundation and appearing in the file LICENSE.GPL included in
|
||||
* the packaging of this file. Please review the following information to
|
||||
* ensure the GNU General Public License version 2.0 requirements will be
|
||||
* met: http://www.gnu.org/licenses/gpl-2.0.html.
|
||||
*/
|
||||
|
||||
|
||||
import QtQuick 2.6
|
||||
import org.kde.qqc2desktopstyle.private 1.0 as StylePrivate
|
||||
|
||||
StylePrivate.StyleItem {
|
||||
elementType: "focusrect"
|
||||
// those random numbers come from QQC1 desktop style
|
||||
anchors {
|
||||
top: parent.top
|
||||
bottom: parent.bottom
|
||||
topMargin: parent.topPadding - 1
|
||||
bottomMargin: parent.bottomPadding - 1
|
||||
}
|
||||
// this is explicitly not using left anchor for auto mirroring
|
||||
// since the label's leftPadding/rightPadding already accounts for that
|
||||
x: parent.leftPadding - 2
|
||||
width: parent.implicitWidth - parent.leftPadding - parent.rightPadding + 3
|
||||
visible: control.activeFocus
|
||||
}
|
|
@ -0,0 +1,77 @@
|
|||
/*
|
||||
* Copyright (C) 2018 by Marco Martin <mart@kde.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Library General Public License as
|
||||
* published by the Free Software Foundation; either version 2, 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 Library General Public License for more details
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this program; if not, write to the
|
||||
* Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 2.010-1301, USA.
|
||||
*/
|
||||
|
||||
import QtQuick 2.1
|
||||
import org.kde.kirigami 2.5 as Kirigami
|
||||
|
||||
Item {
|
||||
id: root
|
||||
width: 1 //<-important that this is actually a single device pixel
|
||||
height: Kirigami.Units.gridUnit
|
||||
|
||||
property Item target
|
||||
|
||||
property bool selectionStartHandle: false
|
||||
|
||||
visible: Kirigami.Settings.tabletMode && ((target.activeFocus && !selectionStartHandle) || target.selectedText.length > 0)
|
||||
|
||||
Rectangle {
|
||||
width: Math.round(Kirigami.Units.devicePixelRatio * 3)
|
||||
anchors {
|
||||
horizontalCenter: parent.horizontalCenter
|
||||
top: parent.top
|
||||
bottom: parent.bottom
|
||||
}
|
||||
color: Qt.tint(Kirigami.Theme.highlightColor, Qt.rgba(1,1,1,0.4))
|
||||
radius: width
|
||||
Rectangle {
|
||||
width: Math.round(Kirigami.Units.gridUnit/1.5)
|
||||
height: width
|
||||
visible: MobileTextActionsToolBar.shouldBeVisible
|
||||
anchors {
|
||||
horizontalCenter: parent.horizontalCenter
|
||||
verticalCenter: parent.bottom
|
||||
}
|
||||
radius: width
|
||||
color: Qt.tint(Kirigami.Theme.highlightColor, Qt.rgba(1,1,1,0.4))
|
||||
}
|
||||
MouseArea {
|
||||
anchors {
|
||||
fill: parent
|
||||
margins: -Kirigami.Units.gridUnit
|
||||
}
|
||||
preventStealing: true
|
||||
onPositionChanged: {
|
||||
var pos = mapToItem(target, mouse.x, mouse.y);
|
||||
pos = target.positionAt(pos.x, pos.y);
|
||||
|
||||
if (target.selectedText.length > 0) {
|
||||
if (selectionStartHandle) {
|
||||
target.select(Math.min(pos, target.selectionEnd - 1), target.selectionEnd);
|
||||
} else {
|
||||
target.select(target.selectionStart, Math.max(pos, target.selectionStart + 1));
|
||||
}
|
||||
} else {
|
||||
target.cursorPosition = pos;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,90 @@
|
|||
/*
|
||||
* Copyright (C) 2018 by Marco Martin <mart@kde.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Library General Public License as
|
||||
* published by the Free Software Foundation; either version 2, 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 Library General Public License for more details
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this program; if not, write to the
|
||||
* Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 2.010-1301, USA.
|
||||
*/
|
||||
|
||||
pragma Singleton
|
||||
|
||||
import QtQuick 2.1
|
||||
import QtQuick.Layouts 1.2
|
||||
import QtQuick.Window 2.2
|
||||
import QtQuick.Controls 2.5
|
||||
import org.kde.kirigami 2.5 as Kirigami
|
||||
|
||||
Popup {
|
||||
id: root
|
||||
|
||||
property Item controlRoot
|
||||
parent: controlRoot ? controlRoot.Window.contentItem : undefined
|
||||
modal: false
|
||||
focus: false
|
||||
closePolicy: Popup.NoAutoClose
|
||||
property bool shouldBeVisible: false
|
||||
|
||||
x: {
|
||||
if (!controlRoot || !controlRoot.Window.contentItem) {
|
||||
return 0;
|
||||
}
|
||||
return Math.min(Math.max(0, controlRoot.mapToItem(root.parent, controlRoot.positionToRectangle(controlRoot.selectionStart).x, 0).x - root.width/2), controlRoot.Window.contentItem.width - root.width);
|
||||
}
|
||||
|
||||
y: {
|
||||
if (!controlRoot || !controlRoot.Window.contentItem) {
|
||||
return 0;
|
||||
}
|
||||
var desiredY = controlRoot.mapToItem(root.parent, 0, controlRoot.positionToRectangle(controlRoot.selectionStart).y).y - root.height;
|
||||
|
||||
if (desiredY >= 0) {
|
||||
return Math.min(desiredY, controlRoot.Window.contentItem.height - root.height);
|
||||
} else {
|
||||
return Math.min(Math.max(0, controlRoot.mapToItem(root.parent, 0, controlRoot.positionToRectangle(controlRoot.selectionEnd).y + Math.round(Kirigami.Units.gridUnit*1.5)).y), controlRoot.Window.contentItem.height - root.height);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
visible: controlRoot ? shouldBeVisible && Kirigami.Settings.tabletMode && (controlRoot.selectedText.length > 0 || controlRoot.canPaste) : false
|
||||
|
||||
width: contentItem.implicitWidth + leftPadding + rightPadding
|
||||
|
||||
contentItem: RowLayout {
|
||||
ToolButton {
|
||||
focusPolicy: Qt.NoFocus
|
||||
icon.name: "edit-cut"
|
||||
visible: controlRoot && controlRoot.selectedText.length > 0 && (!controlRoot.hasOwnProperty("echoMode") || controlRoot.echoMode === TextInput.Normal)
|
||||
onClicked: {
|
||||
controlRoot.cut();
|
||||
}
|
||||
}
|
||||
ToolButton {
|
||||
focusPolicy: Qt.NoFocus
|
||||
icon.name: "edit-copy"
|
||||
visible: controlRoot && controlRoot.selectedText.length > 0 && (!controlRoot.hasOwnProperty("echoMode") || controlRoot.echoMode === TextInput.Normal)
|
||||
onClicked: {
|
||||
controlRoot.copy();
|
||||
}
|
||||
}
|
||||
ToolButton {
|
||||
focusPolicy: Qt.NoFocus
|
||||
icon.name: "edit-paste"
|
||||
visible: controlRoot && controlRoot.canPaste
|
||||
onClicked: {
|
||||
controlRoot.paste();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
|
||||
singleton MobileTextActionsToolBar 1.0 MobileTextActionsToolBar.qml
|
||||
DefaultListItemBackground 1.0 DefaultListItemBackground.qml
|
||||
MobileCursor 1.0 MobileCursor.qml
|
||||
FocusRect 1.0 FocusRect.qml
|
|
@ -0,0 +1,10 @@
|
|||
TEMPLATE = subdirs
|
||||
|
||||
DISTFILES += org.ukui.style/*
|
||||
|
||||
unix {
|
||||
installPath = $$[QT_INSTALL_LIBS]/qt5/qml/QtQuick/Controls.2/org.ukui.style/
|
||||
template.files = org.ukui.style/*
|
||||
template.path = $$installPath
|
||||
INSTALLS += template
|
||||
}
|
|
@ -110,8 +110,8 @@ bool BlurHelper::eventFilter(QObject *obj, QEvent *e)
|
|||
void BlurHelper::registerWidget(QWidget *widget)
|
||||
{
|
||||
// FIXME: how to blur window on wayland?
|
||||
if (!QX11Info::isPlatformX11())
|
||||
return;
|
||||
//if (!QX11Info::isPlatformX11())
|
||||
//return;
|
||||
|
||||
if (!KWindowEffects::isEffectAvailable(KWindowEffects::BlurBehind))
|
||||
return;
|
||||
|
@ -272,7 +272,7 @@ void BlurHelper::delayUpdate(QWidget *w, bool updateBlurRegionOnly)
|
|||
break;
|
||||
}
|
||||
QPainterPath path;
|
||||
path.addRoundedRect(widget->rect().adjusted(+5,+5,-5,-5), 6, 6);
|
||||
path.addRoundedRect(widget->rect().adjusted(+5,+5,-5,-5), 8, 8);
|
||||
KWindowEffects::enableBlurBehind(widget->winId(), true, path.toFillPolygon().toPolygon());
|
||||
if (!updateBlurRegionOnly)
|
||||
widget->update();
|
||||
|
@ -281,7 +281,7 @@ void BlurHelper::delayUpdate(QWidget *w, bool updateBlurRegionOnly)
|
|||
|
||||
if (widget->inherits("QTipLabel")) {
|
||||
QPainterPath path;
|
||||
path.addRoundedRect(widget->rect().adjusted(+3,+3,-3,-3),4, 4);
|
||||
path.addRoundedRect(widget->rect().adjusted(+3,+3,-3,-3),6, 6);
|
||||
KWindowEffects::enableBlurBehind(widget->winId(), true, path.toFillPolygon().toPolygon());
|
||||
if (!updateBlurRegionOnly)
|
||||
widget->update();
|
||||
|
|
|
@ -42,7 +42,7 @@ ProxyStylePlugin::ProxyStylePlugin()
|
|||
auto settings = UKUIStyleSettings::globalInstance();
|
||||
connect(settings, &UKUIStyleSettings::changed, this, [=](const QString &key) {
|
||||
if (key == "styleName" || key == "widgetThemeName") {
|
||||
if (blackList().contains(qAppName()) || qAppName() == "biometric-manager" || qAppName() == "kylin-software-center.py")
|
||||
if (blackList().contains(qAppName()) || qAppName() == "kylin-software-center.py")
|
||||
return;
|
||||
|
||||
//We should not swich a application theme which use internal style.
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#include <xcb/xcb.h>
|
||||
|
||||
#include <QApplication>
|
||||
#include <QWindow>
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
|
@ -128,7 +129,7 @@ bool WindowManager::eventFilter(QObject *obj, QEvent *e)
|
|||
* if return false will cause these windows to behave abnormally
|
||||
* \author wangweinan@kylinos.cn
|
||||
*/
|
||||
if (qAbs(event->pos().x() - m_start_point.x()) < 2 ||
|
||||
if (qAbs(event->pos().x() - m_start_point.x()) < 2 &&
|
||||
qAbs(event->pos().y() - m_start_point.y()) < 2) {
|
||||
return true;
|
||||
}
|
||||
|
@ -233,10 +234,15 @@ void WindowManager::mouseMoveEvent(QObject *obj, QMouseEvent *e)
|
|||
auto widget = qobject_cast<QWidget *>(obj);
|
||||
auto topLevel = widget->topLevelWidget();
|
||||
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5,15,0))
|
||||
topLevel->windowHandle()->startSystemMove();
|
||||
#else
|
||||
auto shellSurface = KWayland::Client::ShellSurface::fromWindow(topLevel->windowHandle());
|
||||
if (!shellSurface)
|
||||
return;
|
||||
shellSurface->requestMove(m_seat, m_serial);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
return;
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
/*
|
||||
* Qt5-UKUI's Library
|
||||
*
|
||||
* Copyright (C) 2020, Tianjin KYLIN Information Technology Co., Ltd.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this library. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Authors: Xibowen <lanyue@kylinos.cn>
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include "checkbox-parameters.h"
|
||||
|
||||
CheckBoxParameters::CheckBoxParameters()
|
||||
{
|
||||
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
/*
|
||||
* Qt5-UKUI's Library
|
||||
*
|
||||
* Copyright (C) 2020, Tianjin KYLIN Information Technology Co., Ltd.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this library. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Authors: Xibowen <lanyue@kylinos.cn>
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef CHECKBOXPARAMETERS_H
|
||||
#define CHECKBOXPARAMETERS_H
|
||||
|
||||
#include <QBrush>
|
||||
#include <QPen>
|
||||
|
||||
class CheckBoxParameters
|
||||
{
|
||||
public:
|
||||
CheckBoxParameters();
|
||||
|
||||
//private:
|
||||
int radius;
|
||||
|
||||
QBrush checkBoxDefaultBrush;
|
||||
QBrush checkBoxHoverBrush;
|
||||
QBrush checkBoxClickBrush;
|
||||
QBrush checkBoxDisableBrush;
|
||||
QBrush checkBoxOnDefaultBrush;
|
||||
QBrush checkBoxOnHoverBrush;
|
||||
QBrush checkBoxOnClickBrush;
|
||||
|
||||
QPen checkBoxDefaultPen;
|
||||
QPen checkBoxHoverPen;
|
||||
QPen checkBoxClickPen;
|
||||
QPen checkBoxDisablePen;
|
||||
QPen checkBoxOnDefaultPen;
|
||||
QPen checkBoxOnHoverPen;
|
||||
QPen checkBoxOnClickPen;
|
||||
};
|
||||
|
||||
#endif // CHECKBOXPARAMETERS_H
|
File diff suppressed because it is too large
Load Diff
|
@ -32,6 +32,17 @@
|
|||
#include "lineedit-parameters.h"
|
||||
#include "spinbox-parameters.h"
|
||||
#include "combobox-parameters.h"
|
||||
#include "list-parameters.h"
|
||||
#include "tree-parameters.h"
|
||||
#include "table-parameters.h"
|
||||
#include "checkbox-parameters.h"
|
||||
#include "radiobutton-parameters.h"
|
||||
#include "slider-parameters.h"
|
||||
#include "progressbar-parameters.h"
|
||||
#include "scrollbar-parameters.h"
|
||||
#include "tooltip-parameters.h"
|
||||
#include "tabwidget-parameters.h"
|
||||
#include "menu-parameters.h"
|
||||
|
||||
|
||||
|
||||
|
@ -62,10 +73,9 @@ public:
|
|||
|
||||
// menu
|
||||
int Menu_MarginHeight = 4 + 5;
|
||||
int Menu_Combobox_Popup_MarginHeight = 6;
|
||||
int Menu_Combobox_Popup_MarginHeight = 4;
|
||||
int Menu_MarginWidth = 4 + 5;
|
||||
int Menu_MarginPanelWidth = 0;
|
||||
int Menu_Radius = 8;
|
||||
|
||||
// menu-item
|
||||
int MenuItem_MarginHeight = 2;
|
||||
|
@ -74,7 +84,6 @@ public:
|
|||
int MenuItemSeparator_MarginWidth = 4;
|
||||
int MenuItem_DefaultHeight = 36;
|
||||
int MenuItem_DefaultWidght = 152;
|
||||
int MenuItem_Radius = 6;
|
||||
|
||||
// scrollbar
|
||||
int ScroolBar_Width = 16;
|
||||
|
@ -94,7 +103,6 @@ public:
|
|||
int ExclusiveIndicator_Height = 16;
|
||||
int RadioButtonLabel_Spacing = 8;
|
||||
int RadioButton_DefaultHeight = 36;
|
||||
int RadioButton_OnLength = 6;
|
||||
|
||||
// checkbox
|
||||
int Indicator_Width = 16;
|
||||
|
@ -135,14 +143,21 @@ public:
|
|||
LineEditParameters lineEditParameters;
|
||||
SpinBoxParameters spinBoxParameters;
|
||||
ComboBoxParameters comboBoxParameters;
|
||||
|
||||
|
||||
|
||||
ListParameters listParameters;
|
||||
TreeParameters treeParameters;
|
||||
TableParameters tableParameters;
|
||||
CheckBoxParameters checkBoxParameters;
|
||||
RadioButtonParameters radioButtonParameters;
|
||||
SliderParameters sliderParameters;
|
||||
ProgressBarParameters progressBarParameters;
|
||||
ScrollBarParameters scrollBarParameters;
|
||||
ToolTipParameters toolTipParameters;
|
||||
TabWidgetParameters tabWidgetParameters;
|
||||
MenuParameters menuParameters;
|
||||
|
||||
|
||||
|
||||
QPalette setPalette(QPalette &palette);
|
||||
virtual QColor radiobutton_default(bool isDark) = 0;// palette::Button
|
||||
|
||||
virtual void initPalette(bool isDark) = 0;
|
||||
virtual void initPushButtonParameters(bool isDark, const QStyleOption *option, const QWidget *widget) = 0;
|
||||
|
@ -150,6 +165,17 @@ public:
|
|||
virtual void initLineEditParameters(bool isDark, const QStyleOption *option, const QWidget *widget) = 0;
|
||||
virtual void initSpinBoxParameters(bool isDark, const QStyleOption *option, const QWidget *widget) = 0;
|
||||
virtual void initComboBoxParameters(bool isDark, const QStyleOption *option, const QWidget *widget) = 0;
|
||||
virtual void initListParameters(bool isDark, const QStyleOption *option, const QWidget *widget) = 0;
|
||||
virtual void initTreeParameters(bool isDark, const QStyleOption *option, const QWidget *widget) = 0;
|
||||
virtual void initTableParameters(bool isDark, const QStyleOption *option, const QWidget *widget) = 0;
|
||||
virtual void initCheckBoxParameters(bool isDark, const QStyleOption *option, const QWidget *widget) = 0;
|
||||
virtual void initRadioButtonParameters(bool isDark, const QStyleOption *option, const QWidget *widget) = 0;
|
||||
virtual void initSliderParameters(bool isDark, const QStyleOption *option, const QWidget *widget) = 0;
|
||||
virtual void initProgressBarParameters(bool isDark, const QStyleOption *option, const QWidget *widget) = 0;
|
||||
virtual void initScrollBarParameters(bool isDark, const QStyleOption *option, const QWidget *widget) = 0;
|
||||
virtual void initToolTipParameters(bool isDark, const QStyleOption *option, const QWidget *widget) = 0;
|
||||
virtual void initTabWidgetParameters(bool isDark, const QStyleOption *option, const QWidget *widget) = 0;
|
||||
virtual void initMenuParameters(bool isDark, const QStyleOption *option, const QWidget *widget) = 0;
|
||||
};
|
||||
|
||||
|
||||
|
@ -158,14 +184,23 @@ class KDefaultStyleParameters : public KAbstractStyleParameters
|
|||
public:
|
||||
KDefaultStyleParameters(QObject *parent, bool isDark);
|
||||
|
||||
QColor radiobutton_default(bool isDark) override;
|
||||
|
||||
void initPalette(bool isDark) override;
|
||||
void initPushButtonParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override;
|
||||
void initToolButtonParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override;
|
||||
void initLineEditParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override;
|
||||
void initSpinBoxParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override;
|
||||
void initComboBoxParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override;
|
||||
void initListParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override;
|
||||
void initTreeParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override;
|
||||
void initTableParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override;
|
||||
void initCheckBoxParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override;
|
||||
void initRadioButtonParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override;
|
||||
void initSliderParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override;
|
||||
void initProgressBarParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override;
|
||||
void initScrollBarParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override;
|
||||
void initToolTipParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override;
|
||||
void initTabWidgetParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override;
|
||||
void initMenuParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override;
|
||||
};
|
||||
|
||||
|
||||
|
@ -174,14 +209,23 @@ class KClassicalStyleParameters : public KAbstractStyleParameters
|
|||
public:
|
||||
KClassicalStyleParameters(QObject *parent, bool isDark);
|
||||
|
||||
QColor radiobutton_default(bool isDark) override;
|
||||
|
||||
void initPalette(bool isDark) override;
|
||||
void initPushButtonParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override;
|
||||
void initToolButtonParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override;
|
||||
void initLineEditParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override;
|
||||
void initSpinBoxParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override;
|
||||
void initComboBoxParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override;
|
||||
void initListParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override;
|
||||
void initTreeParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override;
|
||||
void initTableParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override;
|
||||
void initCheckBoxParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override;
|
||||
void initRadioButtonParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override;
|
||||
void initSliderParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override;
|
||||
void initProgressBarParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override;
|
||||
void initScrollBarParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override;
|
||||
void initToolTipParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override;
|
||||
void initTabWidgetParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override;
|
||||
void initMenuParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override;
|
||||
};
|
||||
|
||||
|
||||
|
@ -190,13 +234,22 @@ class KFashionStyleParameters : public KAbstractStyleParameters
|
|||
public:
|
||||
KFashionStyleParameters(QObject *parent, bool isDark);
|
||||
|
||||
QColor radiobutton_default(bool isDark) override;
|
||||
|
||||
void initPalette(bool isDark) override;
|
||||
void initPushButtonParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override;
|
||||
void initToolButtonParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override;
|
||||
void initLineEditParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override;
|
||||
void initSpinBoxParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override;
|
||||
void initComboBoxParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override;
|
||||
void initListParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override;
|
||||
void initTreeParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override;
|
||||
void initTableParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override;
|
||||
void initCheckBoxParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override;
|
||||
void initRadioButtonParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override;
|
||||
void initSliderParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override;
|
||||
void initProgressBarParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override;
|
||||
void initScrollBarParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override;
|
||||
void initToolTipParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override;
|
||||
void initTabWidgetParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override;
|
||||
void initMenuParameters(bool isDark, const QStyleOption *option, const QWidget *widget) override;
|
||||
};
|
||||
#endif // KABSTRACTSTYLEPARAMETERS_H
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
/*
|
||||
* Qt5-UKUI's Library
|
||||
*
|
||||
* Copyright (C) 2020, Tianjin KYLIN Information Technology Co., Ltd.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this library. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Authors: Xibowen <lanyue@kylinos.cn>
|
||||
*
|
||||
*/
|
||||
|
||||
#include "list-parameters.h"
|
||||
|
||||
ListParameters::ListParameters()
|
||||
{
|
||||
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
/*
|
||||
* Qt5-UKUI's Library
|
||||
*
|
||||
* Copyright (C) 2020, Tianjin KYLIN Information Technology Co., Ltd.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this library. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Authors: Xibowen <lanyue@kylinos.cn>
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef LISTPARAMETERS_H
|
||||
#define LISTPARAMETERS_H
|
||||
|
||||
#include <QBrush>
|
||||
|
||||
class ListParameters
|
||||
{
|
||||
public:
|
||||
ListParameters();
|
||||
|
||||
//private:
|
||||
int radius;
|
||||
|
||||
QBrush listDefaultBrush;
|
||||
QBrush listHoverBrush;
|
||||
QBrush listSelectBrush;
|
||||
QBrush listDisableBrush;
|
||||
};
|
||||
|
||||
#endif // LISTPARAMETERS_H
|
|
@ -1,94 +0,0 @@
|
|||
#include <KWindowEffects>
|
||||
#include <QApplication>
|
||||
#include <QPainterPath>
|
||||
|
||||
#include "qt5-ukui-style.h"
|
||||
#include "ukui-style-settings.h"
|
||||
#include "black-list.h"
|
||||
#include "kabstract-style-parameters.h"
|
||||
|
||||
|
||||
extern void qt_blurImage(QImage &blurImage, qreal radius, bool quality, int transposed);
|
||||
|
||||
void Qt5UKUIStyle::drawMenuPrimitive(const QStyleOption *option, QPainter *painter, const QWidget *widget) const
|
||||
{
|
||||
int rander = 5;
|
||||
painter->save();
|
||||
painter->setRenderHint(QPainter::Antialiasing);
|
||||
QPainterPath rectPath;
|
||||
rectPath.addRoundedRect(option->rect.adjusted(+rander, +rander, -rander, -rander), sp->Menu_Radius, sp->Menu_Radius);
|
||||
|
||||
// Draw a black floor
|
||||
QPixmap pixmap(option->rect.size());
|
||||
pixmap.fill(Qt::transparent);
|
||||
QPainter pixmapPainter(&pixmap);
|
||||
pixmapPainter.setRenderHint(QPainter::Antialiasing);
|
||||
pixmapPainter.setPen(Qt::transparent);
|
||||
pixmapPainter.setBrush(option->palette.color(QPalette::Active, QPalette::BrightText));
|
||||
pixmapPainter.drawPath(rectPath);
|
||||
pixmapPainter.end();
|
||||
|
||||
// Blur the black background
|
||||
QImage img = pixmap.toImage();
|
||||
qt_blurImage(img, 4, false, false);
|
||||
|
||||
// Dig out the center part
|
||||
pixmap = QPixmap::fromImage(img);
|
||||
QPainter pixmapPainter2(&pixmap);
|
||||
pixmapPainter2.setRenderHint(QPainter::Antialiasing);
|
||||
pixmapPainter2.setCompositionMode(QPainter::CompositionMode_Clear);
|
||||
pixmapPainter2.setPen(Qt::transparent);
|
||||
pixmapPainter2.setBrush(Qt::transparent);
|
||||
pixmapPainter2.drawPath(rectPath);
|
||||
|
||||
// Shadow rendering
|
||||
painter->drawPixmap(option->rect, pixmap, pixmap.rect());
|
||||
|
||||
//That's when I started drawing the frame floor
|
||||
QStyleOption opt = *option;
|
||||
auto color = opt.palette.color(QPalette::Base);
|
||||
if (UKUIStyleSettings::isSchemaInstalled("org.ukui.style")) {
|
||||
auto opacity = UKUIStyleSettings::globalInstance()->get("menuTransparency").toInt()/100.0;
|
||||
color.setAlphaF(opacity);
|
||||
}
|
||||
|
||||
if (qApp->property("blurEnable").isValid()) {
|
||||
bool blurEnable = qApp->property("blurEnable").toBool();
|
||||
if (!blurEnable) {
|
||||
color.setAlphaF(1);
|
||||
}
|
||||
}
|
||||
|
||||
if (widget) {
|
||||
if (widget->property("useSystemStyleBlur").isValid() && !widget->property("useSystemStyleBlur").toBool()) {
|
||||
color.setAlphaF(1);
|
||||
}
|
||||
}
|
||||
|
||||
//if blur effect is not supported, do not use transparent color.
|
||||
if (!KWindowEffects::isEffectAvailable(KWindowEffects::BlurBehind) || blackAppListWithBlurHelper().contains(qAppName())) {
|
||||
color.setAlphaF(1);
|
||||
}
|
||||
|
||||
opt.palette.setColor(QPalette::Base, color);
|
||||
|
||||
QPen pen(opt.palette.color(QPalette::Normal, QPalette::Dark), 1);
|
||||
pen.setCapStyle(Qt::RoundCap);
|
||||
pen.setJoinStyle(Qt::RoundJoin);
|
||||
painter->setPen(Qt::transparent);
|
||||
painter->setBrush(color);
|
||||
|
||||
QPainterPath path;
|
||||
QRegion region;
|
||||
if (widget)
|
||||
region = widget->mask();
|
||||
if (region.isEmpty())
|
||||
path.addRoundedRect(opt.rect.adjusted(+rander, +rander, -rander,-rander), sp->Menu_Radius, sp->Menu_Radius);
|
||||
else
|
||||
path.addRegion(region);
|
||||
|
||||
//painter->drawPolygon(path.toFillPolygon().toPolygon());
|
||||
painter->drawPath(path);
|
||||
painter->restore();
|
||||
return;
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
/*
|
||||
* Qt5-UKUI's Library
|
||||
*
|
||||
* Copyright (C) 2020, Tianjin KYLIN Information Technology Co., Ltd.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this library. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Authors: Xibowen <lanyue@kylinos.cn>
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include "menu-parameters.h"
|
||||
|
||||
MenuParameters::MenuParameters()
|
||||
{
|
||||
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
/*
|
||||
* Qt5-UKUI's Library
|
||||
*
|
||||
* Copyright (C) 2020, Tianjin KYLIN Information Technology Co., Ltd.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this library. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Authors: Xibowen <lanyue@kylinos.cn>
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef MENUPARAMETERS_H
|
||||
#define MENUPARAMETERS_H
|
||||
|
||||
#include <QPixmap>
|
||||
#include <QBrush>
|
||||
|
||||
class MenuParameters
|
||||
{
|
||||
public:
|
||||
MenuParameters();
|
||||
|
||||
int frameRadius;
|
||||
int itemRadius;
|
||||
|
||||
QBrush menuItemSelectBrush;
|
||||
|
||||
QPixmap menuFramePixmap;
|
||||
};
|
||||
|
||||
#endif // MENUPARAMETERS_H
|
|
@ -0,0 +1,29 @@
|
|||
/*
|
||||
* Qt5-UKUI's Library
|
||||
*
|
||||
* Copyright (C) 2020, Tianjin KYLIN Information Technology Co., Ltd.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this library. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Authors: Xibowen <lanyue@kylinos.cn>
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include "progressbar-parameters.h"
|
||||
|
||||
ProgressBarParameters::ProgressBarParameters()
|
||||
{
|
||||
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
* Qt5-UKUI's Library
|
||||
*
|
||||
* Copyright (C) 2020, Tianjin KYLIN Information Technology Co., Ltd.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this library. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Authors: Xibowen <lanyue@kylinos.cn>
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef PROGRESSBARPARAMETERS_H
|
||||
#define PROGRESSBARPARAMETERS_H
|
||||
|
||||
#include <QBrush>
|
||||
|
||||
class ProgressBarParameters
|
||||
{
|
||||
public:
|
||||
ProgressBarParameters();
|
||||
|
||||
//private:
|
||||
int radius;
|
||||
|
||||
QBrush progressBarContentBrush;
|
||||
|
||||
QBrush progressBarGrooveDefaultBrush;
|
||||
QBrush progressBarGrooveDisableBrush;
|
||||
|
||||
};
|
||||
|
||||
#endif // PROGRESSBARPARAMETERS_H
|
|
@ -40,7 +40,11 @@ public:
|
|||
QBrush pushButtonHoverBrush;
|
||||
QBrush pushButtonClickBrush;
|
||||
QBrush pushButtonDisableBrush;
|
||||
QBrush pushButtonDisableOnBrush;
|
||||
|
||||
QBrush pushButtonCheckBrush;
|
||||
QBrush pushButtonCheckHoverBrush;
|
||||
QBrush pushButtonCheckClickBrush;
|
||||
QBrush pushButtonCheckDisableBrush;
|
||||
|
||||
// QColor PushButtonInactiveColor;
|
||||
|
||||
|
|
|
@ -30,40 +30,61 @@ DEFINES += QT_MESSAGELOGCONTEXT
|
|||
SOURCES += \
|
||||
box-animation-helper.cpp \
|
||||
button-animation-helper.cpp \
|
||||
checkbox-parameters.cpp \
|
||||
combobox-parameters.cpp \
|
||||
kabstract-style-parameters.cpp \
|
||||
lineedit-parameters.cpp \
|
||||
menu-helper.cpp \
|
||||
list-parameters.cpp \
|
||||
menu-parameters.cpp \
|
||||
progressbar-animation-helper.cpp \
|
||||
progressbar-animation.cpp \
|
||||
progressbar-parameters.cpp \
|
||||
pushbutton-parameters.cpp \
|
||||
qt5-ukui-style-plugin.cpp \
|
||||
qt5-ukui-style.cpp \
|
||||
radiobutton-parameters.cpp \
|
||||
scrollbar-parameters.cpp \
|
||||
shadow-helper.cpp \
|
||||
slider-parameters.cpp \
|
||||
spinbox-parameters.cpp \
|
||||
tab-widget-animation-helper.cpp \
|
||||
scrollbar-animation-helper.cpp \
|
||||
qt5-ukui-style-helper.cpp \
|
||||
table-parameters.cpp \
|
||||
tabwidget-parameters.cpp \
|
||||
toolbutton-parameters.cpp \
|
||||
tooltip-parameters.cpp \
|
||||
tree-parameters.cpp \
|
||||
view-helper.cpp
|
||||
|
||||
HEADERS += \
|
||||
box-animation-helper.h \
|
||||
button-animation-helper.h \
|
||||
checkbox-parameters.h \
|
||||
combobox-parameters.h \
|
||||
kabstract-style-parameters.h \
|
||||
lineedit-parameters.h \
|
||||
list-parameters.h \
|
||||
menu-parameters.h \
|
||||
progressbar-animation-helper.h \
|
||||
progressbar-animation.h \
|
||||
progressbar-parameters.h \
|
||||
pushbutton-parameters.h \
|
||||
qt5-ukui-style-plugin.h \
|
||||
qt5-ukui-style.h \
|
||||
radiobutton-parameters.h \
|
||||
scrollbar-parameters.h \
|
||||
shadow-helper.h \
|
||||
slider-parameters.h \
|
||||
spinbox-parameters.h \
|
||||
tab-widget-animation-helper.h \
|
||||
scrollbar-animation-helper.h \
|
||||
qt5-ukui-style-helper.h \
|
||||
toolbutton-parameters.h
|
||||
table-parameters.h \
|
||||
tabwidget-parameters.h \
|
||||
toolbutton-parameters.h \
|
||||
tooltip-parameters.h \
|
||||
tree-parameters.h
|
||||
DISTFILES += qt5-style-ukui.json
|
||||
|
||||
unix {
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -154,9 +154,6 @@ private:
|
|||
|
||||
void setThemeColor(QString themeColor, QPalette &palette) const;
|
||||
|
||||
// menu
|
||||
void drawMenuPrimitive(const QStyleOption *option, QPainter *painter, const QWidget *widget) const;
|
||||
|
||||
// view
|
||||
QString calculateElidedText(const QString &text, const QTextOption &textOption,
|
||||
const QFont &font, const QRect &textRect, const Qt::Alignment valign,
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
/*
|
||||
* Qt5-UKUI's Library
|
||||
*
|
||||
* Copyright (C) 2020, Tianjin KYLIN Information Technology Co., Ltd.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this library. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Authors: Xibowen <lanyue@kylinos.cn>
|
||||
*
|
||||
*/
|
||||
|
||||
#include "radiobutton-parameters.h"
|
||||
|
||||
RadioButtonParameters::RadioButtonParameters()
|
||||
{
|
||||
|
||||
}
|
|
@ -0,0 +1,54 @@
|
|||
/*
|
||||
* Qt5-UKUI's Library
|
||||
*
|
||||
* Copyright (C) 2020, Tianjin KYLIN Information Technology Co., Ltd.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this library. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Authors: Xibowen <lanyue@kylinos.cn>
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef RADIOBUTTONPARAMETERS_H
|
||||
#define RADIOBUTTONPARAMETERS_H
|
||||
|
||||
#include <QBrush>
|
||||
#include <QPen>
|
||||
|
||||
class RadioButtonParameters
|
||||
{
|
||||
public:
|
||||
RadioButtonParameters();
|
||||
|
||||
//private:
|
||||
int radius;
|
||||
|
||||
QBrush radioButtonDefaultBrush;
|
||||
QBrush radioButtonHoverBrush;
|
||||
QBrush radioButtonClickBrush;
|
||||
QBrush radioButtonDisableBrush;
|
||||
QBrush radioButtonOnDefaultBrush;
|
||||
QBrush radioButtonOnHoverBrush;
|
||||
QBrush radioButtonOnClickBrush;
|
||||
|
||||
QPen radioButtonDefaultPen;
|
||||
QPen radioButtonHoverPen;
|
||||
QPen radioButtonClickPen;
|
||||
QPen radioButtonDisablePen;
|
||||
QPen radioButtonOnDefaultPen;
|
||||
QPen radioButtonOnHoverPen;
|
||||
QPen radioButtonOnClickPen;
|
||||
};
|
||||
|
||||
#endif // RADIOBUTTONPARAMETERS_H
|
|
@ -0,0 +1,29 @@
|
|||
/*
|
||||
* Qt5-UKUI's Library
|
||||
*
|
||||
* Copyright (C) 2020, Tianjin KYLIN Information Technology Co., Ltd.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this library. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Authors: Xibowen <lanyue@kylinos.cn>
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include "scrollbar-parameters.h"
|
||||
|
||||
ScrollBarParameters::ScrollBarParameters()
|
||||
{
|
||||
|
||||
}
|
|
@ -0,0 +1,46 @@
|
|||
/*
|
||||
* Qt5-UKUI's Library
|
||||
*
|
||||
* Copyright (C) 2020, Tianjin KYLIN Information Technology Co., Ltd.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this library. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Authors: Xibowen <lanyue@kylinos.cn>
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef SCROLLBARPARAMETERS_H
|
||||
#define SCROLLBARPARAMETERS_H
|
||||
|
||||
#include <QBrush>
|
||||
|
||||
class ScrollBarParameters
|
||||
{
|
||||
public:
|
||||
ScrollBarParameters();
|
||||
|
||||
//private:
|
||||
int radius;
|
||||
QBrush scrollBarGrooveDefaultBrush;
|
||||
QBrush scrollBarGrooveInactiveBrush;
|
||||
|
||||
QBrush scrollBarSliderDefaultBrush;
|
||||
QBrush scrollBarSliderHoverBrush;
|
||||
QBrush scrollBarSliderClickBrush;
|
||||
QBrush scrollBarSliderDisableBrush;
|
||||
|
||||
};
|
||||
|
||||
#endif // SCROLLBARPARAMETERS_H
|
|
@ -187,7 +187,7 @@ QPixmap ShadowHelper::getShadowPixmap(QColor color, /*ShadowHelper::State state,
|
|||
QPixmap target = QPixmap::fromImage(rawImg);
|
||||
QPainter painter2(&target);
|
||||
painter2.save();
|
||||
painter2.setRenderHint(QPainter::Antialiasing);
|
||||
painter2.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
|
||||
painter2.translate(shadow_border, shadow_border);
|
||||
painter2.setCompositionMode(QPainter::CompositionMode_Clear);
|
||||
painter2.fillPath(windowRelativePath, Qt::transparent);
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
/*
|
||||
* Qt5-UKUI's Library
|
||||
*
|
||||
* Copyright (C) 2020, Tianjin KYLIN Information Technology Co., Ltd.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this library. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Authors: Xibowen <lanyue@kylinos.cn>
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include "slider-parameters.h"
|
||||
|
||||
SliderParameters::SliderParameters()
|
||||
{
|
||||
|
||||
}
|
|
@ -0,0 +1,50 @@
|
|||
/*
|
||||
* Qt5-UKUI's Library
|
||||
*
|
||||
* Copyright (C) 2020, Tianjin KYLIN Information Technology Co., Ltd.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this library. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Authors: Xibowen <lanyue@kylinos.cn>
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef SLIDERPARAMETERS_H
|
||||
#define SLIDERPARAMETERS_H
|
||||
|
||||
#include <QBrush>
|
||||
|
||||
class SliderParameters
|
||||
{
|
||||
public:
|
||||
SliderParameters();
|
||||
|
||||
//private:
|
||||
// int radius;
|
||||
QBrush sliderHandleDefaultBrush;
|
||||
QBrush sliderHandleHoverBrush;
|
||||
QBrush sliderHandleClickBrush;
|
||||
QBrush sliderHandleDisableBrush;
|
||||
|
||||
QBrush sliderGrooveValueDefaultBrush;
|
||||
QBrush sliderGrooveValueHoverBrush;
|
||||
QBrush sliderGrooveValueDisableBrush;
|
||||
|
||||
QBrush sliderGrooveUnvalueDefaultBrush;
|
||||
QBrush sliderGrooveUnvalueHoverBrush;
|
||||
QBrush sliderGrooveUnvalueDisableBrush;
|
||||
};
|
||||
|
||||
#endif // SLIDERPARAMETERS_H
|
|
@ -44,6 +44,15 @@ public:
|
|||
QPen spinBoxHoverPen;
|
||||
QPen spinBoxFocusPen;
|
||||
QPen spinBoxDisablePen;
|
||||
|
||||
|
||||
QBrush spinBoxUpHoverBrush;
|
||||
QBrush spinBoxUpFocusHoverBrush;
|
||||
QBrush spinBoxUpClickBrush;
|
||||
|
||||
QBrush spinBoxDownHoverBrush;
|
||||
QBrush spinBoxDownFocusHoverBrush;
|
||||
QBrush spinBoxDownClickBrush;
|
||||
};
|
||||
|
||||
#endif // SPINBOXPARAMETERS_H
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
/*
|
||||
* Qt5-UKUI's Library
|
||||
*
|
||||
* Copyright (C) 2020, Tianjin KYLIN Information Technology Co., Ltd.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this library. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Authors: Xibowen <lanyue@kylinos.cn>
|
||||
*
|
||||
*/
|
||||
|
||||
#include "table-parameters.h"
|
||||
|
||||
TableParameters::TableParameters()
|
||||
{
|
||||
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
/*
|
||||
* Qt5-UKUI's Library
|
||||
*
|
||||
* Copyright (C) 2020, Tianjin KYLIN Information Technology Co., Ltd.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this library. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Authors: Xibowen <lanyue@kylinos.cn>
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef TABLEPARAMETERS_H
|
||||
#define TABLEPARAMETERS_H
|
||||
|
||||
#include <QBrush>
|
||||
|
||||
|
||||
class TableParameters
|
||||
{
|
||||
public:
|
||||
TableParameters();
|
||||
|
||||
//private:
|
||||
int radius;
|
||||
|
||||
QBrush tableDefaultBrush;
|
||||
QBrush tableHoverBrush;
|
||||
QBrush tableSelectBrush;
|
||||
QBrush tableDisableBrush;
|
||||
};
|
||||
|
||||
#endif // TABLEPARAMETERS_H
|
|
@ -0,0 +1,29 @@
|
|||
/*
|
||||
* Qt5-UKUI's Library
|
||||
*
|
||||
* Copyright (C) 2020, Tianjin KYLIN Information Technology Co., Ltd.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this library. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Authors: Xibowen <xibowen@kylinos.cn>
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include "tabwidget-parameters.h"
|
||||
|
||||
TabWidgetParameters::TabWidgetParameters()
|
||||
{
|
||||
|
||||
}
|
|
@ -0,0 +1,46 @@
|
|||
/*
|
||||
* Qt5-UKUI's Library
|
||||
*
|
||||
* Copyright (C) 2020, Tianjin KYLIN Information Technology Co., Ltd.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this library. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Authors: Xibowen <xibowen@kylinos.cn>
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef TABWIDGETPARAMETERS_H
|
||||
#define TABWIDGETPARAMETERS_H
|
||||
|
||||
#include <QBrush>
|
||||
|
||||
class TabWidgetParameters
|
||||
{
|
||||
public:
|
||||
TabWidgetParameters();
|
||||
|
||||
//private:
|
||||
int radius;
|
||||
|
||||
QBrush tabWidgetBackgroundBrush;
|
||||
QBrush tabBarBackgroundBrush;
|
||||
QBrush tabBarDefaultBrush;
|
||||
QBrush tabBarHoverBrush;
|
||||
QBrush tabBarSelectBrush;
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif // TABWIDGETPARAMETERS_H
|
|
@ -38,7 +38,11 @@ public:
|
|||
QBrush toolButtonHoverBrush;
|
||||
QBrush toolButtonClickBrush;
|
||||
QBrush toolButtonDisableBrush;
|
||||
QBrush toolButtonDisableOnBrush;
|
||||
|
||||
QBrush toolButtonCheckBrush;
|
||||
QBrush toolButtonCheckHoverBrush;
|
||||
QBrush toolButtonCheckClickBrush;
|
||||
QBrush toolButtonCheckDisableBrush;
|
||||
};
|
||||
|
||||
#endif // TOOLBUTTONPARAMETERS_H
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
/*
|
||||
* Qt5-UKUI's Library
|
||||
*
|
||||
* Copyright (C) 2020, Tianjin KYLIN Information Technology Co., Ltd.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this library. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Authors: Xibowen <lanyue@kylinos.cn>
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include "tooltip-parameters.h"
|
||||
|
||||
ToolTipParameters::ToolTipParameters()
|
||||
{
|
||||
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
/*
|
||||
* Qt5-UKUI's Library
|
||||
*
|
||||
* Copyright (C) 2020, Tianjin KYLIN Information Technology Co., Ltd.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this library. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Authors: Xibowen <lanyue@kylinos.cn>
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef TOOLTIPPARAMETERS_H
|
||||
#define TOOLTIPPARAMETERS_H
|
||||
|
||||
#include <QBrush>
|
||||
|
||||
class ToolTipParameters
|
||||
{
|
||||
public:
|
||||
ToolTipParameters();
|
||||
|
||||
//private:
|
||||
int radius;
|
||||
|
||||
QBrush toolTipBackgroundBrush;
|
||||
};
|
||||
|
||||
#endif // TOOLTIPPARAMETERS_H
|
|
@ -0,0 +1,28 @@
|
|||
/*
|
||||
* Qt5-UKUI's Library
|
||||
*
|
||||
* Copyright (C) 2020, Tianjin KYLIN Information Technology Co., Ltd.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this library. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Authors: Xibowen <lanyue@kylinos.cn>
|
||||
*
|
||||
*/
|
||||
|
||||
#include "tree-parameters.h"
|
||||
|
||||
TreeParameters::TreeParameters()
|
||||
{
|
||||
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
/*
|
||||
* Qt5-UKUI's Library
|
||||
*
|
||||
* Copyright (C) 2020, Tianjin KYLIN Information Technology Co., Ltd.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this library. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Authors: Xibowen <lanyue@kylinos.cn>
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef TREEPARAMETERS_H
|
||||
#define TREEPARAMETERS_H
|
||||
|
||||
#include <QBrush>
|
||||
|
||||
class TreeParameters
|
||||
{
|
||||
public:
|
||||
TreeParameters();
|
||||
|
||||
//private:
|
||||
int radius;
|
||||
|
||||
QBrush treeDefaultBrush;
|
||||
QBrush treeHoverBrush;
|
||||
QBrush treeSelectBrush;
|
||||
QBrush treeDisableBrush;
|
||||
|
||||
QBrush treeBranchDefaultBrush;
|
||||
QBrush treeBranchHoverBrush;
|
||||
QBrush treeBranchSelectBrush;
|
||||
QBrush treeBranchDisableBrush;
|
||||
|
||||
};
|
||||
|
||||
#endif // TREEPARAMETERS_H
|
|
@ -122,6 +122,11 @@ void Qt5UKUIStyle::viewItemDrawText(QPainter *painter, const QStyleOptionViewIte
|
|||
const bool wrapText = option->features & QStyleOptionViewItem::WrapText;
|
||||
QTextOption textOption;
|
||||
textOption.setWrapMode(wrapText ? QTextOption::WordWrap : QTextOption::ManualWrap);
|
||||
//FIX ME,bug106749::QTablewidget text cannot be aligned, forced changed it wrap mode to wrapanywhere
|
||||
if(wrapText && (widget->inherits("QTableWidget") || widget->inherits("QTableView")))
|
||||
{
|
||||
textOption.setWrapMode(QTextOption::WrapAnywhere);
|
||||
}
|
||||
textOption.setTextDirection(option->direction);
|
||||
textOption.setAlignment(QStyle::visualAlignment(option->direction, option->displayAlignment));
|
||||
|
||||
|
|
Loading…
Reference in New Issue