QT QCombox 样式表 比起作用

对QCombox在ui编辑器中进行美化,发现外表美化有效果,但下拉框的高度美化的没效果,查看样式表也没有没问题,样式表中内容如下。
QComboBox#curve_comboBox {
    min-width: 150px;
    min-height:40;
    max-width: 150px;
    max-height:40;
     border:1px solid gray ;          /*设置边框*/
     border-radius: 3px ;             /*设置圆角*/
     padding : 1px  2px  1px  2px ;  /*针对于组合框中的文本内容*/
    font:  18px ;
}

/*下面设置针对下拉框下拉标识(箭头)*/
QComboBox::drop-down {
     subcontrol-origin: padding;           /*针对标识图标的位置设置*/
     subcontrol- position :  top  right ;
     width : 20px ;

     border-left-width :  1px ;            /*针对标识图标四周属性*/
     border-left-color : darkgray;
     border-left-style :  solid ;  /* just a single line */
     border-top-right-radius:  3px ;  /* same radius as the QComboBox */
     border-bottom-right-radius:  3px ;
}

/*下面设置针对下拉框下拉标识图片设置*/
QComboBox::down-arrow {
    width: 15px;
    image: url(:/res/image/arrow-drop.png);
}


/* 下拉后,整个下拉窗体每项的样式 */
QComboBox QAbstractItemView::item { 
min-height: 40px;
max-height: 40px;
}

/******** combobox 滚动条  *********/
QScrollBar:vertical {
      border: 0px solid grey;
      width: 40px; 
}
/*滑块样式*/
QScrollBar::handle:vertical
{
    background:rgba(205,232,255);     
}

解决办法: 在cpp构造函数处:添加setview就可以了。

 //样式表中QCombox不起作用的,要设置如下
    ui->curv_comboBox->setView(new QListView());

相关推荐

  1. QT QCombox 样式 作用

    2024-02-07 09:02:01       45 阅读
  2. GFW不作用

    2024-02-07 09:02:01       38 阅读
  3. Web 品质样式

    2024-02-07 09:02:01       33 阅读
  4. Spring MVC 的Controller切面拦截不作用

    2024-02-07 09:02:01       57 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-02-07 09:02:01       98 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-02-07 09:02:01       106 阅读
  3. 在Django里面运行非项目文件

    2024-02-07 09:02:01       87 阅读
  4. Python语言-面向对象

    2024-02-07 09:02:01       96 阅读

热门阅读

  1. Spring和Spring Boot的区别

    2024-02-07 09:02:01       51 阅读
  2. YY调音台:音频后期处理

    2024-02-07 09:02:01       54 阅读
  3. Linux常用命令

    2024-02-07 09:02:01       46 阅读
  4. Spring Boot使用easy poi

    2024-02-07 09:02:01       56 阅读
  5. Python requests库请求封装

    2024-02-07 09:02:01       56 阅读
  6. 力扣283.移动零

    2024-02-07 09:02:01       55 阅读
  7. css基础

    css基础

    2024-02-07 09:02:01      53 阅读
  8. 2024年笔记--centos docker离线安装启动失败

    2024-02-07 09:02:01       57 阅读
  9. 10分钟快速入门正则表达式

    2024-02-07 09:02:01       48 阅读