本文整理汇总了C++中TabButton::setFont方法的典型用法代码示例。如果您正苦于以下问题:C++ TabButton::setFont方法的具体用法?C++ TabButton::setFont怎么用?C++ TabButton::setFont使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TabButton
的用法示例。
在下文中一共展示了TabButton::setFont方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QString
TabButton * TabBar::addTab( QWidget * _w, const QString & _text, int _id,
bool _add_stretch, bool _text_is_tooltip )
{
// already tab with id?
if( m_tabs.contains( _id ) )
{
// then remove it
removeTab( _id );
}
QString caption = ( _text_is_tooltip ) ? QString( "" ) : _text;
// create tab-button
TabButton * b = new TabButton( caption, _id, this );
connect( b, SIGNAL( clicked( int ) ), this, SLOT( tabClicked( int ) ) );
b->setIconSize( QSize( 48, 48 ) );
b->setFixedSize( 64, 64 );
b->show();
if( _text_is_tooltip )
{
ToolTip::add( b, _text );
}
// small workaround, because QBoxLayout::addWidget(...) doesn't
// work properly, so we first have to remove all tabs from the
// layout and them add them in the correct order
QMap<int, QPair<TabButton *, QWidget *> >::iterator it;
for( it = m_tabs.begin(); it != m_tabs.end(); ++it )
{
m_layout->removeWidget( it.value().first );
}
m_tabs.insert( _id, qMakePair( b, _w ) );
for( it = m_tabs.begin(); it != m_tabs.end(); ++it )
{
m_layout->addWidget( it.value().first );
}
if( _add_stretch )
{
m_layout->addStretch();
}
// we assume, parent-widget is a widget acting as widget-stack so all
// widgets have the same size and only the one on the top is visible
_w->setFixedSize( _w->parentWidget()->size() );
b->setFont( pointSize<8>( b->font() ) );
return( b );
}
示例2: addButtonForTabContent
/*************************************************************************
Add tab button
*************************************************************************/
void TabControl::addButtonForTabContent(Window* wnd)
{
// Create the button
TabButton* tb = createTabButton(makeButtonName(wnd));
// Copy font
tb->setFont(getFont());
// Set target window
tb->setTargetWindow(wnd);
// Instert into map
d_tabButtonVector.push_back(tb);
// add the button
getTabButtonPane()->addChildWindow(tb);
// Subscribe to clicked event so that we can change tab
tb->subscribeEvent(TabButton::EventClicked,
Event::Subscriber(&TabControl::handleTabButtonClicked, this));
tb->subscribeEvent(TabButton::EventDragged,
Event::Subscriber(&TabControl::handleDraggedPane, this));
tb->subscribeEvent(TabButton::EventScrolled,
Event::Subscriber(&TabControl::handleWheeledPane, this));
}
示例3: addButtonForTabContent
/*************************************************************************
Add tab button
*************************************************************************/
void TabControl::addButtonForTabContent(Window* wnd)
{
// Create the button
TabButton* tb = createTabButton(makeButtonName(wnd));
// Copy font
tb->setFont(getFont());
// Set target window
tb->setTargetWindow(wnd);
// Set index
tb->setTabIndex(d_nextTabIndex++);
// Instert into map
d_tabButtonIndexMap.insert(
TabButtonIndexMap::value_type(tb->getTabIndex(), tb));
// add the button
d_tabButtonPane->addChildWindow(tb);
// Subscribe to clicked event so that we can change tab
tb->subscribeEvent(TabButton::EventClicked,
Event::Subscriber(&TabControl::handleTabButtonClicked, this));
}