QTabWidget (面板切换效果)
QTabWidget{
border:none;取消四周框线
}
QTabBar::tab{width:0px;height:0px}//隐藏标签
QListView {
background-color: #dddddd;
border:none;
}
QListView::item {
height:50px;}//设置间距
QListView::item::selected {
background-color:white;color:black;}//设置选中后北京和字体颜色
#include "widget.h"
#include "ui_widget.h"
Widget::Widget(QWidget *parent)
: QWidget(parent)
, ui(new Ui::Widget)
{
ui->setupUi(this);
this->setLayout(ui->horizontalLayout);
}
Widget::~Widget()
{
delete ui;
}
// void Widget::on_tabWidget_tabCloseRequested(int index)
// {
// ui->tabWidget->removeTab(index);//增加索引关闭标签
// }
void Widget::on_listWidget_currentRowChanged(int currentRow)
{
ui->tabWidget->setCurrentIndex(currentRow);//增加标签索引
}