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


C++ TabWidget::addTab方法代码示例

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


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

示例1: setMainPage

void MainPage::setMainPage(){
    Wt::WHBoxLayout *mainLayout = new Wt::WHBoxLayout();
    root()->setLayout(mainLayout);
    mainLayout->setContentsMargins(0, 10, 0, 0);
    mainLayout->setSpacing(0);


    Wt::WStackedWidget *contents = new Wt::WStackedWidget(0);
    contents->setOverflow(WContainerWidget::OverflowAuto);    
    contents->setStyleClass("contentsp");
    contents->setPositionScheme(Relative); // without needs testing on IE...

    // create a menu
    Wt::WMenu *menu = new Wt::WMenu(contents, Wt::Vertical, 0);
    menu->setRenderAsList(true);
    menu->addStyleClass("menu");

    mainLayout->addWidget(menu);
    mainLayout->addWidget(contents,1);
    mainLayout->addWidget(new Notification());    

    TabWidget *ftp = new TabWidget();
    ftp->addTab("General options", new Wt::WText("Not yet available"));
    ftp->addTab("Users management", new FtpUserController());

    TabWidget *samba = new TabWidget();
    samba->addTab("General options", new Wt::WText("Not yet available"));
    samba->addTab("More options", new Wt::WText("Not yet available"));

    menu->addItem("FTP", ftp);
    menu->addItem("Samba", samba);



    std::vector<WWidget*>::const_iterator a;

    for(a = root()->children().begin();
        a < (root()->children().end());
        a++){        

        if (dynamic_cast<WText*>(*a) != NULL)
          {
            std::cout << dynamic_cast<WText*>(*a)->text() << std::endl;
          }
    }

}
开发者ID:jlesquembre,项目名称:remote-admin,代码行数:47,代码来源:MainPage.cpp

示例2: main

int main(int argc, char *argv[])
{
    QApplication app(argc, argv);

    QWidget *widget1 = new QWidget;
    QVBoxLayout *layout1 = new QVBoxLayout(widget1);
    layout1->addWidget(new QLabel("Inform"));

    QWidget *widget2 = new QWidget;
    QVBoxLayout *layout2 = new QVBoxLayout(widget2);
    layout2->addWidget(new QLabel("Switch"));

    TabWidget tabWidget;
    tabWidget.addTab(widget1, QIcon(":/current_inform"), "");
    tabWidget.addTab(widget2, QIcon(":/switch"), "");
    tabWidget.show();

    return app.exec();
}
开发者ID:WarmLights,项目名称:QtLab,代码行数:19,代码来源:main.cpp

示例3: AddWorkTab

void WorkTabMgr::AddWorkTab(WorkTab *tab, MainWindow *window, QString label)
{
    window->closeHomeTab();

    m_workTabs.insert(tab->getId(), tab);

    TabWidget *activeWidget = window->getTabView()->getActiveWidget();

    tab->setParent(activeWidget);
    tab->setWindowId(window->getId());
    activeWidget->addTab(tab, label, tab->getId());
    activeWidget->setTabsClosable(true);
    return;
}
开发者ID:Tasssadar,项目名称:Lorris,代码行数:14,代码来源:WorkTabMgr.cpp

示例4: QMainWindow

//================================================================
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    TabWidget * tw = new TabWidget(this) ;
    tw->setGeometry(0,60,tw->geometry().width(), tw->geometry().height()) ;

    FormPage1 * f1 = new FormPage1(tw) ; f1->setLabelText(QString("Pippo"));
    FormPage1 * f2 = new FormPage1(tw) ; f2->setLabelText(QString("Pluto"));

    tw->addTab((QWidget*)f1,QString("FormPage1")) ;
    tw->addTab((QWidget*)f2,QString("FormPage2")) ;

}
开发者ID:sakamoto-poteko,项目名称:Monicelli,代码行数:17,代码来源:mainwindow.cpp

示例5: openSession

void SessionManager::openSession(ServerEntry *serverEntry)
{
    // Add ServerEntry to the list.
    if (!sessions.contains(serverEntry)) {
        sessions.insert(serverEntry);

        TabWidget *tabWidget = TabWidget::getInstance();
        GameEntry gameEntry = GameManager::getGame(serverEntry->getGameType());
        GameWidget *gameWidget = SessionManager::getGameWidget(serverEntry);

        int index = tabWidget->addTab(gameWidget, QIcon(gameEntry.getIcon()), serverEntry->getName());
        tabWidget->setTabToolTip(index, QString("%1:%2").arg(serverEntry->getHost()).arg(serverEntry->getPort()));
        tabWidget->setCurrentIndex(index);

        emit (onSessionOpened());
    } else {
        qDebug() << tr("Already connected to this server.");
    }
}
开发者ID:OpenRcon,项目名称:OpenRcon,代码行数:19,代码来源:SessionManager.cpp

示例6: join

/*!
 * \deprecated Начиная с версии 2.0.6 нет необходимости отправлять запрос на вход в обычный канал,
 * т.к. сервер теперь делает это автоматически без запроса от клиента.
 */
void StateCache::join(const QByteArray &id)
{
  TabWidget *tabs = TabWidget::i();

  if (SimpleID::typeOf(id) == SimpleID::ServerId) {
    ServerTab *serverTab = tabs->serverTab();
    if (tabs->indexOf(serverTab) == -1) {
      tabs->addTab(serverTab, QString());
      serverTab->setOnline();
      serverTab->setText(ChatClient::serverName());
    }

    serverTab->pin();
    return;
  }

  ChannelBaseTab *tab = tabs->channelTab(id, true, false);
  if (tab && !(tab->options() & AbstractTab::Pinned))
    tab->pin();

  if (!tab || SimpleID::typeOf(id) == SimpleID::ChannelId)
    ChatClient::channels()->join(id);
}
开发者ID:Artanomell,项目名称:schat,代码行数:27,代码来源:StateCache.cpp

示例7: ButtonWidget

GlobalOptionsDialog::GlobalOptionsDialog()
	: OptionsDialog(Common::ConfigManager::kApplicationDomain, "globaloptions") {

	// The tab widget
	TabWidget *tab = new TabWidget(this, "globaloptions_tabwidget");
	tab->setHints(THEME_HINT_FIRST_DRAW | THEME_HINT_SAVE_BACKGROUND);

	//
	// 1) The graphics tab
	//
	tab->addTab("Graphics");
	addGraphicControls(tab, "globaloptions_");

	//
	// 2) The audio tab
	//
	tab->addTab("Audio");
	addAudioControls(tab, "globaloptions_");

	int volControlPos = g_gui.evaluator()->getVar("volumeControlsInAudio", true);

	if (volControlPos)
		addVolumeControls(tab, "globaloptions_");

	addSubtitleControls(tab, "globaloptions_");

	if (!volControlPos) {
		tab->addTab("Volume");
		addVolumeControls(tab, "globaloptions_");
	}

	// TODO: cd drive setting

	//
	// 3) The MIDI tab
	//
	tab->addTab("MIDI");
	addMIDIControls(tab, "globaloptions_");

	//
	// 4) The miscellaneous tab
	//
	tab->addTab("Paths");

#if !( defined(__DC__) || defined(__GP32__) )
	// These two buttons have to be extra wide, or the text will be
	// truncated in the small version of the GUI.

	// Save game path
	new ButtonWidget(tab, "globaloptions_savebutton", "Save Path: ", kChooseSaveDirCmd, 0);
	_savePath = new StaticTextWidget(tab, "globaloptions_savepath", "/foo/bar");

	new ButtonWidget(tab, "globaloptions_themebutton", "Theme Path:", kChooseThemeDirCmd, 0);
	_themePath = new StaticTextWidget(tab, "globaloptions_themepath", "None");

	new ButtonWidget(tab, "globaloptions_extrabutton", "Extra Path:", kChooseExtraDirCmd, 0);
	_extraPath = new StaticTextWidget(tab, "globaloptions_extrapath", "None");
#endif

#ifdef SMALL_SCREEN_DEVICE
	new ButtonWidget(tab, "globaloptions_keysbutton", "Keys", kChooseKeyMappingCmd, 0);
#endif

	// TODO: joystick setting


	// Activate the first tab
	tab->setActiveTab(0);

	// Add OK & Cancel buttons
	new ButtonWidget(this, "globaloptions_cancel", "Cancel", kCloseCmd, 0);
	new ButtonWidget(this, "globaloptions_ok", "OK", kOKCmd, 0);

#ifdef SMALL_SCREEN_DEVICE
	_keysDialog = new KeysDialog();
#endif
}
开发者ID:iPodLinux-Community,项目名称:iScummVM,代码行数:77,代码来源:options.cpp

示例8: gameId

EditGameDialog::EditGameDialog(const String &domain, const String &desc)
	: OptionsDialog(domain, "GameOptions") {
	// Retrieve all game specific options.
	const EnginePlugin *plugin = 0;
	// To allow for game domains without a gameid.
	// TODO: Is it intentional that this is still supported?
	String gameId(ConfMan.get("gameid", domain));
	if (gameId.empty())
		gameId = domain;
	// Retrieve the plugin, since we need to access the engine's MetaEngine
	// implementation.
	EngineMan.findGame(gameId, &plugin);
	if (plugin) {
		_engineOptions = (*plugin)->getExtraGuiOptions(domain);
	} else {
		warning("Plugin for target \"%s\" not found! Game specific settings might be missing", domain.c_str());
	}

	// GAME: Path to game data (r/o), extra data (r/o), and save data (r/w)
	String gamePath(ConfMan.get("path", _domain));
	String extraPath(ConfMan.get("extrapath", _domain));
	String savePath(ConfMan.get("savepath", _domain));

	// GAME: Determine the description string
	String description(ConfMan.get("description", domain));
	if (description.empty() && !desc.empty()) {
		description = desc;
	}

	// GUI:  Add tab widget
	TabWidget *tab = new TabWidget(this, "GameOptions.TabWidget");

	//
	// 1) The game tab
	//
	tab->addTab(_("Game"));

	// GUI:  Label & edit widget for the game ID
	if (g_system->getOverlayWidth() > 320)
		new StaticTextWidget(tab, "GameOptions_Game.Id", _("ID:"), _("Short game identifier used for referring to saved games and running the game from the command line"));
	else
		new StaticTextWidget(tab, "GameOptions_Game.Id", _c("ID:", "lowres"), _("Short game identifier used for referring to saved games and running the game from the command line"));
	_domainWidget = new DomainEditTextWidget(tab, "GameOptions_Game.Domain", _domain, _("Short game identifier used for referring to saved games and running the game from the command line"));

	// GUI:  Label & edit widget for the description
	if (g_system->getOverlayWidth() > 320)
		new StaticTextWidget(tab, "GameOptions_Game.Name", _("Name:"), _("Full title of the game"));
	else
		new StaticTextWidget(tab, "GameOptions_Game.Name", _c("Name:", "lowres"), _("Full title of the game"));
	_descriptionWidget = new EditTextWidget(tab, "GameOptions_Game.Desc", description, _("Full title of the game"));

	// Language popup
	_langPopUpDesc = new StaticTextWidget(tab, "GameOptions_Game.LangPopupDesc", _("Language:"), _("Language of the game. This will not turn your Spanish game version into English"));
	_langPopUp = new PopUpWidget(tab, "GameOptions_Game.LangPopup", _("Language of the game. This will not turn your Spanish game version into English"));
	_langPopUp->appendEntry(_("<default>"), (uint32)Common::UNK_LANG);
	_langPopUp->appendEntry("", (uint32)Common::UNK_LANG);
	const Common::LanguageDescription *l = Common::g_languages;
	for (; l->code; ++l) {
		if (checkGameGUIOptionLanguage(l->id, _guioptionsString))
			_langPopUp->appendEntry(l->description, l->id);
	}

	// Platform popup
	if (g_system->getOverlayWidth() > 320)
		_platformPopUpDesc = new StaticTextWidget(tab, "GameOptions_Game.PlatformPopupDesc", _("Platform:"), _("Platform the game was originally designed for"));
	else
		_platformPopUpDesc = new StaticTextWidget(tab, "GameOptions_Game.PlatformPopupDesc", _c("Platform:", "lowres"), _("Platform the game was originally designed for"));
	_platformPopUp = new PopUpWidget(tab, "GameOptions_Game.PlatformPopup", _("Platform the game was originally designed for"));
	_platformPopUp->appendEntry(_("<default>"));
	_platformPopUp->appendEntry("");
	const Common::PlatformDescription *p = Common::g_platforms;
	for (; p->code; ++p) {
		_platformPopUp->appendEntry(p->description, p->id);
	}

	//
	// 2) The engine tab (shown only if there are custom engine options)
	//
	if (_engineOptions.size() > 0) {
		tab->addTab(_("Engine"));

		addEngineControls(tab, "GameOptions_Engine.", _engineOptions);
	}

	//
	// 3) The graphics tab
	//
	_graphicsTabId = tab->addTab(g_system->getOverlayWidth() > 320 ? _("Graphics") : _("GFX"));

	if (g_system->getOverlayWidth() > 320)
		_globalGraphicsOverride = new CheckboxWidget(tab, "GameOptions_Graphics.EnableTabCheckbox", _("Override global graphic settings"), 0, kCmdGlobalGraphicsOverride);
	else
		_globalGraphicsOverride = new CheckboxWidget(tab, "GameOptions_Graphics.EnableTabCheckbox", _c("Override global graphic settings", "lowres"), 0, kCmdGlobalGraphicsOverride);

	addGraphicControls(tab, "GameOptions_Graphics.");

	//
	// 4) The audio tab
	//
	tab->addTab(_("Audio"));
//.........这里部分代码省略.........
开发者ID:Tkachov,项目名称:scummvm,代码行数:101,代码来源:editgamedialog.cpp


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