当前位置: 首页>>代码示例>>C++>>正文


C++ TabBar::height方法代码示例

本文整理汇总了C++中TabBar::height方法的典型用法代码示例。如果您正苦于以下问题:C++ TabBar::height方法的具体用法?C++ TabBar::height怎么用?C++ TabBar::height使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TabBar的用法示例。


在下文中一共展示了TabBar::height方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: layoutTabs

void TabBarPrivate::layoutTabs()
{
    tabRects.clear();

    QFont f = font(true);
    QFontMetrics fm(f, tabbar);
    if (tabbar->isLeftToRight()) {
        // left to right
        int x = 0;
        for (int c = 0; c < tabs.count(); c++) {
            QRect rect;
            if (c >= firstTab - 1) {
                QString text = tabs[ c ];
                int tw = fm.width(text) + 4;
                rect = QRect(x, 0, tw + 20, tabbar->height());
                x = x + tw + 20;
            }
            tabRects.append(rect);
        }

        lastTab = tabRects.count();
        for (int i = 0; i < tabRects.count(); i++)
            if (tabRects[i].right() - 10 + offset > tabbar->width()) {
                lastTab = i;
                break;
            }
    } else {
        // right to left
        int x = tabbar->width() - offset;
        for (int c = 0; c < tabs.count(); c++) {
            QRect rect;
            if (c >= firstTab - 1) {
                QString text = tabs[ c ];
                int tw = fm.width(text) + 4;
                rect = QRect(x - tw - 20, 0, tw + 20, tabbar->height());
                x = x - tw - 20;
            }
            tabRects.append(rect);
        }

        lastTab = tabRects.count();
        for (int i = tabRects.count() - 1; i > 0; i--)
            if (tabRects[i].left() > 0) {
                lastTab = i + 1;
                break;
            }
    }
}
开发者ID:UIKit0,项目名称:calligra,代码行数:48,代码来源:TabBar.cpp

示例2: layoutButtons

void TabBarPrivate::layoutButtons()
{
    int bw = tabbar->height();
    int w = tabbar->width();
    offset = bw * 4;

    if (tabbar->isLeftToRight()) {
        scrollFirstButton->setGeometry(0, 0, bw, bw);
        scrollFirstButton->setIcon(QIcon(QPixmap(arrow_leftmost_xpm)));
        scrollBackButton->setGeometry(bw, 0, bw, bw);
        scrollBackButton->setIcon(QIcon(QPixmap(arrow_left_xpm)));
        scrollForwardButton->setGeometry(bw*2, 0, bw, bw);
        scrollForwardButton->setIcon(QIcon(QPixmap(arrow_right_xpm)));
        scrollLastButton->setGeometry(bw*3, 0, bw, bw);
        scrollLastButton->setIcon(QIcon(QPixmap(arrow_rightmost_xpm)));
    } else {
        scrollFirstButton->setGeometry(w - bw, 0, bw, bw);
        scrollFirstButton->setIcon(QIcon(QPixmap(arrow_rightmost_xpm)));
        scrollBackButton->setGeometry(w - 2*bw, 0, bw, bw);
        scrollBackButton->setIcon(QIcon(QPixmap(arrow_right_xpm)));
        scrollForwardButton->setGeometry(w - 3*bw, 0, bw, bw);
        scrollForwardButton->setIcon(QIcon(QPixmap(arrow_left_xpm)));
        scrollLastButton->setGeometry(w - 4*bw, 0, bw, bw);
        scrollLastButton->setIcon(QIcon(QPixmap(arrow_leftmost_xpm)));
    }
}
开发者ID:UIKit0,项目名称:calligra,代码行数:26,代码来源:TabBar.cpp


注:本文中的TabBar::height方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。