1
0
mirror of https://gitee.com/drabel/LibQQt.git synced 2025-01-04 10:18:44 +08:00

update picture effect tabbar

This commit is contained in:
tianduanrui 2017-11-15 19:44:12 +08:00
parent 85a910b4bb
commit b2e77cb670
4 changed files with 44 additions and 15 deletions

View File

@ -5,6 +5,7 @@
#include <qqtcore.h>
#include <qcustomplot.h>
#include <QTime>
#include <qqtpictureeffecttabwidget.h>
QCPGraph* g0 = NULL;
QTime start;
@ -44,6 +45,12 @@ MainWindow::MainWindow(QWidget* parent) :
g0 = ui->w99->addGraph(ui->w99->xAxis, ui->w99->yAxis);
start = QTime::currentTime();
ui->tw0->setStyleSheet("QTabWidget#tw0 QTabBar::tab { width:90px; height:30px; }");
QQtTabBar* tab = (QQtTabBar*)ui->tw0->localTabBar();
tab->setIconStyle(QQtTabBar::IconStyle_Left_And_RightText);
tab->setTabPixmap(0, "./skin/default/bt_setting.png", "./skin/default/bt_setting_press.png");
tab->setTabPixmap(1, "./skin/default/bt_user.png", "./skin/default/bt_user_press.png");
}

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>647</width>
<height>460</height>
<width>780</width>
<height>562</height>
</rect>
</property>
<property name="windowTitle">
@ -18,27 +18,41 @@
<item>
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>0</number>
<number>1</number>
</property>
<widget class="QWidget" name="tab_11">
<attribute name="title">
<string>页</string>
</attribute>
<widget class="QCustomPlot" name="w99" native="true">
<property name="geometry">
<rect>
<x>140</x>
<y>80</y>
<width>651</width>
<height>301</height>
</rect>
</property>
</widget>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QCustomPlot" name="w99" native="true"/>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab">
<attribute name="title">
<string>页</string>
</attribute>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QQtPictureEffectTabWidget" name="tw0">
<property name="tabPosition">
<enum>QTabWidget::West</enum>
</property>
<widget class="QWidget" name="tab_2">
<attribute name="title">
<string>Tab 1</string>
</attribute>
</widget>
<widget class="QWidget" name="tab_3">
<attribute name="title">
<string>Tab 2</string>
</attribute>
</widget>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
@ -56,8 +70,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>647</width>
<height>25</height>
<width>780</width>
<height>28</height>
</rect>
</property>
</widget>
@ -70,6 +84,12 @@
<header location="global">qcustomplot.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>QQtPictureEffectTabWidget</class>
<extends>QTabWidget</extends>
<header location="global">qqtpictureeffecttabwidget.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/>
<connections/>

View File

@ -85,6 +85,7 @@ void QQtTabBar::paintEvent(QPaintEvent* e)
opt.palette.setCurrentColorGroup(QPalette::Active);
opt.state |= QStyle::State_Sunken;
tabRectValue = tabRect(index);
//-rect.height()/20 上移
verticalTabs() ? tabRectValue.adjust(0, 0, 0, 0) : tabRectValue.adjust(0, 0, 0, 0);

View File

@ -24,6 +24,7 @@ public:
IconStyle getIconStyle() const { return iconStyle; }
void setIconStyle(IconStyle iconStyle);
void tabPixmap(int index, QImage& icon, QImage& iconSel);
void setTabPixmap(int index, const QString& icon = QString(), const QString& iconSel = QString());