Qt QComboBox下拉列表做成圆角形式

QComboBox *combobox = new QComboBox;

combobox->view()->window()->setWindowFlags(Qt::Popup|Qt::FramelessWindowHint|Qt::NoDropShadowWindowHint);

combobox->view()->window()->setAttribute(Qt::WA_TranslucentBackground);

然后通过Qss设置

QComboBox QAbstractItemView {
      border-radius: 4px ;

  }

如果自己重写了view,可以自己设置QListView{

    border-radius:4px;

}

猜你喜欢

转载自blog.csdn.net/jiaojinlin/article/details/80008827