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


C++ QTabWidget::setCurrentIndex方法代码示例

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


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

示例1: testCommentBox

void TestAnalysisTab::testCommentBox() {
    //Add yuc and 2 decoded videos
    QTabWidget* tabWidget = mw->findChildren<QTabWidget*>().first();
    tabWidget->setCurrentIndex(1);
    qApp->processEvents();
    QTest::qSleep(500);
    loadVideo(QFINDTESTDATA("blumeYuv420_planar_176x144.yuv"));
    //we skip pressing the "Add video" button and use the UndoStack instead
    GUI::AnalysisBoxContainer* boxCon = mw->findChildren<GUI::AnalysisBoxContainer*>().first();
    QVERIFY2(boxCon != NULL, "Could not find AnalysisBoxContainer");
    UndoRedo::AddVideo* addVideo = new UndoRedo::AddVideo(boxCon,QFINDTESTDATA("blume.mp4"));
    UndoRedo::UndoStack::getUndoStack().push(addVideo);
    QCoreApplication::processEvents();
    QTest::qSleep(2000);
    QCoreApplication::processEvents();
    addVideo = new UndoRedo::AddVideo(boxCon,QFINDTESTDATA("blume.mp4"));
    UndoRedo::UndoStack::getUndoStack().push(addVideo);
    QCoreApplication::processEvents();
    QTest::qSleep(2000);
    QCoreApplication::processEvents();
    QPlainTextEdit* lineEditBox1 = mw->findChildren<GUI::AnalysisBox*>().first()->findChildren<QPlainTextEdit*>().first();
    QPlainTextEdit* lineEditBox2 = mw->findChildren<GUI::AnalysisBox*>().at(1)->findChildren<QPlainTextEdit*>().first();

    tabWidget = mw->findChildren<GUI::AnalysisBox*>().first()->findChildren<QTabWidget*>().first();
    tabWidget->setCurrentIndex(1);
    qApp->processEvents();
    tabWidget = mw->findChildren<GUI::AnalysisBox*>().at(1)->findChildren<QTabWidget*>().first();
    tabWidget->setCurrentIndex(1);
    qApp->processEvents();
    lineEditBox1->selectAll();
    QApplication::postEvent(lineEditBox1,new QKeyEvent(QEvent::KeyPress,Qt::Key_A,Qt::NoModifier,"test 1"));
    TestMainWindow::waitForWindow(300);
    QVERIFY2(lineEditBox1->toPlainText() == "test 1", "Error writing comment");
    TestMainWindow::triggerAction("Undo");
    TestMainWindow::waitForWindow(300);
    QVERIFY2(lineEditBox1->toPlainText() != "test 1", "Error undoing the writing of a comment");
    TestMainWindow::triggerAction("Redo");
    TestMainWindow::waitForWindow(300);
    QVERIFY2(lineEditBox1->toPlainText() == "test 1", "Error redoing the writing of a comment");
    lineEditBox2->selectAll();
    QApplication::postEvent(lineEditBox2,new QKeyEvent(QEvent::KeyPress,Qt::Key_A,Qt::NoModifier,"test 2"));
    TestMainWindow::waitForWindow(300);
    QApplication::postEvent(lineEditBox1,new QKeyEvent(QEvent::KeyPress,Qt::Key_A,Qt::NoModifier,"continue writing"));
    TestMainWindow::waitForWindow(300);
    QApplication::postEvent(lineEditBox2,new QKeyEvent(QEvent::KeyPress,Qt::Key_A,Qt::NoModifier," more"));
    TestMainWindow::waitForWindow(300);
    QVERIFY2(lineEditBox1->toPlainText() == "test 1continue writing", "Error writing comment");
    QVERIFY2(lineEditBox2->toPlainText() == "test 2 more", "Error writing comment");
    TestMainWindow::triggerAction("Undo");
    TestMainWindow::waitForWindow(300);
    QVERIFY2(lineEditBox1->toPlainText() == "test 1continue writing", "Error writing comment");
    QVERIFY2(lineEditBox2->toPlainText() != "test 2 more", "Error undoing writing a comment");
    TestMainWindow::triggerAction("Redo");
    TestMainWindow::waitForWindow(300);
    QVERIFY2(lineEditBox1->toPlainText() == "test 1continue writing", "Error writing comment");
    QVERIFY2(lineEditBox2->toPlainText() == "test 2 more", "Error undoing writing a comment");
}
开发者ID:SuppenGeist,项目名称:pse-ws1516-videoencoder-ta,代码行数:57,代码来源:testanalysistab.cpp

示例2: setCurrentTab

void Tabs::setCurrentTab(int index, bool suppressSignals)
{
    QTabWidget *qtabwidget = static_cast<QTabWidget*>(getQWidget());
    bool oldSignalsState = qtabwidget->blockSignals(suppressSignals);
    qtabwidget->setCurrentIndex(index);
    qtabwidget->blockSignals(oldSignalsState);
}
开发者ID:fferri,项目名称:v_repExtCustomUI,代码行数:7,代码来源:Tabs.cpp

示例3: QVBoxLayout

void tst_QWidget_window::tst_recreateWindow_QTBUG40817()
{
    QTabWidget tab;

    QWidget *w = new QWidget;
    tab.addTab(w, "Tab1");
    QVBoxLayout *vl = new QVBoxLayout(w);
    QLabel *lbl = new QLabel("HELLO1");
    lbl->setObjectName("label1");
    vl->addWidget(lbl);
    w = new QWidget;
    tab.addTab(w, "Tab2");
    vl = new QVBoxLayout(w);
    lbl = new QLabel("HELLO2");
    lbl->setAttribute(Qt::WA_NativeWindow);
    lbl->setObjectName("label2");
    vl->addWidget(lbl);

    tab.show();

    QVERIFY(QTest::qWaitForWindowExposed(&tab));

    QWindow *win = tab.windowHandle();
    win->destroy();
    QWindowPrivate *p = qt_window_private(win);
    p->create(true);
    win->show();

    tab.setCurrentIndex(1);
}
开发者ID:Drakey83,项目名称:steamlink-sdk,代码行数:30,代码来源:tst_qwidget_window.cpp

示例4: setTabLogDiffVisible

void RevsView::setTabLogDiffVisible(bool b) {

	QStackedWidget* s = tab()->stackedPanes;
	QTabWidget* t = tab()->tabLogDiff;

	bool isTabPage = (s->currentIndex() == 0);
	int idx = (isTabPage ? t->currentIndex() : s->currentIndex());

	container->setUpdatesEnabled(false);

	if (b && !isTabPage) {

		t->addTab(tab()->textBrowserDesc, "Log");
		t->addTab(tab()->textEditDiff, "Diff");

		t->setCurrentIndex(idx - 1);
		s->setCurrentIndex(0);
	}
	if (!b && isTabPage) {

		s->addWidget(tab()->textBrowserDesc);
		s->addWidget(tab()->textEditDiff);

		// manually remove the two remaining empty pages
		t->removeTab(0); t->removeTab(0);

		s->setCurrentIndex(idx + 1);
	}
	container->setUpdatesEnabled(true);
}
开发者ID:abhijit86k,项目名称:QGit,代码行数:30,代码来源:revsview.cpp

示例5: testAddVideo

void TestAnalysisTab::testAddVideo() {
	QTabWidget* tabWidget = mw->findChildren<QTabWidget*>().first();
	tabWidget->setCurrentIndex(1);
	qApp->processEvents();
	QTest::qSleep(500);
	loadVideo(QFINDTESTDATA("blumeYuv420_planar_176x144.yuv"));
	//we skip pressing the "Add video" button and use the UndoStack instead
	GUI::AnalysisBoxContainer* boxCon = mw->findChildren<GUI::AnalysisBoxContainer*>().first();
	QVERIFY2(boxCon != NULL, "Could not find AnalysisBoxContainer");
	UndoRedo::AddVideo* addVideo = new UndoRedo::AddVideo(boxCon,QFINDTESTDATA("blume.mp4"));
	UndoRedo::UndoStack::getUndoStack().push(addVideo);
	QCoreApplication::processEvents();
	QTest::qSleep(2000);
	QCoreApplication::processEvents();
	QVERIFY2(mw->getMemento()->getAnalysisTabMemento()->getAnalysisBoxContainerMemento()->getAnalysisBoxList().size()
	         == 1,"Could not add video");
	//test UndoRedo
	TestMainWindow::triggerAction("Undo");
	QCoreApplication::processEvents();
	QTest::qSleep(2000);
	QVERIFY2(mw->getMemento()->getAnalysisTabMemento()->getAnalysisBoxContainerMemento()->getAnalysisBoxList().size()
	         == 0,"Could not undo the adding of a video");
	TestMainWindow::triggerAction("Redo");
	QCoreApplication::processEvents();
	QTest::qSleep(2000);
	QVERIFY2(mw->getMemento()->getAnalysisTabMemento()->getAnalysisBoxContainerMemento()->getAnalysisBoxList().size()
	         == 1,"Could not redo the adding of a video");
}
开发者ID:SuppenGeist,项目名称:pse-ws1516-videoencoder-ta,代码行数:28,代码来源:testanalysistab.cpp

示例6: QDialog

PreferencesDialog::PreferencesDialog(QWidget* parent)
    : QDialog(parent)
{
    this->setWindowTitle(tr("Preferences"));
    appSettings = AppSettings::getInstance();

    QTabWidget* tabWidget = new QTabWidget(this);

    QVBoxLayout* layout = new QVBoxLayout();
    layout->addWidget(tabWidget);
    this->setLayout(layout);

    tabWidget->addTab(initializeGeneralTab(), tr("General"));
    tabWidget->addTab(initializeEditorTab(), tr("Editor"));
    tabWidget->addTab(initializeSpellCheckTab(), tr("Spell Check"));
    tabWidget->addTab(initializeHudTab(), tr("HUD"));

    QDialogButtonBox* buttonBox = new QDialogButtonBox(Qt::Horizontal, this);
    buttonBox->addButton(QDialogButtonBox::Close);
    layout->addWidget(buttonBox);

    connect(buttonBox->button(QDialogButtonBox::Close), SIGNAL(clicked()), this, SLOT(close()));

    tabWidget->setCurrentIndex(0);
}
开发者ID:cubells,项目名称:ghostwriter,代码行数:25,代码来源:PreferencesDialog.cpp

示例7: newPrivateConvo

/**
 * Called when double-clicking a contact in the contact list.
 * Creates a new conversation with a new id, and a new tab.
 * @brief MainWindow::newPrivateConvo
 */
void MainWindow::newPrivateConvo()
{
    QString pConvo(ui->lstContacts->selectedItems().at(0)->data(Qt::DisplayRole).toString());
    QTabWidget* grp = ui->tabgrpConversations;

    QStringList t = pConvo.split("/", QString::SkipEmptyParts);
    createTab(QString::number(QDateTime::currentMSecsSinceEpoch()), t.at(1), t.at(0));

    //Set selected tab to newly created
    grp->setCurrentIndex(grp->count()-1);
}
开发者ID:s176251,项目名称:cpp_prosjekt_2014,代码行数:16,代码来源:mainwindow.cpp

示例8: activateGroupPage

/**
 * Activates the page at position \a index of the group with name \a group.
 */
void DlgPreferencesImp::activateGroupPage(const QString& group, int index)
{
    int ct = ui->listBox->count();
    for (int i=0; i<ct; i++) {
        QListWidgetItem* item = ui->listBox->item(i);
        if (item->data(Qt::UserRole).toString() == group) {
            ui->listBox->setCurrentItem(item);
            QTabWidget* tabWidget = (QTabWidget*)ui->tabWidgetStack->widget(i);
            tabWidget->setCurrentIndex(index);
            break;
        }
    }
}
开发者ID:cpollard1001,项目名称:FreeCAD_sf_master,代码行数:16,代码来源:DlgPreferencesImp.cpp

示例9: activateGroupPage

void Prefs::activateGroupPage(QString group, int index) {
    int ct = listBox->count();

    for (int i = 0; i < ct; i++) {
        QListWidgetItem* item = listBox->item(i);
        if (item->data(Qt::UserRole).toString() == group) {
            listBox->setCurrentItem(item);
            QTabWidget* tabWidget = (QTabWidget*)tabWidgetStack->widget(i);
            tabWidget->setCurrentIndex(index);
            break;
        }
    }
}
开发者ID:bullet-physics-playground,项目名称:bpp,代码行数:13,代码来源:prefs.cpp

示例10:

void UHMM3PhmmerDialogFiller::commonScenario(){
    QWidget *dialog = QApplication::activeModalWidget();
    GT_CHECK(dialog != NULL, "dialog not found");

    GTGlobals::sleep(1000);
    QTabWidget* tabWidget = GTWidget::findExactWidget<QTabWidget*>(os, "mainTabWidget", dialog);

    tabWidget->setCurrentIndex(0);
    QLineEdit* queryLineEdit = GTWidget::findExactWidget<QLineEdit*>(os, "queryLineEdit", dialog);
    GTLineEdit::setText(os, queryLineEdit, input);

    GTUtilsDialog::clickButtonBox(os, dialog, QDialogButtonBox::Ok);
}
开发者ID:ggrekhov,项目名称:ugene,代码行数:13,代码来源:UHMM3PhmmerDialogFiller.cpp

示例11: testSwitchTab

void TestMainWindow::testSwitchTab() {

	std::unique_ptr<Memento::MainWindowMemento> oldMemo = mw->getMemento();
	QTest::qSleep(500);
	//the tab widget we need is always the first as the search is recursiv
	QTabWidget* tabWidget = mw->findChildren<QTabWidget*>().first();
	tabWidget->setCurrentIndex(1);
	qApp->processEvents();
	QTest::qSleep(500);
	std::unique_ptr<Memento::MainWindowMemento> newMemo = mw ->getMemento();
	QVERIFY(oldMemo->getSelectedTab() != newMemo->getSelectedTab());

}
开发者ID:SuppenGeist,项目名称:pse-ws1516-videoencoder-ta,代码行数:13,代码来源:testmainwindow.cpp

示例12: testCrazyMonkeyClicks

void TestMainWindow::testCrazyMonkeyClicks() {
    clickButton("Apply to video");
    clickButton("Filter up");
    clickButton("Apply to video");
    clickButton("Filter down");
    clickButton("Save configuration");
    clickButton("Add Edge filter");
    QTabWidget* tabWidget = mw->findChildren<QTabWidget*>().first();
    tabWidget->setCurrentIndex(1);
    clickButton("PSNR");
    clickButton("Bitrate");
    clickButton("Red histogram");
    TestAnalysisTab::loadVideo(QFINDTESTDATA("blumeYuv420_planar_176x144.yuv"));
    clickButton("PSNR");
    clickButton("Bitrate");
    clickButton("Red histogram");
    tabWidget->setCurrentIndex(0);
    clickButton("Remove filter");
    clickButton("Save configuration");
    clickButton("Add Contrast filter");
    TestFilterTab::loadVideo(QFINDTESTDATA("blumeYuv420_planar_176x144.yuv"));
    clickButton("Add Vintage filter");
    clickButton("Apply to video");
    triggerAction("Redo");
    triggerAction("Redo");
    triggerAction("Redo");
    clickButton("Add Vintage filter");
    triggerAction("Redo");
    triggerAction("Undo");
    tabWidget->setCurrentIndex(1);
    triggerAction("New");
    clickButton("Add video");





}
开发者ID:SuppenGeist,项目名称:pse-ws1516-videoencoder-ta,代码行数:38,代码来源:testmainwindow.cpp

示例13: testGraphs

void TestAnalysisTab::testGraphs() {
	//Add yuc and decoded video
	QTabWidget* tabWidget = mw->findChildren<QTabWidget*>().first();
	tabWidget->setCurrentIndex(1);
	qApp->processEvents();
	QTest::qSleep(500);
	loadVideo(QFINDTESTDATA("blumeYuv420_planar_176x144.yuv"));
	//we skip pressing the "Add video" button and use the UndoStack instead
	GUI::AnalysisBoxContainer* boxCon = mw->findChildren<GUI::AnalysisBoxContainer*>().first();
	QVERIFY2(boxCon != NULL, "Could not find AnalysisBoxContainer");
	UndoRedo::AddVideo* addVideo = new UndoRedo::AddVideo(boxCon,QFINDTESTDATA("blume.mp4"));
	UndoRedo::UndoStack::getUndoStack().push(addVideo);
	QCoreApplication::processEvents();
	QTest::qSleep(2000);
	QCoreApplication::processEvents();

	TestMainWindow::clickButton("Red histogram");
	QTest::qSleep(1000);
	//raw vid
	QVERIFY2(qGray(mw->grab().toImage().pixel(600,110))==255 , "Failed clicking Red histogramm");
	QVERIFY2(qGray(mw->grab().toImage().pixel(360,250))!=255 , "Failed clicking Red histogramm");
	QVERIFY2(qGray(mw->grab().toImage().pixel(525,260))==255 , "Failed clicking Red histogramm");
	//encoded vid
	QVERIFY2(qGray(mw->grab().toImage().pixel(570,500))==255 , "Failed clicking Red histogramm");
	QVERIFY2(qGray(mw->grab().toImage().pixel(330,600))!=255 , "Failed clicking Red histogramm");
	QVERIFY2(qGray(mw->grab().toImage().pixel(470,600))==255 , "Failed clicking Red histogramm");

	TestMainWindow::clickButton("Green histogram");
	QTest::qSleep(1000);
	//raw vid
	QVERIFY2(qGray(mw->grab().toImage().pixel(600,110))==255 , "Failed clicking Green histogramm");
	QVERIFY2(qGray(mw->grab().toImage().pixel(360,250))!=255 , "Failed clicking Green histogramm");
	QVERIFY2(qGray(mw->grab().toImage().pixel(525,260))!=255 , "Failed clicking Green histogramm");
	//encoded vid
	QVERIFY2(qGray(mw->grab().toImage().pixel(570,500))==255 , "Failed clicking Green histogramm");
	QVERIFY2(qGray(mw->grab().toImage().pixel(330,600))!=255 , "Failed clicking Green histogramm");
	QVERIFY2(qGray(mw->grab().toImage().pixel(470,630))!=255 , "Failed clicking Green histogramm");

	TestMainWindow::clickButton("Blue histogram");
	QTest::qSleep(1000);
	//raw vid
	QVERIFY2(qGray(mw->grab().toImage().pixel(600,110))==255 , "Failed clicking Green histogramm");
	QVERIFY2(qGray(mw->grab().toImage().pixel(340,250))!=255 , "Failed clicking Green histogramm");
	QVERIFY2(qGray(mw->grab().toImage().pixel(525,260))==255 , "Failed clicking Green histogramm");
	//encoded vid
	QVERIFY2(qGray(mw->grab().toImage().pixel(550,500))==255 , "Failed clicking Green histogramm");
	QVERIFY2(qGray(mw->grab().toImage().pixel(345,600))!=255 , "Failed clicking Green histogramm");
	QVERIFY2(qGray(mw->grab().toImage().pixel(470,600))==255 , "Failed clicking Green histogramm");
}
开发者ID:SuppenGeist,项目名称:pse-ws1516-videoencoder-ta,代码行数:49,代码来源:testanalysistab.cpp

示例14: getMainWindow

GUI::MainWindow* TestMainWindow::getMainWindow() {
	if(mainWindow) {
        triggerAction("New");
        QTabWidget* tabWidget = mainWindow->findChildren<QTabWidget*>().first();
        tabWidget->setCurrentIndex(0);
		qApp->processEvents();
	} else {
		mainWindow = new GUI::MainWindow();
		originMemento = mainWindow->getMemento();
		mainWindow->show();
		QTest::qWaitForWindowActive(mainWindow);
	}
    waitForWindow(300);
	return mainWindow;
}
开发者ID:SuppenGeist,项目名称:pse-ws1516-videoencoder-ta,代码行数:15,代码来源:testmainwindow.cpp

示例15: toggleDiffView

void RevsView::toggleDiffView() {

	QStackedWidget* s = tab()->stackedPanes;
	QTabWidget* t = tab()->tabLogDiff;

	bool isTabPage = (s->currentIndex() == 0);
	int idx = (isTabPage ? t->currentIndex() : s->currentIndex());

	bool old = container->updatesEnabled();
	container->setUpdatesEnabled(false);

	if (isTabPage)
		t->setCurrentIndex(1 - idx);
	else
		s->setCurrentIndex(3 - idx);

	container->setUpdatesEnabled(old);
}
开发者ID:abhijit86k,项目名称:QGit,代码行数:18,代码来源:revsview.cpp


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