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


C++ QTabBar::setTabButton方法代码示例

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


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

示例1: setNoCloseButton

void powerfulTabWidget::setNoCloseButton(int iIndex, const QSize &sizeItem)
{
    QTabBar* pTabBar = tabBar();
    if (NULL != pTabBar)
    {
        QWidget *pWidget = new QWidget;
        pWidget->resize(sizeItem);
        pTabBar->setTabButton(iIndex, QTabBar::RightSide, pWidget);
    }
}
开发者ID:pjh130,项目名称:qt,代码行数:10,代码来源:powerfulTabwidget.cpp

示例2: 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());
}
开发者ID:maxxant,项目名称:qt,代码行数:39,代码来源:tst_qtabbar.cpp

示例3: tabBar

void powerfulTabWidget::feed2Full()
{
    QTabBar* pTabBar = tabBar();
    if (NULL != pTabBar)
    {
        for (int iIndex = 0; iIndex < count(); ++iIndex)
        {
            QWidget *pWidget = new QWidget;
            pWidget->setMaximumSize(pTabBar->width() / count() / 2, pTabBar->height());
            pWidget->setMinimumSize(pTabBar->width() / count() / 2, pTabBar->height());
            pTabBar->setTabButton(iIndex, QTabBar::LeftSide, pWidget);
        }
    }
}
开发者ID:pjh130,项目名称:qt,代码行数:14,代码来源:powerfulTabwidget.cpp

示例4: QVBoxLayout


//.........这里部分代码省略.........
	//
	m_pFinder = new CFinder();
	m_pSubLayout->addWidget(m_pFinder);
	QObject::connect(m_pFinder, SIGNAL(SetFilter(const QRegExp&)), m_pFileList, SLOT(SetFilter(const QRegExp&)));

    QAction* pFinder = new QAction(tr("&Find ..."), this);
	pFinder->setShortcut(QKeySequence::Find);
	pFinder->setShortcutContext(Qt::WidgetWithChildrenShortcut);
	this->addAction(pFinder);
    QObject::connect(pFinder, SIGNAL(triggered()), m_pFinder, SLOT(Open()));
	//

	m_pSubWidget->setLayout(m_pSubLayout);

	m_pSplitter->addWidget(m_pSubWidget);

	m_pFileTabs = new QTabWidget();

	m_pSummary = new CFileSummary(Mode);
	m_pFileTabs->addTab(m_pSummary, tr("Summary"));

	m_pDetails = new CDetailsView(Mode);
	m_pFileTabs->addTab(m_pDetails, tr("Details"));

	//QMultiMap<int, SField> Settings;
	//SetupFile(Settings);
	//m_pSettings = new CFileSettingsView(Settings);
	//m_pFileTabs->addTab(m_pSettings, tr("Settings"));

	if(theGUI->Cfg()->GetInt("Gui/AdvancedControls"))
	{
		m_pTransfers = new CTransfersView(CTransfersView::eTransfers);
		m_pFileTabs->addTab(m_pTransfers, tr("Transfers"));
		connect(m_pTransfers, SIGNAL(OpenTransfer(uint64, uint64)), this, SLOT(OpenLog(uint64, uint64)));
	}
	else
		m_pTransfers = NULL;

	m_pSubFiles = new CFileListView(CFileListView::eSubFiles);
	m_pFileTabs->addTab(m_pSubFiles, tr("Sub Files"));

	m_pHosting = new CHostingView();
	m_pFileTabs->addTab(m_pHosting, tr("Hosting"));

	if(theGUI->Cfg()->GetInt("Gui/AdvancedControls"))
	{
		m_pTracker = new CTrackerView();
		m_pFileTabs->addTab(m_pTracker, tr("Tracker"));
	}
	else
		m_pTracker = NULL;
	
	m_pRating = new CRatingView();
	connect(m_pRating, SIGNAL(FindRating()), m_pFileList, SLOT(OnFindRating()));
	connect(m_pRating, SIGNAL(ClearRating()), m_pFileList, SLOT(OnClearRating()));
	m_pFileTabs->addTab(m_pRating, tr("Rating"));

	if(theGUI->Cfg()->GetInt("Gui/AdvancedControls") == 1)
	{
		m_pProperties = new CPropertiesView(true);
		m_pFileTabs->addTab(m_pProperties, tr("Properties"));
	}
	else
		m_pProperties = NULL;

	if(theGUI->Cfg()->GetBool("Gui/ShowLog"))
	{
		m_pLogView = new CLogView();
		m_pFileTabs->addTab(m_pLogView, tr("Log"));
	}
	else
		m_pLogView = NULL;

	// Make all additionaly added tabs closable - client log tab
	m_pFileTabs->setTabsClosable(true);
	QTabBar* pTabBar = m_pFileTabs->tabBar();
	m_TabOffset = m_pFileTabs->count();
	for(int i=0; i < m_TabOffset; i++)
		pTabBar->setTabButton(i,static_cast<QTabBar::ButtonPosition>(pTabBar->style()->styleHint(QStyle::SH_TabBar_CloseButtonPosition,  0, pTabBar)),0);

	connect(pTabBar, SIGNAL(tabCloseRequested(int)), this, SLOT(CloseLog(int)));

	m_pSplitter->addWidget(m_pFileTabs);

	m_pMainLayout->addWidget(m_pSplitter);
	m_pProgress = new QProgressBar();
	m_pProgress->setVisible(false);
	m_pProgress->setMinimum(0);
	m_pProgress->setMaximum(100);
	m_pMainLayout->addWidget(m_pProgress);

	setLayout(m_pMainLayout);

	connect(m_pFileTabs, SIGNAL(currentChanged(int)), this, SLOT(OnTab(int)));

	m_pSplitter->restoreState(theGUI->Cfg()->GetBlob("Gui/Widget_" + m_Ops + "_Spliter"));
	m_pFileTabs->setCurrentIndex(theGUI->Cfg()->GetSetting("Gui/Widget_" + m_Ops + "_Detail").toInt());

	m_TimerId = startTimer(1000);
}
开发者ID:0vermind,项目名称:NeoLoader,代码行数:101,代码来源:FileListWidget.cpp

示例5: dir


//.........这里部分代码省略.........
    connect(deleteProfilesButton, SIGNAL(clicked()), this, SLOT(deleteProfiles()));
    toolButtons.append(deleteProfilesButton);

    QToolButton* updateButton = new QToolButton(ui->mainToolBar);
    updateButton->setIcon(QIcon(":/img/cloud_down.svg"));
    updateButton->setText("Check for updates");
    updateButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
    ui->mainToolBar->addWidget(updateButton);
    connect(updateButton, SIGNAL(clicked()), this, SLOT(checkForUpdates()));
    toolButtons.append(updateButton);

    cancelWorkingThreads = false;

    connect(ui->mainToolBar, SIGNAL(orientationChanged(Qt::Orientation)), this, SLOT(toolBarOrientationChanged(Qt::Orientation)));
    connect(systemTrayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(systemTrayActivated(QSystemTrayIcon::ActivationReason)));
    connect(closeAction, SIGNAL(triggered()), qApp, SLOT(quit()));
    connect(ui->actionFolders, SIGNAL(triggered()), this, SLOT(showSettings()));
    connect(&networkAccessManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(statusXmlIsReady(QNetworkReply*)) );
    connect(&novaNetworkAccessManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(statusXmlIsReady(QNetworkReply*)) );
    connect(&clientFilesNetworkAccessManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(downloadFileFinished(QNetworkReply*)));
    connect(&requiredFilesNetworkManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(requiredFileDownloadFileFinished(QNetworkReply*)));
    connect(&patchesNetworkManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(patchesDownloadFileFinished(QNetworkReply*)));
    connect(ui->webView, SIGNAL(loadFinished(bool)), this, SLOT(webPageLoadFinished(bool)));
    connect(ui->pushButton_Start, SIGNAL(clicked()), this, SLOT(startSWG()));
    connect(fileScanner, SIGNAL(requiredFileExists(QString)), this, SLOT(updateBasicLoadProgress(QString)));
    connect(fileScanner, SIGNAL(fullScannedFile(QString, bool)), this, SLOT(updateFullScanProgress(QString, bool)));
    connect(this, SIGNAL(startDownload()), this, SLOT(startFileDownload()));
    connect(ui->actionLogin_Servers, SIGNAL(triggered()), loginServers, SLOT(show()));
    connect(ui->actionShow_news, SIGNAL(triggered()), this, SLOT(triggerNews()));
    connect(ui->checkBox_instances, SIGNAL(toggled(bool)), this, SLOT(triggerMultipleInstances(bool)));
    connect(ui->actionUpdate_Status, SIGNAL(triggered()), this, SLOT(updateServerStatus()));
    connect(ui->tabWidget, SIGNAL(tabCloseRequested(int)), this, SLOT(closeTab(int)));
    connect(ui->actionCheck_for_updates, SIGNAL(triggered()), this, SLOT(checkForUpdates()));
    connect(ui->actionGame_Settings, SIGNAL(triggered()), this, SLOT(startSWGSetup()));
    connect(ui->actionAbout, SIGNAL(triggered()), this, SLOT(showAboutDialog()));
    connect(ui->actionDelete_Profiles, SIGNAL(triggered()), this, SLOT(deleteProfiles()));
    connect(fileScanner, SIGNAL(addFileToDownload(QString)), this, SLOT(addFileToDownloadSlot(QString)));
    connect(ui->actionInstall_from_SWG, SIGNAL(triggered()), this, SLOT(installSWGEmu()));

    ui->groupBox_browser->hide();

    QTabBar* tabBar = ui->tabWidget->tabBar();
    tabBar->setTabButton(0, QTabBar::RightSide, 0);
    tabBar->setTabButton(0, QTabBar::LeftSide, 0);

    QSettings settingsOptions;

    QString swgFolder = settingsOptions.value("swg_folder").toString();
    bool multipleInstances = settingsOptions.value("multiple_instances").toBool();

    ui->checkBox_instances->setChecked(multipleInstances);
    ui->textBrowser->viewport()->setAutoFillBackground(false);
    ui->textBrowser->setAutoFillBackground(false);

    updateServerStatus();

    connect(&loadWatcher, SIGNAL(finished()), this, SLOT(loadFinished()));
    //connect(&fullScanWatcher, SIGNAL(finished()), this, SLOT(fullScanFinished()));
    connect(ui->pushButton_FullScan, SIGNAL(clicked()), this, SLOT(startFullScan()));

    loginServers->reloadServers();
    updateLoginServerList();

    silentSelfUpdater = new SelfUpdater(true, this);

    if (!swgFolder.isEmpty())
        startLoadBasicCheck();
    else {
#ifdef Q_OS_WIN32
        QDir dir("C:/SWGEmu");

        if (dir.exists() && FileScanner::checkSwgFolder("C:/SWGEmu")) {
            settingsOptions.setValue("swg_folder", "C:/SWGEmu");
            startLoadBasicCheck();
        } else
#endif
        QMessageBox::warning(this, "Error", "Please set the swgemu folder in Settings->Options or install using Settings->Select install folder option");
    }

    restoreGeometry(settingsOptions.value("mainWindowGeometry").toByteArray());
    restoreState(settingsOptions.value("mainWindowState").toByteArray());

    QString savedLogin = settingsOptions.value("selected_login_server", "").toString();

    if (!savedLogin.isEmpty()) {
        int idx = ui->comboBox_login->findText(savedLogin);

        if (idx >= 0) {
            ui->comboBox_login->setCurrentIndex(idx);
        }
    }

    requiredFilesNetworkManager.get(QNetworkRequest(QUrl(patchUrl + "required2.txt")));
    //patchesNetworkManager.get(QNetworkRequest(QUrl(patchUrl + "patches.txt")));
    silentSelfUpdater->silentCheck();

    //ui->webView->setUrl(newsUrl);

    //gameMods = new GameMods(this);
}
开发者ID:jwmclean,项目名称:Launchpad,代码行数:101,代码来源:mainwindow.cpp


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