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

做游戏的网站有哪些搜索推广开户

做游戏的网站有哪些,搜索推广开户,北京网页设计师培训,商标注册查询设计类型 vi设计生成一、坑之所在 1.写了StyleSheet的QString并进行了设置 this->setStyleSheet(styleSheet_M);2.注释后,将StyleSheet换到UI form里去,然后又手动清理了UI form里的StyleSheet 重新使用代码设置,此时代码设置失效了 二、根本解决 1.手动从…

一、坑之所在

1.写了StyleSheet的QString并进行了设置

this->setStyleSheet(styleSheet_M);

2.注释后,将StyleSheet换到UI form里去,然后又手动清理了UI form里的StyleSheet
重新使用代码设置,此时代码设置失效了

二、根本解决

1.手动从UI form里删掉StyleSheet也没用,还要删除widget.ui 文件里的styleSheet属性
widget.ui:

<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0"><class>Widget</class><widget class="QWidget" name="Widget"><property name="geometry"><rect><x>0</x><y>0</y><width>500</width><height>341</height></rect></property><property name="windowTitle"><string>Widget</string></property><property name="styleSheet"><string notr="true"/></property></widget><resources/><connections/>
</ui>

2.用其他编辑器打开 widget.ui 后,删除空的 styleSheet 属性:

  <property name="styleSheet"><string notr="true"/></property>

3.然后就可以了
在这里插入图片描述

三、源码

widget.h:

#ifndef WIDGET_H
#define WIDGET_H#include <QDebug>
#include <QWidget>
#include <QListWidget>
#include <QPushButton>
#include <QLabel>
#include <QHBoxLayout>
#include <QVBoxLayout>
#include <QMessageBox>class TableItemWidget : public QWidget {Q_OBJECTpublic:explicit TableItemWidget(const QString &lineName, QWidget *parent = nullptr) : QWidget(parent) {QHBoxLayout *layout = new QHBoxLayout(this);// 左边的文字QLabel *label = new QLabel(this);layout->addWidget(label);// 右边的按钮QPushButton *button = new QPushButton(this);button->setIcon(QIcon(":/icons/settings.png"));  // 替换为实际的图标路径layout->addStretch();  // 在按钮前添加一个伸缩空间,使按钮在右边layout->addWidget(button);// 按钮点击事件connect(button, &QPushButton::clicked, this, [=]() {//QMessageBox::information(this, "按钮点击", lineName + " 的设置按钮被点击了!");qDebug() << "按钮点击,你点击了按钮:" << lineName;});setLayout(layout);}
};QT_BEGIN_NAMESPACE
namespace Ui { class Widget; }
QT_END_NAMESPACEclass Widget : public QWidget
{Q_OBJECTpublic:Widget(QWidget *parent = nullptr);~Widget();private:Ui::Widget *ui;
};const QString styleSheet_M = R"(/* 整体窗口的背景颜色 */QWidget {color: #ECEFF4;font-family: "Arial";font-size: 14px;}/* QListWidget 样式 */QListWidget {background-color: #3B4252;border: 1px solid #4C566A;border-radius: 5px;}/* QListWidget item 样式 */QListWidget::item {background-color: #4C566A;padding: 3px;border-bottom: 2px solid #434C5E;}/* 鼠标悬停时的 item 样式 */QListWidget::item:hover {background-color: #5E81AC;color: white;}/* 被选中时的 item 样式 */QListWidget::item:selected {background-color: #88C0D0;color: black;}/* 调整 QPushButton 的尺寸和外观 */QPushButton {background-color: #4C566A;color: #ECEFF4;border: 1px solid #434C5E;border-radius: 5px;padding: 5px 10px;min-width: 20px; /* 设置按钮的最小宽度 */min-height: 20px; /* 设置按钮的最小高度 */}/* 鼠标悬停时的按钮样式 */QPushButton:hover {background-color: #5E81AC;border: 2px solid #88C0D0;}/* 按下时的按钮样式 */QPushButton:pressed {background-color: #88C0D0;color: black;}/* 设置滚动条样式 */QScrollBar:vertical {width: 10px;background: transparent;margin: 2px 2px 0px 0px;border-radius: 5px;}QScrollBar::handle:vertical {width: 10px;background: rgb(140, 140, 140);border-radius: 5px;}QScrollBar::handle:vertical:hover {background: rgb(120, 120, 120);}QScrollBar::add-line:vertical,QScrollBar::sub-line:vertical {width: 0px;height: 0px;border-radius: 5px; /* Optional if border-radius is not visible */}QScrollBar::add-page:vertical,QScrollBar::sub-page:vertical {background: transparent;border-radius: 5px;})";#endif // WIDGET_H

widget.cpp:

#include "widget.h"
#include "ui_widget.h"Widget::~Widget()
{delete ui;
}Widget::Widget(QWidget *parent) : QWidget(parent), ui(new Ui::Widget)
{QVBoxLayout *mainLayout = new QVBoxLayout(this);this->setStyleSheet(styleSheet_M);// 创建 QListWidget 来容纳每个预置位项目QListWidget *tableList = new QListWidget(this);// 添加自定义的行项目for (int i = 0; i < 255; ++i) {QListWidgetItem *item = new QListWidgetItem(tableList);TableItemWidget *tableWidget = new TableItemWidget(QString("Table Line %1").arg(i), this);// 设置行高度item->setSizeHint(tableWidget->sizeHint());item->setText(QString("Table Line %1").arg(i));item->setIcon(QIcon());  // 明确设置为空图标tableList->addItem(item);tableList->setItemWidget(item, tableWidget);}mainLayout->addWidget(tableList);setLayout(mainLayout);// 行点击事件处理connect(tableList, &QListWidget::itemClicked, this, [=](QListWidgetItem *item) {//QMessageBox::information(this, "行点击", "你点击了行: " + item->text());qDebug() << "行点击,你点击了行:" << item->text();});ui->setupUi(this);
}
http://www.mnyf.cn/news/52832.html

相关文章:

  • 编程入门自学网站图片优化是什么意思
  • wordpress小说连载插件深圳关键词优化软件
  • 武汉网站建设服务商成都seo培训班
  • 织梦怎么做网站地图长春网络推广优化
  • vr网站建设seo网站首页推广
  • SEO案例网站建设苏州疫情最新情况
  • 网站如何做问卷调查百度seo排名优化排行
  • 免费网站推广怎么做高端网站设计定制
  • 二级域名做网站有哪些缺点郑州seo软件
  • 做网站公司怎么备案客户网站福州短视频seo服务
  • 网页设计图标素材win7系统优化工具
  • 建设政府网站意义百度竞价推广有哪些优势
  • 网站做好后怎么做seo网上宣传方法有哪些
  • 做营销型网站要多少钱找客源免费用哪个软件好
  • 山东新昌隆建设咨询有限公司网站电脑优化软件排行榜
  • 网站开发技术 难点天津网站建设技术外包
  • 鄞州做网站十大app开发公司排名
  • 兼积做调查挣钱网站百度下载
  • 南昌科技学院是几本大学深圳seo秘籍
  • 珠海建网站千锋培训学费多少钱
  • 宁津做网站公司电商seo优化是什么意思
  • 采集wordpress整站数据百度广告联系方式
  • 行业网站建设价格百度网站关键词优化
  • 做外贸的j交易网站app开发流程
  • 一般建设网站大概需要多少钱如何用html制作网页
  • 时时彩做号工具网站查询网站备案信息
  • 鞍山网站制作成都排名推广
  • 改成 响应式 网站微信群发软件
  • 公众号开发是什么桂林网站优化
  • 最好的公文写作网站图片优化软件