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


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

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


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

示例1: notifyChangeName

void ModelObserver::notifyChangeName(const std::string &name)
{
	if(!node->isGroup())
		return;
	//{
		//int i = 0;
		QMap<QWidget *, SimulationTab*> tabs = node->getSimulation()->getTabs();

		QTabWidget* tabWidget = node->getSimulation()->getTabWidget();
		for (int i = 0; i < tabWidget->count(); i++) {
			if ( (DM::Module*) tabs[tabWidget->widget(i)]->getParentGroup() == node->getModule() )
				tabWidget->setTabText(i, QString::fromStdString(name));
		}

		/*foreach(SimulationTab* tab, tabs)
		{
			if(((DM::Module*)tab->getParentGroup()) == node->getModule())
				break;
			else
				i++;
		}
		if(i < tabs.size())
			node->getSimulation()->getTabWidget()->setTabText(i, QString::fromStdString(name));
			*/
	//}
}
开发者ID:iut-ibk,项目名称:DynaMind-ToolBox,代码行数:26,代码来源:modelobserver.cpp

示例2: closeFileRequest

void PluginTextEditor::closeFileRequest(QString file)
{
	QTabWidget *tabwidget = IPlatform::getInstance()->getWindowManager()->getWindow()->getTabWidget();
	for(int i = 0; i < tabwidget->count(); i++)
	{
		if(file.compare(tabwidget->tabText(i)) == 0)
		{
			if(tabwidget->tabText(i).compare(QString(tr("Welcome"))) == 0)
			{
				QWidget *widget = tabwidget->widget(i);
				tabwidget->removeTab(i);
				delete widget;
			}
			else
			{
				ProjectManager * projectmanager = IPlatform::getInstance()->getProjectManager();
				if(projectmanager->getProject())
				{
					projectmanager->closeFile(file);
				}
			}
			break;
		}
	}
}
开发者ID:swaechter,项目名称:cdevstudio,代码行数:25,代码来源:PluginTextEditor.cpp

示例3:

QWidget *QTabWidgetProto::widget(int index) const
{
  QTabWidget *item = qscriptvalue_cast<QTabWidget*>(thisObject());
  if (item)
    return item->widget(index);
  return 0;
}
开发者ID:,项目名称:,代码行数:7,代码来源:

示例4: configurate

void MainWindow::configurate()
{
    if(_paramDiag->exec()) {
        QTabWidget *qtw = _paramDiag->layerTabWidget;
        for(int i = 0; i<qtw->count(); ++i) {
            LayerParameters * ll = static_cast<LayerParameters*> (qtw->widget(i));
            qDebug("%f", ll->youngDoubleSpinBox->value());
        }
    }
}
开发者ID:BackupTheBerlios,项目名称:qtfin-svn,代码行数:10,代码来源:mainwindow.cpp

示例5: applyChanges

void DlgPreferencesImp::applyChanges()
{
    try {
        for (int i=0; i<ui->tabWidgetStack->count(); i++) {
            QTabWidget* tabWidget = (QTabWidget*)ui->tabWidgetStack->widget(i);
            for (int j=0; j<tabWidget->count(); j++) {
                QWidget* page = tabWidget->widget(j);
                int index = page->metaObject()->indexOfMethod("checkSettings()");
                try {
                    if (index >= 0) {
                        page->qt_metacall(QMetaObject::InvokeMetaMethod, index, 0);
                    }
                }
                catch (const Base::Exception& e) {
                    ui->listBox->setCurrentRow(i);
                    tabWidget->setCurrentIndex(j);
                    QMessageBox::warning(this, tr("Wrong parameter"), QString::fromAscii(e.what()));
                    throw;
                }
            }
        }
    } catch (const Base::Exception&) {
        this->invalidParameter = true;
        return;
    }

    for (int i=0; i<ui->tabWidgetStack->count(); i++) {
        QTabWidget* tabWidget = (QTabWidget*)ui->tabWidgetStack->widget(i);
        for (int j=0; j<tabWidget->count(); j++) {
            PreferencePage* page = qobject_cast<PreferencePage*>(tabWidget->widget(j));
            if (page)
                page->saveSettings();
        }
    }

    bool saveParameter = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/General")->
                          GetBool("SaveUserParameter", true);
    if (saveParameter) {
        ParameterManager* parmgr = App::GetApplication().GetParameterSet("User parameter");
        parmgr->SaveDocument(App::Application::Config()["UserParameter"].c_str());
    }
}
开发者ID:cpollard1001,项目名称:FreeCAD_sf_master,代码行数:42,代码来源:DlgPreferencesImp.cpp

示例6: closeFile

void PluginTextEditor::closeFile(QString file)
{
	QTabWidget *tabwidget = IPlatform::getInstance()->getWindowManager()->getWindow()->getTabWidget();
	for(int i = 0; i < tabwidget->count(); i++)
	{
		if(file.compare(tabwidget->tabText(i)) == 0)
		{
			QWidget *widget = tabwidget->widget(i);
			tabwidget->removeTab(i);
			delete widget;
		}
	}
}
开发者ID:swaechter,项目名称:cdevstudio,代码行数:13,代码来源:PluginTextEditor.cpp

示例7: WriteToLog

QWidget *TilesetItemBox::findTabWidget(const QString &categoryItem)
{
    #ifdef _DEBUG_
    WriteToLog(QtDebugMsg, "TilesetBox -> find Tab");
    #endif
    QTabWidget *cat = ui->TileSetsCategories;
    for(int i = 0; i < cat->count(); ++i)
    {
        if(cat->tabText(i) == categoryItem)
            return cat->widget(i);
    }
    return 0;
}
开发者ID:jpmac26,项目名称:PGE-Project,代码行数:13,代码来源:tileset_item_box.cpp

示例8: foreach

SelectorActionItem *VBoxSettingsToolBarSelector::findActionItemByTabWidget (QTabWidget* aTabWidget, int aIndex) const
{
    SelectorActionItem *result = NULL;
    foreach (SelectorItem *item, mItemList)
        if (static_cast<SelectorActionItem*> (item)->tabWidget() == aTabWidget)
        {
            QTabWidget *tw = static_cast<SelectorActionItem*> (item)->tabWidget();
            result = static_cast<SelectorActionItem*> (
                findItemByPage (static_cast<UISettingsPage*> (tw->widget (aIndex))));
            break;
        }

    return result;

}
开发者ID:jeppeter,项目名称:vbox,代码行数:15,代码来源:VBoxSettingsSelector.cpp

示例9: changeEvent

void Prefs::changeEvent(QEvent *e) {
    if (e->type() == QEvent::LanguageChange) {
        retranslateUi(this);
        // update the widgets' tabs
        for (int i=0; i<tabWidgetStack->count(); i++) {
            QTabWidget* tabWidget = (QTabWidget*)tabWidgetStack->widget(i);
            for (int j=0; j<tabWidget->count(); j++) {
                QWidget* page = tabWidget->widget(j);
                tabWidget->setTabText(j, page->windowTitle());
            }
        }
        // update the items' text
        for (int i=0; i<listBox->count(); i++) {
            QListWidgetItem *item = listBox->item(i);
            QByteArray group = item->data(Qt::UserRole).toByteArray();
            item->setText(QObject::tr(group.constData()));
        }
    } else {
        QWidget::changeEvent(e);
    }
}
开发者ID:bullet-physics-playground,项目名称:bpp,代码行数:21,代码来源:prefs.cpp

示例10: clearTilesetGroups

void TilesetItemBox::clearTilesetGroups()
{
    if(lockTilesetBox) return;

    QTabWidget *cat = ui->TileSetsCategories;
    int i = 0;
    int f = cat->count();
    while(f > i)
    {
        //include custom tab
        if(cat->tabText(i) == "Custom")
        {
            ++i;
            continue;
        }

        QWidget *acCat = cat->widget(i);
        cat->removeTab(i);
        delete acCat;
        f = cat->count();
    }
}
开发者ID:jpmac26,项目名称:PGE-Project,代码行数:22,代码来源:tileset_item_box.cpp

示例11: configurate

void Monofin::configurate()
{
    int nbLayers = _projectFile->getHowManyLayers();
    _paramDiag->setNbLayers(nbLayers);
    for (int i=0; i < nbLayers; ++i) {
        _paramDiag->updateLayerDensity(i, _projectFile->getLayerConfigRho(i));
        _paramDiag->updateLayerPoissonRatio(i, _projectFile->getLayerConfigPoisson(i));
        _paramDiag->updateLayerYoungModulus(i, _projectFile->getLayerConfigYoung(i));
    }
    if(_paramDiag->exec()) {
        QTabWidget *qtw = _paramDiag->layerTabWidget;
        if (qtw->count() > 0) {
            _projectFile->startHistory(Data::MonofinLayerConfig);
            for(int i = 0; i<qtw->count(); ++i) {
                LayerParameters * ll = static_cast<LayerParameters*> (qtw->widget(i));
                _projectFile->setLayerConfigPoisson(i, ll->poissonDoubleSpinBox->value());
                _projectFile->setLayerConfigRho(i, ll->densityDoubleSpinBox->value());
                _projectFile->setLayerConfigYoung(i, ll->youngDoubleSpinBox->value());
            }
            _projectFile->stopHistory(Data::MonofinLayerConfig);
        }
    }
}
开发者ID:BackupTheBerlios,项目名称:qtfin-svn,代码行数:23,代码来源:monofin.cpp

示例12: attach

bool FrameAttachmentPoint::attach(AttachableFrame* frame)
{
    QLayout* layout;
    QWidget* attWidget;
    QFrame* attFrame;
    QDockWidget* attDockWidget;
    QTabWidget* attTabWidget;
    QMainWindow* attMainWindow;
    int index = 0;

    if ((int)mAttachedFrames.size() >= mMaxAttachmentCount)
    {
        LOG_ERROR() << "FrameAttachmentPoint::attach(): cannot attach more than " << mMaxAttachmentCount <<
                       " Frame" << (mMaxAttachmentCount > 1 ? "s" : "") << " to Attachment Point " << mName << ".";
       return false;
    }

    //Attach the frame in a way depending on its type
    switch (mType)
    {
    case ATTACHMENT_NONE:
         LOG_ERROR() << "FrameAttachmentPoint::attach(): cannot attach to illegal Attachment Point.";
         return false;
        break;
    case ATTACHMENT_WIDGET:
        //Attach to Widget with adding a new layout
        layout = WindowManager::createNeutralLayout();
        layout->addWidget(&*frame);
        frame->show();
        attWidget = (dynamic_cast<QWidget*>(mAttachmentPoint));
        attWidget->setLayout(layout);
        attWidget->show();
        break;
    case ATTACHMENT_FRAME:
        //Attach to Frame with adding a new layout
        layout = WindowManager::createNeutralLayout();
        layout->addWidget(&*frame);
        frame->show();
        attFrame = (dynamic_cast<QFrame*>(mAttachmentPoint));
        attFrame->setLayout(layout);
        attFrame->show();
        break;
    case ATTACHMENT_TABWIDGET:
        //Attach to TabWidget with adding a new page and (automatically) a layout
        attTabWidget = (dynamic_cast<QTabWidget*>(mAttachmentPoint));
        index = attTabWidget->addTab(&*frame, frame->getCaption());
        WindowManager::changeToNeutralLayout(attTabWidget->widget(index)->layout());
        break;
    case ATTACHMENT_DOCKWIDGET:
        //Attach to DockWidget with adding a new layout
        layout = WindowManager::createNeutralLayout();
        layout->addWidget(&*frame);
        frame->show();
        attDockWidget = (dynamic_cast<QDockWidget*>(mAttachmentPoint));
        attDockWidget->setLayout(layout);
        attDockWidget->show();
        break;
    case ATTACHMENT_MAINWINDOW:
        //Attach to MainWindow with adding a new layout
        layout = WindowManager::createNeutralLayout();
        layout->addWidget(&*frame);
        frame->show();
        attMainWindow = (dynamic_cast<QMainWindow*>(mAttachmentPoint));
        attMainWindow->setLayout(layout);
        attMainWindow->show();
        break;
    default:
         LOG_ERROR() << "FrameAttachmentPoint::attach(): unknown Attachment Point.";
        return false;
        break;
    }

    //Store the attachment pointer
    mAttachedFrames.insert(frame->getPluginId(), frame);

    return true;
}
开发者ID:MadMaxPavlo,项目名称:SimSpark-SPL,代码行数:77,代码来源:frameattachmentpoint.cpp

示例13: makeSelectedTileset

void TilesetItemBox::makeSelectedTileset(int tabIndex)
{
    if(lockTilesetBox)
        return;

    QGraphicsScene *scene = NULL;

    LevelEdit *lvlEdit = mw()->activeLvlEditWin();
    WorldEdit *wldEdit = mw()->activeWldEditWin();

    if((lvlEdit) && (lvlEdit->sceneCreated))
        scene = lvlEdit->scene;
    else if((wldEdit) && (wldEdit->sceneCreated))
        scene = wldEdit->scene;

    QTabWidget *cat = ui->TileSetsCategories;
    if(!(cat->tabText(tabIndex) == "Custom"))
    {
        QWidget *current = cat->widget(tabIndex);
        if(!current)
            return;

        QString category = cat->tabText(tabIndex);

        #ifdef _DEBUG_
        DevConsole::log(QString("Category %1").arg(cat->tabText(cat->currentIndex())), "Debug");
        #endif

        QScrollArea *currentFrame   = getFrameTilesetOfTab(current);
        QComboBox   *currentCombo   = getGroupComboboxOfTab(current);
        if(!currentFrame || !currentCombo)
            return;

        QWidget *scrollWid = currentFrame->widget();
        if(!scrollWid)
            return;

        qDeleteAll(scrollWid->findChildren<QGroupBox *>());

        if(scrollWid->layout() == 0)
            scrollWid->setLayout(new FlowLayout());

        currentFrame->setWidgetResizable(true);

        #ifdef _DEBUG_
        DevConsole::log(QString("size %1 %2")
                        .arg(scrollWid->layout()->geometry().width())
                        .arg(scrollWid->layout()->geometry().height())
                        , "Debug");
        #endif

        QString currentGroup = currentCombo->currentText();
        for(int i = 0; i < mw()->configs.main_tilesets_grp.size(); i++)
        {
            if((mw()->configs.main_tilesets_grp[i].groupCat == category)
               && (mw()->configs.main_tilesets_grp[i].groupName == currentGroup)) //category
            {
                #ifdef _DEBUG_
                DevConsole::log(QString("Group %1").arg(configs.main_tilesets_grp[i].groupName), "Debug");
                DevConsole::log(QString("Tilesets %1").arg(configs.main_tilesets_grp[i].tilesets.size()), "Debug");
                #endif

                QStringList l = mw()->configs.main_tilesets_grp[i].tilesets;
                foreach(QString s, l)
                {
                    for(int j = 0; j < mw()->configs.main_tilesets.size(); j++)
                    {
                        if(s == mw()->configs.main_tilesets[j].fileName)
                        {
                            SimpleTileset &s = mw()->configs.main_tilesets[j];
                            QGroupBox *tilesetNameWrapper = new QGroupBox(s.tileSetName, scrollWid);
                            ((FlowLayout *)scrollWid->layout())->addWidget(tilesetNameWrapper);
                            QGridLayout *l = new QGridLayout(tilesetNameWrapper);
                            l->setContentsMargins(4, 4, 4, 4);
                            l->setSpacing(2);
                            for(int k = 0; k < s.items.size(); k++)
                            {
                                SimpleTilesetItem &item = s.items[k];
                                TilesetItemButton *tbutton = new TilesetItemButton(&mw()->configs, scene, tilesetNameWrapper);
                                tbutton->applySize(32, 32);
                                tbutton->applyItem(s.type, item.id);
                                l->addWidget(tbutton, item.row, item.col);
                                connect(tbutton, SIGNAL(clicked(int, ulong)), mw(), SLOT(SwitchPlacingItem(int, ulong)));
                            }
                            break;
                        }
                    }
                }
                break;
            }
        }
开发者ID:jpmac26,项目名称:PGE-Project,代码行数:91,代码来源:tileset_item_box.cpp

示例14: main

int main (int argc, char** argv)
{
    QApplication app(argc, argv);
    QWidget wgt;
    QStringList list;
    list << "1" << "2" << "3" <<"4";

    QTableWidget mytable(4, 5);
    QTableWidgetItem* pw = NULL;
    mytable.setHorizontalHeaderLabels(list);
    mytable.setVerticalHeaderLabels(list);

    QBrush br(Qt::BackgroundColorRole, Qt::NoBrush);


    for(int i(0);i < 4; i++)
        for(int j(0); j < 5; j++){
            pw = new QTableWidgetItem(QString("%10, %11").arg(i).arg(j));
            pw->setBackground(br);
            //pw->setBackgroundColor(QColor::black());
            //pw->setBackgroundColor(&c);
            mytable.setItem(i, j, pw);
        }
    QComboBox* box = new QComboBox;
    box->addItems(list);
    QString str ("111");
    QTabWidget tab;
//    foreach(QString str, list){
//        tab.addTab(new QLabel(str, &tab), str);
//    }
    QLabel* la = new QLabel(str, &tab);
    tab.addTab(la, QString("1"));
    tab.addTab(new QLineEdit, str);
    QToolBox * gg = new QToolBox;
    gg->addItem(new QLineEdit, QString("222"));


    QLabel* plblDisplay = new QLabel;

    plblDisplay->setFrameStyle(QFrame::Box | QFrame::Raised);
    plblDisplay->setLineWidth(5);
    plblDisplay->setFixedHeight(50);

    QLabel* plblText = new QLabel("&Text:");

    QLineEdit* text = new QLineEdit;

    text->setInputMask("0-(000)-000-00-00");
    QLineEdit* text3 = new QLineEdit;

    text3->setInputMask("0-(000)-000-00-00");
    tab.addTab(text3, QString("0-(000)-000-00-00"));
    QWidget::connect(tab.widget(0), SIGNAL(objectNameChanged(QString)),tab.widget(2), SLOT(setEnabled(bool)));




    QTextEdit* text2 = new QTextEdit;
    text2->setHtml("<html><div><center><h3>I wrote the HTML</h3></center></div></html>");
    MyHighlighter* pHighlighter = new MyHighlighter(text2->document());

    QLineEdit* ptxt = new QLineEdit;
    plblText->setBuddy(ptxt);

    QObject::connect(ptxt, SIGNAL(textChanged(const QString&)),
    plblDisplay, SLOT(setText(const QString&))
    );

    QObject::connect(text, SIGNAL(textChanged(const QString&)),
    plblDisplay, SLOT(setText(const QString&))
    );

    QObject::connect(text2, SIGNAL(windowTitleChanged(QString)),
    plblDisplay, SLOT(setText(const QString&))
    );

    QLabel* plblPassword = new QLabel("&Password:");

    QLineEdit* ptxtPassword = new QLineEdit;

    plblPassword->setBuddy(ptxtPassword);
    ptxtPassword->setEchoMode(QLineEdit::Password);
    ptxtPassword->setValidator(new QIntValidator);

    QObject::connect(ptxtPassword, SIGNAL(textChanged(const QString&)),
    plblDisplay, SLOT(setText(const QString&))
    );
    //Layout setup
    QVBoxLayout* pvbxLayout = new QVBoxLayout;

    pvbxLayout->addWidget(plblDisplay);
    pvbxLayout->addWidget(plblText);
    pvbxLayout->addWidget(ptxt);
    pvbxLayout->addWidget(plblPassword);
    pvbxLayout->addWidget(ptxtPassword);
    pvbxLayout->addWidget(text);
    pvbxLayout->addWidget(text2);
    pvbxLayout->addWidget(box);
    pvbxLayout->addWidget(&tab);
    pvbxLayout->addWidget(&mytable);
//.........这里部分代码省略.........
开发者ID:Xambey,项目名称:something,代码行数:101,代码来源:main.cpp

示例15: RebuildEditView

void AvatarEditor::RebuildEditView()
{
    if (!avatar_widget_)
        return;

    // Activate/deactivate export button based on whether export currently supported
    QPushButton *button = avatar_widget_->findChild<QPushButton *>("but_export");
    if (button)
        button->setEnabled(rexlogicmodule_->GetAvatarHandler()->AvatarExportSupported());

    QWidget* mat_panel = avatar_widget_->findChild<QWidget *>("panel_materials");
    QWidget* attachment_panel = avatar_widget_->findChild<QWidget *>("panel_attachments");
    if (!mat_panel || !attachment_panel)
        return;

    Scene::EntityPtr entity = rexlogicmodule_->GetAvatarHandler()->GetUserAvatar();
    if (!entity)
        return;
    EC_AvatarAppearance* appearance = entity->GetComponent<EC_AvatarAppearance>().get();
    if (!appearance)
        return;

    int width = 308-10;
    int tab_width = 302-10;
    int itemheight = 20;

    // Materials
    ClearPanel(mat_panel);
    const AvatarMaterialVector& materials = appearance->GetMaterials();
    mat_panel->resize(width, itemheight * (materials.size() + 1));

    for (uint y = 0; y < materials.size(); ++y)
    {
        QPushButton* button = new QPushButton("Change", mat_panel);
        button->setObjectName(QString::fromStdString(ToString<int>(y))); // Material index
        button->resize(50, 20);
        button->move(width - 50, y*itemheight);
        button->show();

        QObject::connect(button, SIGNAL(clicked()), this, SLOT(ChangeTexture()));
        // If there's a texture name, use it, because it is probably more understandable than material name
        std::string texname = materials[y].asset_.name_;
        if (materials[y].textures_.size())
            texname = materials[y].textures_[0].name_;

        QLabel* label = new QLabel(QString::fromStdString(texname), mat_panel);
        label->resize(200,20);
        label->move(0, y*itemheight);
        label->show();
    }

    // Attachments
    ClearPanel(attachment_panel);
    const AvatarAttachmentVector& attachments = appearance->GetAttachments();
    attachment_panel->resize(width, itemheight * (attachments.size() + 1));

    for (uint y = 0; y < attachments.size(); ++y)
    {
        QPushButton* button = new QPushButton("Remove", attachment_panel);
        button->setObjectName(QString::fromStdString(ToString<int>(y))); // Attachment index
        button->resize(50, 20);
        button->move(width - 50, y*itemheight);
        button->show();

        QObject::connect(button, SIGNAL(clicked()), this, SLOT(RemoveAttachment()));

        std::string attachment_name = attachments[y].name_;
        // Strip away .xml from the attachment name for slightly nicer display
        std::size_t pos = attachment_name.find(".xml");
        if (pos != std::string::npos)
            attachment_name = attachment_name.substr(0, pos);

        QLabel* label = new QLabel(QString::fromStdString(attachment_name), attachment_panel);
        label->resize(200,20);
        label->move(0, y*itemheight);
        label->show();
    }

    // Modifiers
    QTabWidget* tabs = avatar_widget_->findChild<QTabWidget *>("tab_appearance");
    if (!tabs)
        return;
    for (;;)
    {
        QWidget* tab = tabs->widget(0);
        if (!tab)
            break;
        tabs->removeTab(0);
        delete tab;
    }

    const MasterModifierVector& master_modifiers = appearance->GetMasterModifiers();
    // If no master modifiers, show the individual morph/bone controls
    if (!master_modifiers.size())
    {
        QWidget* morph_panel = GetOrCreateTabScrollArea(tabs, "Morphs");
        QWidget* bone_panel = GetOrCreateTabScrollArea(tabs, "Bones");
        if (!morph_panel || !bone_panel)
            return;

//.........这里部分代码省略.........
开发者ID:enne,项目名称:naali,代码行数:101,代码来源:AvatarEditor.cpp


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