mirror of
https://gitee.com/drabel/LibQQt.git
synced 2025-01-04 10:18:44 +08:00
pic effect tabbar, add little icon style
This commit is contained in:
parent
c1d286a495
commit
ca1305350b
@ -134,6 +134,7 @@ void QQtPictureEffectTabBar::drawBackground ( QPainter* p )
|
||||
case IconStyle_Left_And_RightText:
|
||||
case IconStyle_Right_And_LeftText:
|
||||
case IconStyle_MiddleText:
|
||||
case IconStyle_Little_Top_And_BottomText:
|
||||
drawPicture ( p );
|
||||
break;
|
||||
|
||||
@ -215,6 +216,11 @@ void QQtPictureEffectTabBar::drawIcon ( QPainter* p )
|
||||
else if ( iconStyle == IconStyle_Left_And_RightText )
|
||||
tRect0 = QRect ( tRect0.left(), tRect0.top(),
|
||||
tRect0.height(), tRect0.height() );
|
||||
else if ( iconStyle == IconStyle_Little_Top_And_BottomText )
|
||||
tRect0 = QRect ( tRect0.left(),
|
||||
tRect0.top(),
|
||||
tRect0.width(),
|
||||
iconSize().height() );
|
||||
|
||||
QIcon::Mode mode = QIcon::Normal;
|
||||
|
||||
@ -286,6 +292,14 @@ void QQtPictureEffectTabBar::drawText ( QPainter* p )
|
||||
tRect0.width() - tRect0.height(),
|
||||
tRect0.height() );
|
||||
}
|
||||
else if ( iconStyle == IconStyle_Little_Top_And_BottomText )
|
||||
{
|
||||
tRect0 = QRect ( tRect0.left(),
|
||||
tRect0.top() + iconSize().height(),
|
||||
tRect0.width(),
|
||||
tRect0.height() - iconSize().height() );
|
||||
}
|
||||
|
||||
|
||||
int flags = Qt::AlignCenter;
|
||||
|
||||
@ -299,6 +313,8 @@ void QQtPictureEffectTabBar::drawText ( QPainter* p )
|
||||
flags = Qt::AlignVCenter | Qt::AlignRight;
|
||||
else if ( iconStyle == IconStyle_MiddleText )
|
||||
flags = Qt::AlignVCenter | Qt::AlignHCenter;
|
||||
else if ( iconStyle == IconStyle_Little_Top_And_BottomText )
|
||||
flags = Qt::AlignHCenter | Qt::AlignBottom;
|
||||
|
||||
//pline() << objectName() << rect;
|
||||
//if on board text is normal, this is right. otherwise the palette is right
|
||||
|
@ -24,6 +24,9 @@ public:
|
||||
IconStyle_Left_And_RightText,
|
||||
IconStyle_Right_And_LeftText,
|
||||
IconStyle_MiddleText,
|
||||
/*小Icon,大文字*/
|
||||
/*依赖iconSize的height,width无效。*/
|
||||
IconStyle_Little_Top_And_BottomText,
|
||||
|
||||
//color style
|
||||
ColorStyle_Left_And_RightText,
|
||||
@ -37,22 +40,21 @@ public:
|
||||
IconStyle getIconStyle() const { return iconStyle; }
|
||||
void setIconStyle ( IconStyle iconStyle );
|
||||
|
||||
/*背景部分 使用颜色*/
|
||||
//effected by drawbase
|
||||
/*背景部分,这里设置的是Tab的背景图*/
|
||||
/*使用颜色*/
|
||||
QColor getBackgroundColor() const { return backgroundColor; }
|
||||
void setBackgroundColor ( QColor backgroundColor );
|
||||
|
||||
/*背景部分 使用图片*/
|
||||
void setBackgroundColor ( QColor backgroundColor );//effected by drawbase
|
||||
/*使用图片*/
|
||||
void tabPixmap ( int index, QImage& img, QImage& imgSel );
|
||||
void setTabPixmap ( int index, const QString& img = QString(),
|
||||
const QString& imgSel = QString() );
|
||||
|
||||
/*Icon部分*/
|
||||
/*Icon部分,这里设置的是Tab里的Icon*/
|
||||
void tabIcon ( int index, QImage& icon, QImage& iconSel );
|
||||
void setTabIcon ( int index, const QString& icon = QString(),
|
||||
const QString& iconSel = QString() );
|
||||
|
||||
/*文字部分*/
|
||||
/*文字部分,这里设置的是Tab里显示的文字*/
|
||||
QFont getTextFont() const { return textFont; }
|
||||
void setTextFont ( QFont textFont );
|
||||
QColor getTextColor() const { return textColor; }
|
||||
|
Loading…
x
Reference in New Issue
Block a user