本文整理汇总了C++中QTabBar::tabButton方法的典型用法代码示例。如果您正苦于以下问题:C++ QTabBar::tabButton方法的具体用法?C++ QTabBar::tabButton怎么用?C++ QTabBar::tabButton使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QTabBar
的用法示例。
在下文中一共展示了QTabBar::tabButton方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QWidget
MainWidget::MainWidget(QWidget *parent) : QWidget(parent)
{
setFixedSize(1920, 1200);
setWindowTitle(tr("Babel"));
QVBoxLayout *mainLayout = new QVBoxLayout;
QTabBar *tb;
UiContact *contact = new UiContact(this);
QScrollArea *contactScrollArea = new QScrollArea();
contactScrollArea->setWidget(contact);
_tabWidget = new QTabWidget;
tb = _tabWidget->tabBar();
_tabWidget->addTab(new Home(), tr("Home"));
_tabWidget->addTab(contactScrollArea, tr("Contact"));
std::ostringstream oss;
_tabWidget->setTabsClosable(true);
connect(_tabWidget, SIGNAL(tabCloseRequested(int)), this, SLOT(closeTab(int)));
tb->tabButton(0, QTabBar::RightSide)->hide();
tb->tabButton(1, QTabBar::RightSide)->hide();
_tabWidget->setFocusPolicy(Qt::NoFocus);
connect(&g_PTUser, SIGNAL(receivedCall(const std::string&)), this, SLOT(receivedCall(const std::string&)));
mainLayout->addWidget(_tabWidget);
setLayout(mainLayout);
}
示例2: QWizard
SoutDialog::SoutDialog( QWidget *parent, intf_thread_t *_p_intf, const QString& inputMRL )
: QWizard( parent )
{
p_intf = _p_intf;
setWindowTitle( qtr( "Stream Output" ) );
setWindowRole( "vlc-stream-output" );
/* UI stuff */
ui.setupUi( this );
ui.inputBox->setMRL( inputMRL );
ui.helpEdit->setPlainText( qtr("This wizard will allow you to stream or "
"convert your media for use locally, on your private network, "
"or on the Internet.\n"
"You should start by checking that source matches what you want "
"your input to be and then press the \"Next\" "
"button to continue.\n") );
ui.mrlEdit->setToolTip ( qtr( "Stream output string.\n"
"This is automatically generated "
"when you change the above settings,\n"
"but you can change it manually." ) ) ;
ui.destTab->setTabsClosable( true );
QTabBar* tb = ui.destTab->findChild<QTabBar*>();
if( tb != NULL ) tb->tabButton(0, QTabBar::RightSide)->hide();
CONNECT( ui.destTab, tabCloseRequested( int ), this, closeTab( int ) );
ui.destTab->setTabIcon( 0, QIcon( ":/buttons/playlist/playlist_add" ) );
ui.destBox->addItem( qtr( "File" ) );
ui.destBox->addItem( "HTTP" );
ui.destBox->addItem( "MS-WMSP (MMSH)" );
ui.destBox->addItem( "RTSP" );
ui.destBox->addItem( "RTP / MPEG Transport Stream" );
ui.destBox->addItem( "RTP Audio/Video Profile" );
ui.destBox->addItem( "UDP (legacy)" );
ui.destBox->addItem( "IceCast" );
BUTTONACT( ui.addButton, addDest() );
// /* Connect everything to the updateMRL function */
#define CB( x ) CONNECT( ui.x, toggled( bool ), this, updateMRL() );
#define CT( x ) CONNECT( ui.x, textChanged( const QString& ), this, updateMRL() );
#define CS( x ) CONNECT( ui.x, valueChanged( int ), this, updateMRL() );
#define CC( x ) CONNECT( ui.x, currentIndexChanged( int ), this, updateMRL() );
/* Misc */
CB( soutAll );
CB( localOutput ); CB( transcodeBox );
CONNECT( ui.profileSelect, optionsChanged(), this, updateMRL() );
setButtonText( QWizard::FinishButton, "Stream" );
#undef CC
#undef CS
#undef CT
#undef CB
}
示例3: closeButton
void tst_QTabBar::closeButton()
{
QTabBar tabbar;
QCOMPARE(tabbar.tabsClosable(), false);
tabbar.setTabsClosable(true);
QCOMPARE(tabbar.tabsClosable(), true);
tabbar.addTab("foo");
QTabBar::ButtonPosition closeSide = (QTabBar::ButtonPosition)tabbar.style()->styleHint(QStyle::SH_TabBar_CloseButtonPosition, 0, &tabbar);
QTabBar::ButtonPosition otherSide = (closeSide == QTabBar::LeftSide ? QTabBar::RightSide : QTabBar::LeftSide);
QVERIFY(tabbar.tabButton(0, otherSide) == 0);
QVERIFY(tabbar.tabButton(0, closeSide) != 0);
QAbstractButton *button = static_cast<QAbstractButton*>(tabbar.tabButton(0, closeSide));
QVERIFY(button);
QSignalSpy spy(&tabbar, SIGNAL(tabCloseRequested(int)));
button->click();
QCOMPARE(tabbar.count(), 1);
QCOMPARE(spy.count(), 1);
}
示例4: tabButton
// QTabBar::setTabButton(index, closeSide, closeButton);
void tst_QTabBar::tabButton()
{
QFETCH(QTabBar::ButtonPosition, position);
QTabBar::ButtonPosition otherSide = (position == QTabBar::LeftSide ? QTabBar::RightSide : QTabBar::LeftSide);
QTabBar tabbar;
tabbar.resize(500, 200);
tabbar.show();
QTRY_VERIFY(tabbar.isVisible());
tabbar.setTabButton(-1, position, 0);
QVERIFY(tabbar.tabButton(-1, position) == 0);
QVERIFY(tabbar.tabButton(0, position) == 0);
tabbar.addTab("foo");
QCOMPARE(tabbar.count(), 1);
tabbar.setTabButton(0, position, 0);
QVERIFY(tabbar.tabButton(0, position) == 0);
QPushButton *button = new QPushButton;
button->show();
button->setText("hi");
button->resize(10, 10);
QTRY_VERIFY(button->isVisible());
QTRY_VERIFY(button->isVisible());
tabbar.setTabButton(0, position, button);
QCOMPARE(tabbar.tabButton(0, position), static_cast<QWidget *>(button));
QTRY_VERIFY(!button->isHidden());
QVERIFY(tabbar.tabButton(0, otherSide) == 0);
QCOMPARE(button->parent(), static_cast<QObject *>(&tabbar));
QVERIFY(button->pos() != QPoint(0, 0));
QPushButton *button2 = new QPushButton;
tabbar.setTabButton(0, position, button2);
QVERIFY(button->isHidden());
}