Qt Designer中利用各个控件来setStyleSheet
来源:互联网 发布:知乎匿名提问在哪里看 编辑:程序博客网 时间:2024/05/29 17:26
1.QLabel
QLabel#label_sum_text{
font: 75 35pt "微软雅黑";/*字体*/
background-color: rgb(255, 255, 255);/*背景色*/
color: rgb(152, 156, 156);/*字体颜色*/
border-style:hidden;/*边框样式*/
padding: 1px 1px 8px 1px; /*四周边距*/
}
2.QToolButton、QPushButton
/*按钮正常显示*/
QToolButton#toolButton_7{
border-image: url(
:/keybord_cfm/images/keybord_cfm/u63.png);
}
/*按钮按下*/
QToolButton#toolButton_7::pressed{
border-image: url(
:/keybord_cfm/images/keybord_cfm/u63_mouseOver.png);
}
/*鼠标移到按钮上时*/
QToolButton#toolButton_7::hover{
border-image: url(
:/keybord_cfm/images/keybord_cfm/u63_mouseOver.png);
}
注意:border-image适用于所有控件
3.QFrame
QFrame#frame_right_top{
border-style:solid;/*边框样式*/
border-width:1px;/*边框宽度*/
border-radius: 6px;/*圆角边框*/
border-color: rgb(173, 176, 182);/*边框颜色*/
background-color: rgb(255, 255, 255);/*背景色*/
}
4.QTableView
/*设置行交替颜色*/
QTableView::item:alternate:!selected,
QTableWidget::item:alternate:!selected,
QListView::item:alternate:!selected
{ background: rgb(255, 255, 204); }
QTableView::item:!alternate:!selected,
QTableWidget::item:!alternate:!selected,
QListView::item:!alternate:!selected
{ background: rgb(248, 236, 212); }
QTableView{
font: 11pt "微软雅黑";
color: rgb(152, 152, 152);
selection-background-color: rgb(50, 151, 243);
}
QTableView::item:selected{
color: rgb(152, 152, 152);
background:rgb(248, 236, 212); /*选中行背景色*/
}
/*表头设置*/
QTableView QHeaderView
{
background-color: rgb(248, 248, 248);
font: 12pt "微软雅黑";
color: rgb(112, 112, 112);
}
/*水平表头*/
QHeaderView::section::horizontal {
padding: 0px;
border: none;
border-bottom: 1px solid rgb(214, 215, 218);
background-color: rgb(248, 248, 248);
}
/*垂直表头*/
QHeaderView::section::vertical {
padding: 5px;
border: none;
background-color: rgb(248, 248, 248);
alternate-background-color: rgb(255, 0, 0);
}
/*左上角按钮*/
QTableCornerButton::section {
padding: 0px;
border: none;
border-bottom: 1px solid rgb(214, 215, 218);
background-color: rgb(248, 248, 248);
}
5.QTableView属性设置
void setAttibutes(IN QTableView* pView,IN int nHeaderHeight,IN int nColumnHeight)
{
if ( pView == NULL )
{
QString strTemp = QStringLiteral("pView== NULL!设置表格属性失败!");
LOG_ALL_ERROR(strTemp);
QMessageBox::information(0,0,QStringLiteral("设置表格属性失败!"));
return;
}
}
pView->horizontalHeader()->setFixedHeight(nHeaderHeight);//设置表头的高度
pView->horizontalHeader()->setSectionsClickable(false);//设置表头不可点击(默认点击后进行排序)
//pView->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch); //列宽都一致
pView->horizontalHeader()->setStretchLastSection(true);//最后一列占满剩余空白
pView->setSelectionBehavior(QAbstractItemView::SelectRows);//设置选择行为时每次选择一行
pView->setEditTriggers(QAbstractItemView::NoEditTriggers);//使表视图只读
pView->verticalHeader()->setDefaultSectionSize(nColumnHeight);//设置行高
//pView->setAlternatingRowColors(true);//可以交替颜色显示
pView->setShowGrid(false);//设置不显示格子线
pView->setCornerButtonEnabled(false);//左上角的按钮不可用,此按钮功能,一点击,全选
//水平滚动条
pView->horizontalScrollBar()->setStyleSheet("QScrollBar{background:transparent; height:10px;}"
"QScrollBar::handle{background:lightgray; border:2px solid transparent; border-radius:5px;}"
"QScrollBar::handle:hover{background:gray;}"
"QScrollBar::sub-line{background:transparent;}"
"QScrollBar::add-line{background:transparent;}");
//垂直滚动条
pView->verticalScrollBar()->setStyleSheet("QScrollBar{background:transparent; width: 10px;}"
"QScrollBar::handle{background:lightgray; border:2px solid transparent; border-radius:5px;}"
"QScrollBar::handle:hover{background:gray;}"
"QScrollBar::sub-line{background:transparent;}"
"QScrollBar::add-line{background:transparent;}");
}
- Qt中各个控件利用Qt Designer来setStyleSheet
- Qt Designer中利用各个控件来setStyleSheet
- Qt利用setstylesheet给控件设置背景图片不能显示
- Qt中使用 setStyleSheet来设置图形界面的外观
- Qt利用setStyleSheet设置样式
- Qt利用setStyleSheet设置样式
- 关于QT利用setStyleSheet为主控件添加背景图片,而不影响其子控件的背景设置
- (转) 5.3把自定义控件集成到Qt Designer中(Integrating Custom Widgets with Qt Designer)
- 把自定义控件集成到Qt Designer中(Integrating Custom Widgets with Qt Designer(转)
- 把自定义控件集成到Qt Designer中(Integrating Custom Widgets with Qt Designer)(转)
- 5.3把自定义控件集成到Qt Designer中(Integrating Custom Widgets with Qt Designer)
- 把自定义控件集成到Qt Designer中
- Qt中使用Qt+Designer
- 用 QT Designer 来快速学习 QT
- 5-3 把自定义控件集成到Qt Designer中(Integrating Custom Widgets with Qt Designer)
- Qt中使用setStyleSheet对按钮进行外观设置
- Qt中使用setStyleSheet对按钮进行外观设置
- Qt中使用setStyleSheet对QPushButton按钮进行外观设置
- android 多线程实现方式
- 测试1
- 定位深入理解CSS定位中的偏移
- for循环打印金字塔
- 使用logstash将kafka数据入到elasticsearch
- Qt Designer中利用各个控件来setStyleSheet
- 对象,原型,原型链
- SpringMVC +Maven
- Java EasyCMS 更新至 1.2 版本
- POJ 2068 Nim (记忆化搜索+组合博弈)
- Maven的pom.xml文件详解
- Java设计模式:外观模式(Facade Pattern)与最少知识原则
- 洛谷[P1662]世纪难题 数7 打表,模拟
- [HDU](2149)Public Sale ---巴什博弈(博弈)