本文整理汇总了C++中QTabBar::tabRect方法的典型用法代码示例。如果您正苦于以下问题:C++ QTabBar::tabRect方法的具体用法?C++ QTabBar::tabRect怎么用?C++ QTabBar::tabRect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QTabBar
的用法示例。
在下文中一共展示了QTabBar::tabRect方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: clickTab
void GTTabWidget::clickTab(GUITestOpStatus &os, QTabWidget* tabWidget, int idx, Qt::MouseButton button){
GT_CHECK(tabWidget != NULL, "tabWidget is NULL");
setCurrentIndex(os, tabWidget, idx);
QTabBar* tabBar = getTabBar(os, tabWidget);
QRect r = tabBar->tabRect(idx);
GTMouseDriver::moveTo(os, tabBar->mapToGlobal(r.center()));
GTMouseDriver::click(os, button);
}
示例2: GetBounds
QRect NativeTabItem::GetBounds()
{
int index = parent->IndexOf(this);
QTabBar* folder = parent->GetTabFolder();
QRect localRect = folder->tabRect(index);
QPoint topLeft = localRect.topLeft();
QPoint bottomRight = localRect.bottomRight();
QPoint globalTopLeft = folder->mapToGlobal(topLeft);
QPoint globalBottomRight = folder->mapToGlobal(bottomRight);
return QRect(globalTopLeft, globalBottomRight);
}
示例3: findDropRect
QRect QTabContainer::findDropRect(const QPoint& globalPos, int tabWidth, QTabFramework::InsertPolicy& insertPolicy, QRect& tabRectResult, int& tabIndex)
{
QPoint pos = mapFromGlobal(globalPos);
QRect containerRect = rect();
QRect result;
tabIndex = -1;
if(containerRect.contains(pos))
{
if(count() == 0)
{
insertPolicy = QTabFramework::InsertOnTop;
result = containerRect;
}
else if(tabBar()->geometry().contains(pos))
{
insertPolicy = QTabFramework::Insert;
result = containerRect;
QTabBar* tabBar = this->tabBar();
for(int i = 0, count = tabBar->count(); i < count; ++i)
{
QRect tabRect = tabBar->tabRect(i);
if(tabRect.contains(pos))
{
tabRectResult = tabRect;
tabRectResult.setRight(tabRect.left() + tabWidth);
tabRectResult.translate(tabBar->mapToGlobal(QPoint(0, 0)));
tabIndex = i;
break;
}
}
}
else if(pos.x() < containerRect.x() + containerRect.width() / 3)
{
insertPolicy = QTabFramework::InsertLeft;
result = QRect(containerRect.topLeft(), QPoint(containerRect.x() + containerRect.width() / 3, containerRect.bottom()));
}
else if(pos.x() >= containerRect.x() + containerRect.width() * 2 / 3)
{
insertPolicy = QTabFramework::InsertRight;
result = QRect(QPoint(containerRect.x() + containerRect.width() * 2 / 3, containerRect.y()), containerRect.bottomRight());
}
else if(pos.y() < containerRect.y() + tabBar()->geometry().height())
{
insertPolicy = QTabFramework::Insert;
result = containerRect;
tabIndex = this->tabBar()->count();
}
else if(pos.y() < containerRect.y() + containerRect.height() / 3)
{
insertPolicy = QTabFramework::InsertTop;
result = QRect(containerRect.topLeft(), QPoint(containerRect.right(), containerRect.y() + containerRect.height() / 3));
}
else if(pos.y() >= containerRect.y() + containerRect.height() * 2 / 3)
{
insertPolicy = QTabFramework::InsertBottom;
result = QRect(QPoint(containerRect.x(), containerRect.y() + containerRect.height() * 2 / 3), containerRect.bottomRight());
}
else
{
insertPolicy = QTabFramework::InsertOnTop;
result = containerRect;
}
}
else
{
insertPolicy = QTabFramework::InsertFloating;
return QRect();
}
result.translate(mapToGlobal(QPoint(0, 0)));
return result;
}