日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

Qt学习笔记-Qt程序切换皮肤

發布時間:2025/3/15 编程问答 22 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Qt学习笔记-Qt程序切换皮肤 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

運行截圖如下:



首先我們從網上隨便搞一個別人寫好的QSS(這個東西其實自己寫更有意思)

本人自己寫的還沒完善,為了做這個筆記,先用網上的,

QSS代碼如下:

/* === Shared === */ QStackedWidget, QLabel, QPushButton, QRadioButton, QCheckBox, QGroupBox, QStatusBar, QToolButton, QComboBox, QDialog {background-color: #222222;color: #BBBBBB;font-family: "Segoe UI"; }/* === QWidget === */ QWidget:window {background: #222222;color: #BBBBBB;font-family: "Segoe UI"; }/* === QToolTip === */ QToolTip {background-color: #000000;border: 2px solid #333333;color: yellow; }/* === QPushButton === */ QPushButton {border: 1px solid #333333;padding: 4px;min-width: 65px;min-height: 12px; }QPushButton:hover {background-color: #333333;border-color: #444444; }QPushButton:pressed {background-color: #111111;border-color: #333333;color: yellow; }QPushButton:disabled {color: #333333; }/* === Checkable items === */ QCheckBox::indicator, QRadioButton::indicator, QTreeView::indicator {width: 16px;height: 16px;background-color: #111111;border: 1px solid #333333; }QRadioButton::indicator {border-radius: 8px; }QCheckBox::indicator::checked, QRadioButton::indicator::checked, QTreeView::indicator::checked {background-color: qradialgradient(cx:0.5, cy:0.5, fx:0.25, fy:0.15, radius:0.3, stop:0 #BBBBBB, stop:1 #111111); }QCheckBox::indicator:disabled, QRadioButton::indicator:disabled, QTreeView::indicator:disabled {background-color: #444444; }QCheckBox::indicator::checked:disabled, QRadioButton::indicator::checked:disabled, QTreeView::indicator::checked:disabled {background-color: qradialgradient(cx:0.5, cy:0.5, fx:0.25, fy:0.15, radius:0.3, stop:0 #BBBBBB, stop:1 #444444); }/* === QComboBox === */ QComboBox {background-color: black;border: 1px solid #333333;color: white;padding:1px 2em 1px 3px; }QComboBox::drop-down {subcontrol-origin: padding;subcontrol-position: top right;border-left: 1px solid #333333; }QComboBox::down-arrow {border: 2px solid #333333;width: 6px;height: 6px;background: #5f5f5f; }/* === QGroupBox === */ QGroupBox {border: 2px solid #333333;margin-top: 2ex; }QGroupBox::title {color: yellow;subcontrol-origin: margin;subcontrol-position: top left;margin-left: 5px; }/* === QTabWidget === */ QTabWidget::pane {background: #222222;border: 2px solid #333333; }/* === QTabBar === */ QTabBar::tab {background: transparent;border: 1px solid #333333;border-bottom: none;color: #BBBBBB;padding-left: 5px;padding-right: 10px;padding-top: 3px;padding-bottom: 3px; }QTabBar::tab:hover {background-color: #333333;border: 1px solid #444444;border-bottom: none; }QTabBar::tab:selected {background-color: #111111;border: 1px solid #333333;border-top: 1px solid yellow;border-bottom: none;color: yellow }/* === QToolBar === */ QToolBar {background-color: #222222;border: none;padding: 1px; }QToolBar:handle {background: #222222;border-left: 1px dotted yellow;color: #BBBBBB; }QToolBar::separator {width: 6px;background-color: #222222; }/* === QToolButton === */ QToolButton {border: 1px solid #333333;margin: 1px; }QToolButton:hover {background-color: #333333;border: 1px solid #444444; }QToolButton[popupMode="1"] { /* only for MenuButtonPopup */padding-right: 20px; /* make way for the popup button */ }QToolButton::menu-button {border-left: 1px solid #333333;background: transparent;width: 16px; }QToolButton::menu-button:hover {border-left: 1px solid #444444;background: transparent;width: 16px; }QToolButton:checked, QToolButton:pressed {background-color: #111111;color: yellow; }/* === QMenu === */ QMenu {background-color: black;border: 1px solid gray;color: white;padding: 1px; }QMenu::item {padding: 2px 25px 2px 20px;border: 1px solid transparent; }QMenu::item:disabled {color: #666666; }QMenu::item:selected {border-color: gray;background: #222222; }QMenu::icon:checked {}QMenu::separator {height: 1px;background: #222222;margin-left: 10px;margin-right: 10px;margin-top: 1px;margin-bottom: 1px; }QMenu::indicator {width: 13px;height: 13px; }/* === QMenuBar === */ QMenuBar {background-color: black;color: white; }QMenuBar::item {background: transparent; }QMenuBar::item:disabled {color: gray; }QMenuBar::item:selected {background: #222222; }QMenuBar::item:pressed {background: #444444; }/* === QScrollBar:vertical === */ QScrollBar:vertical {background: #111111;width: 16px;margin: 16px 0 16px 0; }QScrollBar::handle:vertical {background: #555555;min-height: 16px; }QScrollBar::add-line:vertical {background: #444444;height: 16px;subcontrol-position: bottom;subcontrol-origin: margin; }QScrollBar::sub-line:vertical {background: #444444;height: 16px;subcontrol-position: top;subcontrol-origin: margin; }QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical {background: none; }QScrollBar:up-arrow:vertical, QScrollBar:down-arrow:vertical {border: 2px solid #333333;width: 6px;height: 6px;background: #5f5f5f; }/* === QScrollBar:horizontal === */ QScrollBar:horizontal {background: #111111;height: 16px;margin: 0 16px 0 16px; }QScrollBar::handle:horizontal {background: #555555;min-width: 16px; }QScrollBar::add-line:horizontal {background: #444444;width: 16px;subcontrol-position: right;subcontrol-origin: margin; }QScrollBar::sub-line:horizontal {background: #444444;width: 16px;subcontrol-position: left;subcontrol-origin: margin; }QScrollBar::add-page:horizontal, QScrollBar::sub-page:horizontal {background: none; }QScrollBar:left-arrow:horizontal, QScrollBar:right-arrow:horizontal {border: 2px solid #333333;width: 6px;height: 6px;background: #5f5f5f; }/* =================== */ QLineEdit, QListView, QTreeView, QTableView, QAbstractSpinBox {background-color: black;color: #BBBBBB;border: 1px solid #333333; }QAbstractScrollArea, QLineEdit, QTextEdit, QAbstractSpinBox, QComboBox {border-color: #333333;border: 1px solid #333333;}/* === QHeaderView === */ QHeaderView::section {background: #222222;border: 0;color: #BBBBBB;padding: 3px 0 3px 4px; }/* === QListView === */ QListView::item:hover {background: #333333; }QListView::item:selected {background: #111111;color: yellow; }/* === QTableView === */ QTableView::item:hover {background: #333333; }QTableView::item:hover {background: #111111;color: yellow; }/* === QTreeView === */ QTreeView::item {background: black; }QTreeView::item:hover {background: #333333; }QTreeView::item:selected {background: #111111;color: yellow; }QTreeView::branch {}QTreeView::branch:has-siblings:adjoins-item {}QTreeView::branch:has-siblings:!adjoins-item {}QTreeView::branch:closed:has-children:has-siblings {}QTreeView::branch:has-children:!has-siblings:closed {}QTreeView::branch:!has-children:!has-siblings:adjoins-item {}QTreeView::branch:open:has-children:has-siblings {}QTreeView::branch:open:has-children:!has-siblings {}/* === Customizations === */ QFrame#infoLabel {border: 1px inset #333333; } 2. .QWidget {background-color: beige; }QToolBar {background-color: beige; }QDialog, QFileDialog {background-color: beige; }QTabWidget::pane { /* The tab widget frame */border-top: 2px solid #C2C7CB; }QTabWidget::tab-bar {left: 5px; /* move to the right by 5px */ }QTabBar, QTabWidget {background-color: beige; } QTabBar::tab {background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,stop: 0 #E1E1E1, stop: 0.4 #DDDDDD,stop: 0.5 #D8D8D8, stop: 1.0 #D3D3D3);border: 1px solid darkkhaki;border-bottom-color: #C2C7CB; /* same as the pane color */border-top-left-radius: 4px;border-top-right-radius: 4px;min-width: 8ex;padding: 2px;} QTabBar::tab:selected, QTabBar::tab:hover {background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,stop: 0 #fafafa, stop: 0.4 #f4f4f4,stop: 0.5 #e7e7e7, stop: 1.0 #fafafa); }QTabBar::tab:selected {border-color: #9B9B9B;border-bottom-color: #C2C7CB; /* same as pane color */ }QTabBar::tab:!selected {margin-top: 2px; /* make non-selected tabs look smaller */ }/* Nice Windows-XP-style password character. */ QLineEdit[echoMode="2"] {lineedit-password-character: 9679; }QHeaderView::section {background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1,stop:0 #616161, stop: 0.5 #505050,stop: 0.6 #434343, stop:1 #656565);color: white;padding-left: 4px;border: 1px solid #6c6c6c;}QHeaderView::section:checked{background-color: red;}/* We provide a min-width and min-height for push buttonsso that they look elegant regardless of the width of the text. */ QPushButton {background-color: palegoldenrod;border-width: 2px;border-color: darkkhaki;border-style: solid;border-radius: 5;padding: 3px;min-width: 9ex;min-height: 2.5ex; }QPushButton:hover {background-color: khaki; }/* Increase the padding, so the text is shifted when the button ispressed. */ QPushButton:pressed {padding-left: 5px;padding-top: 5px;background-color: #d0d67c; }QLabel, QAbstractButton {font: bold; }/* Mark mandatory fields with a brownish color. */ .mandatory {color: brown; }/* Bold text on status bar looks awful. */ QStatusBar QLabel {font: normal; }QStatusBar::item {border-width: 1;border-color: darkkhaki;border-style: solid;border-radius: 2; }QStackedWidget, QComboBox, QLineEdit, QSpinBox, QTextEdit, QListView, QWebView, QTreeView, QHeaderView {background-color: cornsilk;selection-color: #0a214c; selection-background-color: #C19A6B; }QListView {show-decoration-selected: 1; }QListView::item:hover {background-color: wheat; }/* We reserve 1 pixel space in padding. When we get the focus,we kill the padding and enlarge the border. This makes the itemsglow. */ QLineEdit, QFrame {border-width: 1px;padding: 1px;border-style: solid;border-color: darkkhaki;border-radius: 5px; }/* As mentioned above, eliminate the padding and increase the border. */ QLineEdit:focus, QFrame:focus {border-width: 3px;padding: 0px; }/* A QLabel is a QFrame */ QLabel {border: none;padding: 0;background: none; }/* A QToolTip is a QLabel */ QToolTip {border: 2px solid darkkhaki;padding: 5px;border-radius: 3px;opacity: 200; }/* Nice to have the background color change when hovered. */ QRadioButton:hover, QCheckBox:hover {background-color: wheat; }/* Force the dialog's buttons to follow the Windows guidelines. */ QDialogButtonBox {button-layout: 0; }3. /*Style by evilworks, 2012-2013. pollux@lavabit.comThis file is Public Domain. *//* === Shared === */ QStackedWidget, QLabel, QPushButton, QRadioButton, QCheckBox, QGroupBox, QStatusBar, QToolButton, QComboBox, QDialog, QTabBar {font-family: "Segoe UI";background-color: #888;color: #000; }/* === QWidget === */ QWidget:window {font-family: 'Segoe UI';background-color: #888; }/* === QPushButton === */ QPushButton {border: 1px solid #555;padding: 4px;min-width: 65px;min-height: 12px; }QPushButton:hover {background-color: #999; }QPushButton:pressed {background-color: #333;border-color: #555;color: #AAA; }QPushButton:disabled {color: #333333; }/* === QComboBox === */ QComboBox {background-color: #AAA;border: 1px solid #555;color: black; }QComboBox::drop-down {subcontrol-origin: padding;subcontrol-position: top right;border-left: 1px solid #333333; }/* === QGroupBox === */ QGroupBox {border: 1px solid #555;margin-top: 2ex; }QGroupBox::title {color: black;subcontrol-origin: margin;subcontrol-position: top left; border: 1px solid #555; }/* === QTabBar === */ QTabBar::tab {border-bottom: none;color: #000;padding: 4px;background-color: #888;border: 1px solid #555; }QTabBar::tab:hover {background-color: #AAA; }QTabBar::tab:selected {background-color: #000;color: white; }/* === QTabWidget === */ QTabWidget::pane {background: #888;border: 1px solid #555; }/* === QToolBar === */ QToolBar {background: #949494;border: none;padding-left: 0px;padding-right: 0px;margin: 2px; }QToolBar::separator {width: 1px;margin-left: 3px;margin-right: 3px;background-color: #555; }/* === QToolButton === */ QToolButton {border: 1px solid #666;margin: 1px; }QToolButton:hover {background-color: #AAA; }QToolButton[popupMode="1"] { /* only for MenuButtonPopup */padding-right: 20px; /* make way for the popup button */ }QToolButton::menu-button {border-left: 1px solid #666;background: transparent;width: 16px; }QToolButton::menu-button:hover {border-left: 1px solid #666;background: transparent;width: 16px; }QToolButton:checked, QToolButton:pressed {background-color: #000;border: 1px solid #555;color: white; }/* === QScrollBar:vertical === */ QScrollBar:vertical {width: 16px;margin: 16px 0 16px 0;background: #333; }QScrollBar::handle:vertical {background: #888;min-height: 16px;border-top: 1px solid #666;border-bottom: 1px solid #666; }QScrollBar::add-line:vertical {background: #888;height: 16px;subcontrol-position: bottom;subcontrol-origin: margin; }QScrollBar::sub-line:vertical {background: #888;height: 16px;subcontrol-position: top;subcontrol-origin: margin; }QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical {background: none; }/* === QScrollBar:horizontal === */ QScrollBar:horizontal {height: 16px;margin: 0 16px 0 16px;background: #333; }QScrollBar::handle:horizontal {background: #888;min-width: 16px;border-left: 1px solid #666;border-right: 1px solid #666; }QScrollBar::add-line:horizontal {background: #888;width: 16px;subcontrol-position: right;subcontrol-origin: margin; }QScrollBar::sub-line:horizontal {background: #888;width: 16px;subcontrol-position: left;subcontrol-origin: margin; }QScrollBar::add-page:horizontal, QScrollBar::sub-page:horizontal {background: none; }/* === QMenu === */ QMenu {background-color: black;border: 1px solid gray;color: white;padding: 1px; }QMenu::item {padding: 2px 25px 2px 20px;border: 1px solid transparent; }QMenu::item:disabled {color: #666666; }QMenu::item:selected {border-color: gray;background: #222222; }QMenu::icon:checked {}QMenu::separator {height: 1px;background: #222222;margin-left: 10px;margin-right: 10px;margin-top: 1px;margin-bottom: 1px; }QMenu::indicator {width: 13px;height: 13px; }/* === QMenuBar === */ QMenuBar {background-color: black;color: white; }QMenuBar::item {background: transparent; }QMenuBar::item:disabled {color: gray; }QMenuBar::item:selected {background: #222222; }QMenuBar::item:pressed {background: #444444; } /* =================== */ QLineEdit, QListView, QTreeView, QTableView, QAbstractSpinBox {background-color: #AAA;color: #000;border: 1px solid #555; }QAbstractScrollArea, QLineEdit, QTextEdit, QAbstractSpinBox, QComboBox {border: 1px solid #555; }/* === QHeaderView === */ QHeaderView::section {height: 20px; }QHeaderView::section {background: #666;border: 0;color: #000;padding-left: 4px; }/* === QListView === */ QListView::item:hover {background: #AAA; }QListView::item:selected {background: #333;color: #AAA; }/* === QTableView === */ QTableView::item:hover {background: #333333; }QTableView::item:hover {background: #111111;color: yellow; }/* === QTreeView === */ QTreeView::item {background: #AAA; }QTreeView::item:hover {background: #CCC; }QTreeView::item:selected {background: #333;color: #AAA; }


Qt代碼如下:

widget.h

#ifndef WIDGET_H #define WIDGET_H#include <QWidget>namespace Ui { class Widget; }class Widget : public QWidget {Q_OBJECTpublic:explicit Widget(QWidget *parent = 0);~Widget();public slots:void btnClicked();private:Ui::Widget *ui;int m_change; };#endif // WIDGET_H


widget.cpp

#include "widget.h" #include "ui_widget.h" #include <QFile>Widget::Widget(QWidget *parent) :QWidget(parent),m_change(0),ui(new Ui::Widget) {ui->setupUi(this);this->setWindowTitle("CSDN IT1995");connect(ui->pushButton,SIGNAL(clicked(bool)),this,SLOT(btnClicked())); }void Widget::btnClicked(){QFile *file;switch (m_change%2) {case 0:file=new QFile("my1.qss",this);break;case 1:file=new QFile("my2.qss",this);break;default:return;break;}file->open(QFile::ReadOnly);QString styleSheet=QString(file->readAll());qApp->setStyleSheet(styleSheet);file->close();m_change++; }Widget::~Widget() {delete ui; }


main.cpp

#include "widget.h" #include <QApplication>int main(int argc, char *argv[]) {QApplication a(argc, argv);Widget w;w.show();return a.exec(); }

總結

以上是生活随笔為你收集整理的Qt学习笔记-Qt程序切换皮肤的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。

主站蜘蛛池模板: h片免费网站 | 色呦呦呦呦 | 深夜免费福利视频 | 成年人午夜视频 | 免费日b视频 | 久久久精品一区二区涩爱 | 熟妇人妻无乱码中文字幕真矢织江 | 国产一区二区三区麻豆 | 男人的天堂av网 | 六月丁香av | 伊人情人综合 | 日韩一区二区高清视频 | 欧洲最强rapper网站直播 | 真实的国产乱xxxx在线91 | 麻豆视频在线观看免费 | 成人网战 | 亚洲一区国产一区 | 欧美激情第二页 | 一本加勒比波多野结衣 | 第一福利视频 | 无码精品a∨在线观看中文 福利片av | 理论片琪琪午夜电影 | 久久久久久久极品 | 国产夜夜夜| 亚洲天堂v | 一级黄色大片在线观看 | 国产精品边吃奶边做爽 | www.中文字幕在线观看 | 国产在线视频你懂得 | 男人靠女人免费视频网站 | 三级免费毛片 | 91插插插永久免费 | 中文字幕日韩视频 | 乱熟女高潮一区二区在线 | 黑人糟蹋人妻hd中文字幕 | 久久久精品999 | 囯产精品久久久久久 | 精品日本视频 | 亚洲成人激情av | 国产在线一区二区 | 色爱av综合| 成人午夜在线播放 | 在线观视频免费观看 | 日韩乱淫 | 朝桐光在线视频 | 国产精品第12页 | 亚洲咪咪 | 伊人久久亚洲 | 免费国产在线观看 | 欧美高清性xxxxhdvideosex | 99re7| 熟女丝袜一区 | 免费一区视频 | 中国妇女做爰视频 | 国产精品免费视频一区 | av一区二区在线播放 | 久久无码精品丰满人妻 | 国产一区在线免费 | 亚洲m码 欧洲s码sss222 | 国产精品激情 | 黄色视屏软件 | 欧美三级色图 | av日韩一区二区 | 91中文在线 | 国产精品香蕉在线观看 | 亚洲性图视频 | www.国产精品| 日批网址 | 久久免费小视频 | 亚洲人成7777 | 美女毛片视频 | 成人午夜视频免费在线观看 | 蜜臀av夜夜澡人人爽人人 | 久久精品无码一区二区三区毛片 | 色宗合| 黄色片在线免费观看 | 欧洲视频一区二区三区 | 国产a v一区二区三区 | 北条麻妃一区二区三区免费 | 国产精品第九页 | 欧美三级欧美一级 | 天天操天天玩 | 欧美成人a∨高清免费观看 国产精品999视频 | 天堂视频一区二区 | 精品久久一区二区三区 | av一级网站 | 伊人久久精品一区二区三区 | 亚洲AV成人无码久久精品同性 | aaa一区二区 | 琪琪午夜伦理影院7777 | 亚洲不卡中文字幕无码 | 又白又嫩毛又多15p 超碰在线一区 | 国产黄色精品网站 | 日本少妇毛茸茸高潮 | 人妻一区二区视频 | 成人看的毛片 | 欧美日韩资源 | 亚一区二区 | 日韩欧美综合在线 |