设置QPushButton的背景图片(或者Window、WindowText等的背景图片/颜色)
来源:互联网 发布:剑灵人男捏脸数据图 编辑:程序博客网 时间:2024/06/07 07:54
设置QPushButton的背景图片
目录(?)[-]
- void QPalettesetBrush ColorRole role const QBrush brush
- enum QPaletteColorRole
setIconSize(QSize(48, 48));
如果没有下面那句话,该图片是被缩放的放到图片上
如果加上下面那句话这该图片的背景图被设置为当前尺寸
如果不是按钮可以用调色板来实现
QPalette p = palette();
p.setBrush(QPalette::Button, QBrush(QPixmap("toolbutton.png")));
setPalette(p);
注意:setBrush的第一个参数文档上是这样说的:
void QPalette::setBrush ( ColorRole role, const QBrush & brush );
enum QPalette::ColorRole
The ColorRole enum defines the different symbolic color roles used in current GUIs.
The central roles are:
There are some color roles used mostly for 3D bevel and shadow effects. All of these are normally derived fromWindow, and used in ways that depend on that relationship. For example, buttons depend on it to make the bevels look attractive, and Motif scroll bars depend on Mid to be slightly different from Window.
Selected (marked) items have two roles:
There are two color roles related to hyperlinks:
Note that we do not use the Link and LinkVisited roles when rendering rich text in Qt, and that we recommend that you use CSS and the QTextDocument::setDefaultStyleSheet() function to alter the appearance of links. For example:
QTextBrowser browser; QColor linkColor(Qt::red); QString sheet = QString::fromLatin1("a { text-decoration: underline; color: %1 }").arg(linkColor.name()); browser.document()->setDefaultStyleSheet(sheet);
说明:每次遇到有点坑爹的问题时,不要一上来到网上狂搜,先看一下api文档嘛!这不?别人说的很清除的。
- 设置QPushButton的背景图片(或者Window、WindowText等的背景图片/颜色)
- 设置QPushButton的背景图片
- 设置QPushButton的背景图片
- 设置QPushButton的背景图片
- QPushButton设置背景图片的方法
- 自定义UITabBar的背景图片或者颜色
- 自定义UITabBar的背景图片或者颜色
- [转载]自定义UITabBar的背景图片或者颜色
- 自定义UITabBar的背景图片或者颜色
- 自定义UITabBar的背景图片或者颜色 (
- 自定义UITabBar的背景图片或者颜色
- QPushButton设置背景图片变换(素材四连图)
- 关于NavigationBar背景图片和颜色的设置
- 设置UINavigation的背景图片和背景颜色
- 设置navigationBar的背景颜色 背景图片
- 设置navigationController的背景颜色和背景图片
- 关于NavigationBar背景图片和颜色的设置
- 设置UINavigation的背景图片和背景颜色
- 剑指Offer15链表中倒数第k个结点
- iOS开-发回收键盘
- 迟到的博客
- hql关联和连接查询实例
- linux基础--开机自启动
- 设置QPushButton的背景图片(或者Window、WindowText等的背景图片/颜色)
- Perl语言学习笔记 14 字符串与排序
- How to Mock Singletons in 3 Simple Ways
- ACM 139. [USACO Feb08] 麻烦的聚餐(dp+递推)
- c语言中调用shell脚本
- POJ—3069—Saruman's Army—【贪心】
- Max Points on a Line
- Codeforces Round #262 (Div. 2)B. Little Dima and Equation
- c++学习论坛