当前位置: 首页 > news >正文

qt - 19种精美软件样式

qt - 19种精美软件样式

  • 一、效果演示
  • 二、核心程序
  • 三、下载链接


一、效果演示

请添加图片描述

在这里插入图片描述

二、核心程序

#include "mainwindow.h"#include <QtAdvancedStylesheet.h>
#include <QmlStyleUrlInterceptor.h>#include "ui_mainwindow.h"
#include <QDir>
#include <QApplication>
#include <QAction>
#include <QListWidgetItem>
#include <QDockWidget>
#include <QVBoxLayout>
#include <QPushButton>
#include <QColorDialog>
#include <QDebug>
#include <QQmlEngine>#include <iostream>#define _STR(x) #x
#define STRINGIFY(x)  _STR(x)/*** Private data class - pimpl*/
struct MainWindowPrivate
{CMainWindow* _this;Ui::MainWindow ui;acss::QtAdvancedStylesheet* AdvancedStyleSheet;QVector<QPushButton*> ThemeColorButtons;/*** Private data constructor*/MainWindowPrivate(CMainWindow* _public) : _this(_public) {}void createThemeColorDockWidget();void fillThemeMenu();void setSomeIcons();void setupQuickWidget();void updateThemeColorButtons();void updateQuickWidget();/*** Loads theme aware icons for the actions in the toolbar*/void loadThemeAwareToolbarActionIcons();
};void MainWindowPrivate::createThemeColorDockWidget()
{QDockWidget* dock = new QDockWidget(("Change Theme"), _this);QWidget* w = new QWidget(dock);auto Layout = new QVBoxLayout(w);Layout->setContentsMargins(12, 12, 12, 12);Layout->setSpacing(12);w->setLayout(Layout);dock->setWidget(w);_this->addDockWidget(Qt::LeftDockWidgetArea, dock);dock->setFloating(true);const auto& ThemeColors = AdvancedStyleSheet->themeColorVariables();for (auto itc = ThemeColors.constBegin(); itc != ThemeColors.constEnd(); ++itc){auto Button = new QPushButton(itc.key());QObject::connect(Button, &QPushButton::clicked, _this, &CMainWindow::onThemeColorButtonClicked);Layout->addWidget(Button);ThemeColorButtons.append(Button);}updateThemeColorButtons();
}void MainWindowPrivate::updateThemeColorButtons()
{for (auto Button : ThemeColorButtons){auto Color = AdvancedStyleSheet->themeColor(Button->text());QString TextColor = (Color.value() < 128) ? "#ffffff" : "#000000";QString ButtonStylesheet = QString("background-color: %1; color: %2;""border: none;").arg(Color.name()).arg(TextColor);Button->setStyleSheet(ButtonStylesheet);}
}void MainWindowPrivate::updateQuickWidget()
{const auto Source = ui.quickWidget->source();ui.quickWidget->setSource({});ui.quickWidget->engine()->clearComponentCache();ui.quickWidget->setSource(Source);ui.quickWidget->setStyleSheet(AdvancedStyleSheet->styleSheet());
}void MainWindowPrivate::fillThemeMenu()
{// Add actions for theme selectionauto m = ui.menuThemes;for (const auto& Theme : AdvancedStyleSheet->themes()){QAction* a = new QAction(Theme);m->addAction(a);QObject::connect(a, &QAction::triggered, _this, &CMainWindow::onThemeActionTriggered);}}void MainWindowPrivate::setSomeIcons()
{ui.actionToolbar->setIcon(AdvancedStyleSheet->styleIcon());QIcon Icon(":/full_features/images/logo_frame.svg");for (int i = 0; i < ui.listWidget_2->count(); ++i){ui.listWidget_2->item(i)->setIcon(Icon);}
}void MainWindowPrivate::setupQuickWidget()
{ui.quickWidget->engine()->setUrlInterceptor(new acss::CQmlStyleUrlInterceptor(AdvancedStyleSheet));ui.quickWidget->setStyleSheet(AdvancedStyleSheet->styleSheet());ui.quickWidget->setSource(QUrl("qrc:/full_features/qml/simple_demo.qml"));ui.quickWidget->setAttribute(Qt::WA_AlwaysStackOnTop);ui.quickWidget->setAttribute(Qt::WA_TranslucentBackground);ui.quickWidget->setClearColor(Qt::transparent);
}void MainWindowPrivate::loadThemeAwareToolbarActionIcons()
{ui.actionSelected->setIcon(AdvancedStyleSheet->loadThemeAwareSvgIcon(":/full_features/images/edit.svg"));ui.actionaction->setIcon(AdvancedStyleSheet->loadThemeAwareSvgIcon(":/full_features/images/folder_open.svg"));ui.actionaction2->setIcon(AdvancedStyleSheet->loadThemeAwareSvgIcon(":/full_features/images/save.svg"));ui.actionaction3->setIcon(AdvancedStyleSheet->loadThemeAwareSvgIcon(":/full_features/images/help_outline.svg"));
}CMainWindow::CMainWindow(QWidget *parent): QMainWindow(parent),d(new MainWindowPrivate(this))
{d->ui.setupUi(this);QString AppDir = qApp->applicationDirPath();QString StylesDir = STRINGIFY(STYLES_DIR);d->AdvancedStyleSheet = new acss::QtAdvancedStylesheet(this);d->AdvancedStyleSheet->setStylesDirPath(StylesDir);d->AdvancedStyleSheet->setOutputDirPath(AppDir + "/output");d->AdvancedStyleSheet->setCurrentStyle("qt_material");d->AdvancedStyleSheet->setDefaultTheme();d->AdvancedStyleSheet->updateStylesheet();setWindowIcon(d->AdvancedStyleSheet->styleIcon());qApp->setStyleSheet(d->AdvancedStyleSheet->styleSheet());connect(d->AdvancedStyleSheet, SIGNAL(stylesheetChanged()), this,SLOT(onStyleManagerStylesheetChanged()));d->createThemeColorDockWidget();d->fillThemeMenu();d->setSomeIcons();d->setupQuickWidget();d->loadThemeAwareToolbarActionIcons();
}CMainWindow::~CMainWindow()
{delete d;
}void CMainWindow::onThemeActionTriggered()
{auto Action = qobject_cast<QAction*>(sender());d->AdvancedStyleSheet->setCurrentTheme(Action->text());d->AdvancedStyleSheet->updateStylesheet();
}void CMainWindow::onStyleManagerStylesheetChanged()
{qApp->setStyleSheet(d->AdvancedStyleSheet->styleSheet());d->updateThemeColorButtons();d->updateQuickWidget();
}void CMainWindow::onThemeColorButtonClicked()
{auto Button = qobject_cast<QPushButton*>(sender());QColorDialog ColorDialog;auto Color = d->AdvancedStyleSheet->themeColor(Button->text());ColorDialog.setCurrentColor(Color);if (ColorDialog.exec() != QDialog::Accepted){return;}Color = ColorDialog.currentColor();d->AdvancedStyleSheet->setThemeVariableValue(Button->text(), Color.name());d->AdvancedStyleSheet->updateStylesheet();
}

三、下载链接

https://download.csdn.net/download/u013083044/88856325

相关文章:

qt - 19种精美软件样式

qt - 19种精美软件样式 一、效果演示二、核心程序三、下载链接 一、效果演示 二、核心程序 #include "mainwindow.h"#include <QtAdvancedStylesheet.h> #include <QmlStyleUrlInterceptor.h>#include "ui_mainwindow.h" #include <QDir&g…...

vue 使用docx库生成word表格文档

在Vue.js中生成Word表格文档&#xff0c;可以通过前端库来实现。这些库可以帮助我们轻松地将HTML表格转换为Word文档&#xff08;通常是.docx格式&#xff09;。以下是一些流行的前端库&#xff0c;它们可以用于在Vue项目中生成Word表格文档&#xff1a; docx…...

ElementUI table表格组件实现双击编辑单元格失去焦点还原,支持多单元格

在使用ElementUI table表格组件时有时需要双击单元格显示编辑状态&#xff0c;失去焦点时还原表格显示。 实现思路&#xff1a; 在数据中增加isFocus:false.控制是否显示在table中用cell-dblclick双击方法 先看效果&#xff1a; 上源码&#xff1a;在表格模板中用scope.row…...

Java基于SpringBoot+Vue的图书管理系统

博主介绍&#xff1a;✌程序员徐师兄、7年大厂程序员经历。全网粉丝12w、csdn博客专家、掘金/华为云/阿里云/InfoQ等平台优质作者、专注于Java技术领域和毕业项目实战✌ &#x1f345;文末获取源码联系&#x1f345; &#x1f447;&#x1f3fb; 精彩专栏推荐订阅&#x1f447;…...

【云安全】Hypervisor与虚拟机

Hypervisor 也被称为虚拟机监视器&#xff08;Virtual Machine Monitor&#xff0c;VMM&#xff09;&#xff0c;主要作用是让多个操作系统可以在同一台物理机上运行。 Type-1 Hypervisor 与 Typer-2 Hypervisor Type-1 Hypervisor 直接安装在物理服务器上&#xff0c;不依赖…...

JS文本加密方法探究

在前端开发中&#xff0c;有时候我们需要对敏感文本进行简单的加密&#xff0c;以提高安全性。本文将介绍一种基于 JavaScript 实现的文本加密方法&#xff0c;使用了 Base64、Unicode 和 ROT13 编码。 示例代码 function encodeText(text) {// Base64编码var base64Encoded …...

推荐彩虹知识付费商城免授权7.0源码

彩虹知识付费商城免授权7.0源码&#xff0c;最低配置环境 PHP7.2 1、上传源码到网站根目录&#xff0c;导入数据库文件&#xff1a;xydai.sql 2、修改数据库配置文件&#xff1a;/config.php 3、后台&#xff1a;/admin 账号&#xff1a;admin 密码&#xff1a;123456 4、前…...

【天衍系列 04】深入理解Flink的ElasticsearchSink组件:实时数据流如何无缝地流向Elasticsearch

文章目录 01 Elasticsearch Sink 基础概念02 Elasticsearch Sink 工作原理03 Elasticsearch Sink 核心组件04 Elasticsearch Sink 配置参数05 Elasticsearch Sink 依赖管理06 Elasticsearch Sink 初阶实战07 Elasticsearch Sink 进阶实战7.1 包结构 & 项目配置项目配置appl…...

一、ActiveMQ介绍

ActiveMQ介绍 一、JMS1.jms介绍2.jms消息传递模式3.JMS编码总体架构 二、消息中间件三、ActiveMQ介绍1.引入的原因1.1 原因1.2 遇到的问题1.3 解决思路 2.定义3.特点3.1 异步处理3.2 应用系统之间解耦3.3 实际-整体架构 4.作用 一、JMS 1.jms介绍 jms是java消息服务接口规范&…...

【牛客】寒假训练营1 I-It‘s bertrand paradox. Again! 题解

传送门&#xff1a;It’s bertrand paradox. Again! 标签&#xff1a;随机 题目大意 有两个人分别用两种方式在二维平面上随机生成1e5个圆&#xff0c;每个圆上的每一个点(x,y)都满足-100<x<100且-100<y<100&#xff0c;现在将某个人生成的1e5个圆的圆心和半径告…...

各种手型都合适,功能高度可定制,雷柏VT9PRO mini和VT9PRO游戏鼠标上手

去年雷柏推出了一系列支持4KHz回报率的鼠标&#xff0c;有着非常敏捷的反应速度&#xff0c;在游戏中操作体验十分出色。尤其是这系列4K鼠标不仅型号丰富&#xff0c;而且对玩家的操作习惯、手型适应也很好&#xff0c;像是VT9系列就主打轻巧&#xff0c;还有专门针对小手用户的…...

sql建库,建表基础操作

当涉及到SQL建库和建表操作时&#xff0c;以下是一个简单的示例&#xff1a; 1. 建库&#xff08;创建数据库&#xff09; sql复制代码 CREATE DATABASE mydatabase; 上述语句将创建一个名为mydatabase的数据库。 2. 选择数据库 在创建表之前&#xff0c;需要选择要在其中…...

算法训练营day32,贪心算法6

import "strconv" //738. 单调递增的数字 func monotoneIncreasingDigits(n int) int { str : strconv.Itoa(n) nums : []byte(str) length : len(nums) if length < 1 { return n } for i : length - 1; i > 0; i-- { //如果前一个数字比当前值大&#xff0…...

CTR之行为序列建模用户兴趣:DIN

在前面的文章中&#xff0c;已经介绍了很多关于推荐系统中CTR预估的相关技术&#xff0c;今天这篇文章也是延续这个主题。但不同的&#xff0c;重点是关于用户行为序列建模&#xff0c;阿里出品。 概要 论文&#xff1a;Deep Interest Network for Click-Through Rate Predict…...

Java使用Redis实现分页功能

分页功能实现应该是比较常见的&#xff0c;对于redis来说&#xff0c;近期刷题就发现了lrange、zrange这些指令&#xff0c;这个指令怎么使用呢&#xff1f; 我们接下来就来讲解下。 目录 指令简介lrangezrange Java实现Redis实现分页功能 指令简介 lrange lrange 是 Redis 中…...

Qt标准对话框设置

Qt标准对话框设置&#xff0c;设置字体、调色板、进度条等。 #include "mainwindow.h" #include "ui_mainwindow.h"MainWindow::MainWindow(QWidget *parent): QMainWindow(parent), ui(new Ui::MainWindow) {ui->setupUi(this); }MainWindow::~MainWi…...

如何让Obsidian实现电脑端和安卓端同步

Obsidian是一款知名的笔记软件&#xff0c;支持Markdown语法&#xff0c;它允许用户在多个设备之间同步文件。要在安卓设备上实现同步&#xff0c;可以使用remote save插件&#xff0c;以下是具体操作步骤&#xff1a; 首先是安装电脑端的obsidian&#xff0c;然后依次下载obs…...

windows系统中jenkins构建报错提示“拒绝访问”

一.背景 之前徒弟在windows中安装的jenkins,运行的时候用的是java -jar jenkins.war来运行的。服务器只有1个盘符C盘。今天说构建错误了&#xff0c;问我修改了啥&#xff0c;我年前是修改过构建思路的。 二.问题分析 先看jenkins构建任务的日志&#xff0c;大概是xcopy命令执…...

服务器防火墙的应用技术有哪些?

随着互联网的发展&#xff0c;网络安全问题更加严峻。服务器防火墙技术作为一种基础的网络安全技术&#xff0c;对于保障我们的网络安全至关重要。本文将介绍服务器防火墙的概念和作用&#xff0c;以及主要的服务器防火墙技术&#xff0c;包括数据包过滤、状态检测、代理服务、…...

力扣:40. 组合总和 II

回溯&#xff1a; 1.先声明好大集合和小集合&#xff0c;在调用回溯函数&#xff0c;终止条件为sumtarget&#xff0c;要进行剪枝操作减少遍历的次数&#xff0c;去重操作防止数组中有两个相同的值来组成的集合相同。 class Solution {List<List<Integer>> li1ne…...

国防科技大学计算机基础课程笔记02信息编码

1.机内码和国标码 国标码就是我们非常熟悉的这个GB2312,但是因为都是16进制&#xff0c;因此这个了16进制的数据既可以翻译成为这个机器码&#xff0c;也可以翻译成为这个国标码&#xff0c;所以这个时候很容易会出现这个歧义的情况&#xff1b; 因此&#xff0c;我们的这个国…...

多模态2025:技术路线“神仙打架”,视频生成冲上云霄

文&#xff5c;魏琳华 编&#xff5c;王一粟 一场大会&#xff0c;聚集了中国多模态大模型的“半壁江山”。 智源大会2025为期两天的论坛中&#xff0c;汇集了学界、创业公司和大厂等三方的热门选手&#xff0c;关于多模态的集中讨论达到了前所未有的热度。其中&#xff0c;…...

CVPR 2025 MIMO: 支持视觉指代和像素grounding 的医学视觉语言模型

CVPR 2025 | MIMO&#xff1a;支持视觉指代和像素对齐的医学视觉语言模型 论文信息 标题&#xff1a;MIMO: A medical vision language model with visual referring multimodal input and pixel grounding multimodal output作者&#xff1a;Yanyuan Chen, Dexuan Xu, Yu Hu…...

mongodb源码分析session执行handleRequest命令find过程

mongo/transport/service_state_machine.cpp已经分析startSession创建ASIOSession过程&#xff0c;并且验证connection是否超过限制ASIOSession和connection是循环接受客户端命令&#xff0c;把数据流转换成Message&#xff0c;状态转变流程是&#xff1a;State::Created 》 St…...

质量体系的重要

质量体系是为确保产品、服务或过程质量满足规定要求&#xff0c;由相互关联的要素构成的有机整体。其核心内容可归纳为以下五个方面&#xff1a; &#x1f3db;️ 一、组织架构与职责 质量体系明确组织内各部门、岗位的职责与权限&#xff0c;形成层级清晰的管理网络&#xf…...

3403. 从盒子中找出字典序最大的字符串 I

3403. 从盒子中找出字典序最大的字符串 I 题目链接&#xff1a;3403. 从盒子中找出字典序最大的字符串 I 代码如下&#xff1a; class Solution { public:string answerString(string word, int numFriends) {if (numFriends 1) {return word;}string res;for (int i 0;i &…...

vue3+vite项目中使用.env文件环境变量方法

vue3vite项目中使用.env文件环境变量方法 .env文件作用命名规则常用的配置项示例使用方法注意事项在vite.config.js文件中读取环境变量方法 .env文件作用 .env 文件用于定义环境变量&#xff0c;这些变量可以在项目中通过 import.meta.env 进行访问。Vite 会自动加载这些环境变…...

纯 Java 项目(非 SpringBoot)集成 Mybatis-Plus 和 Mybatis-Plus-Join

纯 Java 项目&#xff08;非 SpringBoot&#xff09;集成 Mybatis-Plus 和 Mybatis-Plus-Join 1、依赖1.1、依赖版本1.2、pom.xml 2、代码2.1、SqlSession 构造器2.2、MybatisPlus代码生成器2.3、获取 config.yml 配置2.3.1、config.yml2.3.2、项目配置类 2.4、ftl 模板2.4.1、…...

如何更改默认 Crontab 编辑器 ?

在 Linux 领域中&#xff0c;crontab 是您可能经常遇到的一个术语。这个实用程序在类 unix 操作系统上可用&#xff0c;用于调度在预定义时间和间隔自动执行的任务。这对管理员和高级用户非常有益&#xff0c;允许他们自动执行各种系统任务。 编辑 Crontab 文件通常使用文本编…...

根目录0xa0属性对应的Ntfs!_SCB中的FileObject是什么时候被建立的----NTFS源代码分析--重要

根目录0xa0属性对应的Ntfs!_SCB中的FileObject是什么时候被建立的 第一部分&#xff1a; 0: kd> g Breakpoint 9 hit Ntfs!ReadIndexBuffer: f7173886 55 push ebp 0: kd> kc # 00 Ntfs!ReadIndexBuffer 01 Ntfs!FindFirstIndexEntry 02 Ntfs!NtfsUpda…...