本文整理汇总了C++中QTabWidget::count方法的典型用法代码示例。如果您正苦于以下问题:C++ QTabWidget::count方法的具体用法?C++ QTabWidget::count怎么用?C++ QTabWidget::count使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QTabWidget
的用法示例。
在下文中一共展示了QTabWidget::count方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createMsgWindow
void SUiClient::createMsgWindow(QString ID, QString protoName)
{
SMsgWnd *messageWindow = new SMsgWnd();
connect(messageWindow, SIGNAL(debug(QString)), this, SIGNAL(debug(QString)));
messageWindow->Init(ID, protoName, 0);
registerUi(messageWindow);
connect(this, SIGNAL(windowCreated()), this, SLOT(showAllWindows()));
Ui::msgTabs msgTabs;
QWidget *tabWindow = new QWidget();
msgTabs.setupUi(tabWindow);
QTabWidget *tabs = tabWindow->findChild<QTabWidget *>("tabs");
if(!tabs)
emit debug("can't find tabs");
tabs->clear();
tabs->addTab(messageWindow->getUi(), "msg");
emit debug("tabs->count() == " + QString::number(tabs->count()));
emit createWidget(SMsgWndProto, messageWindow->protoWidg, protoName);
emit createWidget(SMsgWndUserInfo, messageWindow->userWidg, protoName);
// emit createWidget(SMsgBtns, messageWindow->msgWidg, protoName);
m_windows.append(tabWindow);
// emit windowCreated();
}
示例2: 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));
*/
//}
}
示例3: tabCount
int ScriptToolbox::tabCount(QWidget * tab)
{
QTabWidget *tw = qobject_cast<QTabWidget*>(tab);
if(tw)
return tw->count();
return 0;
}
示例4: count
int QTabWidgetProto::count() const
{
QTabWidget *item = qscriptvalue_cast<QTabWidget*>(thisObject());
if (item)
return item->count();
return 0;
}
示例5:
void GCF::Components::MainWindow::removeChildWidget(QWidget* parent, QWidget* child)
{
if(!parent || !child)
return;
if(parent == d->workspace)
{
d->workspace->removeTab(d->workspace->indexOf(child));
child->removeEventFilter(this);
}
else
{
QList<QDockWidget*> dockWidgets = d->dockWidgetMap.values();
QDockWidget* dw = qobject_cast<QDockWidget*>(parent);
if(dw && dockWidgets.contains(dw))
{
QTabWidget* tw = qobject_cast<QTabWidget*>(dw->widget());
tw->removeTab(tw->indexOf(child));
if(tw->count())
dw->show();
else
dw->hide();
}
}
}
示例6: 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;
}
}
}
示例7: workspaceWidgetActivated
void GCF::Components::MainWindow::addChildWidget(QWidget* parent, QWidget* child)
{
if(!parent || !child)
return;
if(parent == d->workspace)
{
d->workspace->addTab(child, child->windowTitle());
child->installEventFilter(this);
child->setAutoFillBackground(true);
emit workspaceWidgetActivated(d->workspace->currentWidget());
}
else
{
QList<QDockWidget*> dockWidgets = d->dockWidgetMap.values();
QDockWidget* dw = qobject_cast<QDockWidget*>(parent);
if(dw && dockWidgets.contains(dw))
{
QTabWidget* tw = qobject_cast<QTabWidget*>(dw->widget());
tw->addTab(child, child->windowTitle());
child->setAutoFillBackground(true);
if(tw->count())
dw->show();
else
dw->hide();
}
}
}
示例8: 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());
}
}
}
示例9: 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());
}
}
示例10: 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);
}
示例11: 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();
}
}
示例12: 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;
}
}
}
示例13: 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;
}
示例14: 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);
}
}
}
示例15: QMainWindow
CMainWindow::CMainWindow(QWidget* parent)
: QMainWindow(parent)
{
setMinimumSize(900, 825);
QTabWidget* tabs = new QTabWidget();
CBlockEditorTab* block_editor;
tabs->addTab(new CMapEditorTab(this), "Map Editor");
tabs->addTab(block_editor = new CBlockEditorTab(this), "Sprite/Tile Editor");
//tabs->addTab(new CPaletteEditorTab(this), "Manual Palette Editor");
//tabs->setCurrentIndex(1);
setStatusBar(new QStatusBar());
setCentralWidget(tabs);
//setCentralWidget(block_editor = new CBlockEditorTab(this));
connect(block_editor, SIGNAL(statusMessage(QString, int)), statusBar(), SLOT(showMessage(QString, int)));
m_undo = new QAction(this);
m_redo = new QAction(this);
addAction(m_undo);
addAction(m_redo);
m_undo->setShortcut(QKeySequence::Undo);
m_redo->setShortcut(QKeySequence::Redo);
connect(tabs, SIGNAL(currentChanged(int)), this, SLOT(changedTabs(int)));
for(int i = 0; i < tabs->count(); ++i)
GData::getUndoStack(i)->clear();
changedTabs(tabs->currentIndex()); // init tab
QMenuBar* menubar = new QMenuBar();
QMenu* file_menu = menubar->addMenu("&File");
QAction* save_action = file_menu->addAction("&Save");
save_action->setEnabled(false);
setMenuBar(menubar);
connect(save_action, SIGNAL(triggered()), this, SLOT(saveFile()));
}