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