本文整理汇总了C++中TabBar::isRightToLeft方法的典型用法代码示例。如果您正苦于以下问题:C++ TabBar::isRightToLeft方法的具体用法?C++ TabBar::isRightToLeft怎么用?C++ TabBar::isRightToLeft使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TabBar
的用法示例。
在下文中一共展示了TabBar::isRightToLeft方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: drawTab
void TabBarPrivate::drawTab(QPainter& painter, QRect& rect, const QString& text, bool active)
{
QPolygon polygon;
if (tabbar->isLeftToRight())
polygon << QPoint(rect.x(), rect.y())
<< QPoint(rect.x(), rect.bottom() - 3)
<< QPoint(rect.x() + 2, rect.bottom())
<< QPoint(rect.right() - 4, rect.bottom())
<< QPoint(rect.right() - 2, rect.bottom() - 2)
<< QPoint(rect.right() + 5, rect.top());
else
polygon << QPoint(rect.right(), rect.top())
<< QPoint(rect.right(), rect.bottom() - 3)
<< QPoint(rect.right() - 2, rect.bottom())
<< QPoint(rect.x() + 4, rect.bottom())
<< QPoint(rect.x() + 2, rect.bottom() - 2)
<< QPoint(rect.x() - 5, rect.top());
painter.save();
// fill it first
QBrush bg = tabbar->palette().background();
if (active)
bg = tabbar->palette().base();
painter.setBrush(bg);
painter.setPen(QPen(Qt::NoPen));
painter.drawPolygon(polygon);
// draw the lines
painter.setPen(tabbar->palette().color(QPalette::Dark));
painter.setRenderHint(QPainter::Antialiasing);
if (!active) {
const bool reverseLayout = tabbar->isRightToLeft();
painter.drawLine(rect.x() - (reverseLayout ? 5 : 0), rect.y(),
rect.right() + (reverseLayout ? 0 : 5), rect.top());
}
painter.drawPolyline(polygon);
painter.setPen(tabbar->palette().color(QPalette::ButtonText));
QFont f = font(active);
painter.setFont(f);
QFontMetrics fm = painter.fontMetrics();
int tx = rect.x() + (rect.width() - fm.width(text)) / 2;
int ty = rect.y() + (rect.height() - fm.height()) / 2 + fm.ascent();
painter.drawText(tx, ty, text);
painter.restore();
}