本文整理汇总了C++中QTabWidget::setTabText方法的典型用法代码示例。如果您正苦于以下问题:C++ QTabWidget::setTabText方法的具体用法?C++ QTabWidget::setTabText怎么用?C++ QTabWidget::setTabText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QTabWidget
的用法示例。
在下文中一共展示了QTabWidget::setTabText方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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));
*/
//}
}
示例2: QFileInfo
void
WFile::update_label()
{
QTabWidget *tabs = main_ui_->tabs;
QString label = QFileInfo(file()->filename()).fileName();
if (label.isEmpty())
label = "Untitled";
if (!file()->saved())
label = "* " + label;
tabs->setTabText(tabs->indexOf(this), label);
}
示例3: retranslateUi
void retranslateUi(QDialog *MemberEditDialog)
{
MemberEditDialog->setWindowTitle(QApplication::translate("MemberEditDialog", "Dialog", 0));
titleLabel->setText(QApplication::translate("MemberEditDialog", "Title", 0));
firstNameLabel->setText(QApplication::translate("MemberEditDialog", "First Name", 0));
lastNameLabel->setText(QApplication::translate("MemberEditDialog", "Last Name", 0));
streetLabel->setText(QApplication::translate("MemberEditDialog", "Street", 0));
zipLabel->setText(QApplication::translate("MemberEditDialog", "Zip", 0));
numberLabel->setText(QApplication::translate("MemberEditDialog", "Nr.", 0));
cityLabel->setText(QApplication::translate("MemberEditDialog", "City", 0));
comboBox->clear();
comboBox->insertItems(0, QStringList()
<< QString()
<< QApplication::translate("MemberEditDialog", "Herr", 0)
<< QApplication::translate("MemberEditDialog", "Frau", 0)
);
maritalCBox->clear();
maritalCBox->insertItems(0, QStringList()
<< QString()
<< QApplication::translate("MemberEditDialog", "Ledig", 0)
<< QApplication::translate("MemberEditDialog", "Verheiratet", 0)
);
titleExtLabel->setText(QString());
phoneLabel->setText(QApplication::translate("MemberEditDialog", "Phone", 0));
cellLabel->setText(QApplication::translate("MemberEditDialog", "Mobile Phone", 0));
emailLabel->setText(QApplication::translate("MemberEditDialog", "E-Mail", 0));
maritalLabel->setText(QApplication::translate("MemberEditDialog", "Stand", 0));
tabWidget->setTabText(tabWidget->indexOf(generalTab), QApplication::translate("MemberEditDialog", "General", 0));
ibanLabel->setText(QApplication::translate("MemberEditDialog", "IBAN", 0));
bicLabel->setText(QApplication::translate("MemberEditDialog", "BIC", 0));
ownerLabel->setText(QApplication::translate("MemberEditDialog", "Owner", 0));
noteLabel->setText(QApplication::translate("MemberEditDialog", "Note", 0));
addButton->setText(QApplication::translate("MemberEditDialog", "Add", 0));
editButton->setText(QApplication::translate("MemberEditDialog", "Edit", 0));
deleteButton->setText(QApplication::translate("MemberEditDialog", "Delete", 0));
tabWidget->setTabText(tabWidget->indexOf(accountTab), QApplication::translate("MemberEditDialog", "Account", 0));
okButton->setText(QApplication::translate("MemberEditDialog", "Ok", 0));
applyButton->setText(QApplication::translate("MemberEditDialog", "Apply", 0));
leaveButton->setText(QApplication::translate("MemberEditDialog", "Austritt", 0));
cancelButton->setText(QApplication::translate("MemberEditDialog", "Cancel", 0));
} // retranslateUi
示例4: updateTitle
void Tab::updateTitle(void) {
QTabWidget* widget = qobject_cast<QTabWidget*>(parentWidget()->parentWidget());
if(widget) {
QString text = _webView->title();
if(text.length() > 30) {
text.truncate(28);
text += "...";
}
widget->setTabText(widget->indexOf(this), text);
widget->setTabToolTip(widget->indexOf(this), _webView->title());
}
}
示例5: onNameChanged
bool CGraphicsBank::onNameChanged(QString newName)
{
if (m_name != newName)
{
m_name = newName;
if ( m_editor )
{
QTabWidget* tabWidget = (QTabWidget*)m_editor->parentWidget()->parentWidget();
tabWidget->setTabText(tabWidget->indexOf(m_editor), newName);
}
}
return true;
}
示例6: QWidget
QWidget *TilesetItemBox::makeCategory(const QString &categoryItem)
{
QTabWidget *TileSetsCategories = ui->TileSetsCategories;
QWidget *catWid;
QWidget *scrollWid;
QGridLayout *catLayout;
QLabel *grpLabel;
QComboBox *tilesetGroup;
QSpacerItem *spItem;
QScrollArea *TileSets;
FlowLayout *theLayOut;
catWid = new QWidget();
scrollWid = new QWidget();
catLayout = new QGridLayout(catWid);
catLayout->setSpacing(0);
catLayout->setContentsMargins(0, 0, 0, 0);
grpLabel = new QLabel(catWid);
grpLabel->setText(tr("Group:"));
catLayout->addWidget(grpLabel, 0, 0, 1, 1);
tilesetGroup = new QComboBox(catWid);
catLayout->addWidget(tilesetGroup, 0, 1, 1, 1);
tilesetGroup->setInsertPolicy(QComboBox::InsertAlphabetically);
spItem = new QSpacerItem(1283, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
catLayout->addItem(spItem, 0, 2, 1, 1);
TileSets = new QScrollArea(catWid);
TileSets->setWidget(scrollWid);
TileSets->setWidgetResizable(true);
TileSets->setFrameShape(QFrame::StyledPanel);
TileSets->setFrameShadow(QFrame::Raised);
TileSets->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
TileSets->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
theLayOut = new FlowLayout(scrollWid);
theLayOut->setSizeConstraint(QLayout::SetNoConstraint);
catLayout->addWidget(TileSets, 1, 0, 1, 3);
TileSetsCategories->addTab(catWid, QString());
TileSetsCategories->setTabText(TileSetsCategories->indexOf(catWid), categoryItem);
return catWid;
}
示例7: setTabText
int TabWidget::setTabText ( lua_State * L ) //( int index, const QString & label )void
{
QTabWidget* obj = ObjectHelper<QTabWidget>::check( L, 1 );
int index = 0;
if ( Util::isNum( L, 2 ) )
{
if ( Util::toInt( L, 2 )>=0 )
{
index = Util::toInt( L, 2 );
}
else
{
Util::error( L, "Invalid Index" );
}
}
//QString* l = ValueInstaller2<QString>::check( L, 3 );
obj->setTabText( index, Util::toString( L, 3 ) );
return 0;
}
示例8: 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);
}
}
示例9: tabSetTabText
void ScriptToolbox::tabSetTabText(QWidget * tab, int idx, const QString & text)
{
QTabWidget *tw = qobject_cast<QTabWidget*>(tab);
if(tw)
tw->setTabText(idx, text);
}
示例10: QMainWindow
NLSimpleGuiWindow::NLSimpleGuiWindow( NLSimple *model, QWidget *parent)
: QMainWindow(parent), ui(new Ui::NLSimpleGuiWindow), m_model(model),
m_ownsModel(model==NULL), m_fileName(""), m_equationPt(NULL),
m_programOptionsGui(NULL)
{
ui->setupUi(this);
if( !m_model ) openNewModel();
if( !m_model ) quit();
QMenu *fileMenu = ui->menuBar->addMenu( "&File" );
QAction *newAction = fileMenu->addAction( "&new model" );
QAction *openAction = fileMenu->addAction( "&open file" );
QAction *saveAction = fileMenu->addAction( "&save" );
QAction *saveAsAction = fileMenu->addAction( "save &as" );
QAction *quitAction = fileMenu->addAction( "&quit" );
connect( newAction, SIGNAL(triggered()), this, SLOT(openNewModel()) );
connect( openAction, SIGNAL(triggered()), this, SLOT(openExistingModel()) );
connect( saveAction, SIGNAL(triggered()), this, SLOT(saveModel()) );
connect( saveAsAction, SIGNAL(triggered()), this, SLOT(saveModelAs()) );
connect( quitAction, SIGNAL(triggered()), this, SLOT(quit()) );
TCanvas *can = ui->m_mathFormulaWidget->GetCanvas();
can->cd();
can->SetEditable( kTRUE );
m_equationPt = new TPaveText(0, 0, 1.0, 1.0, "NDC");
m_equationPt->SetBorderSize(0);
m_equationPt->SetTextAlign(12);
m_equationPt->Draw();
can->SetEditable( kFALSE );
can->Update();
//Add a button group so CLarke Error Grid buttons are mutually exclusive
m_clarkeButtonGroup = new QButtonGroup( this );
m_clarkeButtonGroup->addButton( ui->clarkCgmsVMeterRadioButton, 0 );
m_clarkeButtonGroup->addButton( ui->clarkePredVCGMSRadioButton, 1 );
ui->clarkCgmsVMeterRadioButton->setChecked(true);
connect( m_clarkeButtonGroup, SIGNAL(buttonClicked(int)),
this, SLOT(refreshClarkAnalysis()) );
//Make so Clarke Grid displays nice
can = ui->clarkeErrorGridWidget->GetCanvas();
can->cd();
can->Range(-45.17185,-46.4891,410.4746,410.6538);
can->SetFillColor(0);
can->SetBorderMode(0);
can->SetBorderSize(2);
can->SetRightMargin(0.031);
can->SetTopMargin(0.024);
can->SetFrameBorderMode(0);
QTabWidget *tw = ui->tabWidget;
tw->setTabText( tw->indexOf(ui->modelDisplyTab), "Display" );
tw->setTabText( tw->indexOf(ui->optionsTab), "Options" );
tw->setTabText( tw->indexOf(ui->clarkeGridTab), "Error Grid" );
tw->setTabText( tw->indexOf(ui->customEventsTab), "Custom Events" );
ui->endDisplayTime->setCalendarPopup(true);
ui->startDisplayTime->setCalendarPopup(true);
// ui->endDisplayTime->setDisplayFormat("MMM dd yy hh:mm AP");
// ui->startDisplayTime->setDisplayFormat("MMM dd yy hh:mm AP");
ui->tabWidget->setCurrentWidget(ui->customEventsTab);
m_customEventList = new QStandardItemModel(this/*ui->customEventLayout*/);
ui->customEventView->setModel(m_customEventList);
ui->customEventView->setShowGrid(false);
ui->customEventView->setAlternatingRowColors(true);
ui->customEventView->horizontalHeader()->setHidden(false);
connect( ui->geneticOptimizeButton, SIGNAL(clicked()), this, SLOT(doGeneticOptimization()) );
connect( ui->baysianFineTuneButton, SIGNAL(clicked()), this, SLOT(doMinuit2Fit()) );
connect( ui->addCgmsButton, SIGNAL(clicked()), this, SLOT(addCgmsData()) );
connect( ui->addMealDataButton, SIGNAL(clicked()), this, SLOT(addCarbData()) );
connect( ui->addMeterDataButton, SIGNAL(clicked()), this, SLOT(addMeterData()) );
connect( ui->addCustonDataBustom, SIGNAL(clicked()), this, SLOT(addCustomEventData()) );
connect( ui->redrawButton, SIGNAL(clicked()), this, SLOT(drawModel()) );
connect( ui->zoomIn, SIGNAL(clicked()), this, SLOT(zoomModelPreviewPlus()) );
connect( ui->zoomOut, SIGNAL(clicked()), this, SLOT(zoomModelPreviewMinus()) );
connect( ui->zoomIn, SIGNAL(clicked()), this, SLOT(zoomModelPreviewPlus()) );
connect( ui->endDisplayTime, SIGNAL(dateTimeChanged(QDateTime)), this, SLOT(checkDisplayTimeLimitsConsistency()) );
connect( ui->startDisplayTime, SIGNAL(dateTimeChanged(QDateTime)), this, SLOT(checkDisplayTimeLimitsConsistency()) );
connect( ui->endDisplayTime, SIGNAL(editingFinished()), this, SLOT(drawModel()) );
connect( ui->startDisplayTime, SIGNAL(editingFinished()), this, SLOT(drawModel()) );
connect( ui->addCustomEventButton, SIGNAL(clicked()), this, SLOT(addCustomEventDef()) );
connect( ui->deleteCustoEvenButton, SIGNAL(clicked()), this, SLOT(deleteCustomEventDef()) );
connect( ui->customEventView, SIGNAL(clicked(QModelIndex)), this, SLOT(drawSelectedCustomEvent()) );
init();
}//NLSimpleGuiWindow constructor
示例11: setTabText
void QTabWidgetProto::setTabText(int index, const QString &label)
{
QTabWidget *item = qscriptvalue_cast<QTabWidget*>(thisObject());
if (item)
item->setTabText(index, label);
}
示例12: drv_tabwidget
int drv_tabwidget(int drvid, void *a0, void* a1, void* a2, void* a3, void* a4, void* a5, void* a6, void* a7, void* a8, void* a9)
{
handle_head* head = (handle_head*)a0;
QTabWidget *self = (QTabWidget*)head->native;
switch (drvid) {
case TABWIDGET_INIT: {
drvNewObj(a0,new QTabWidget);
break;
}
case TABWIDGET_ADDTAB: {
self->addTab(drvGetWidget(a1),drvGetString(a2));
break;
}
case TABWIDGET_CLEAR: {
self->clear();
break;
}
case TABWIDGET_COUNT: {
drvSetInt(a1,self->count());
break;
}
case TABWIDGET_CURRENTINDEX: {
drvSetInt(a1,self->currentIndex());
break;
}
case TABWIDGET_CURRENTWIDGET: {
drvSetHandle(a1,self->currentWidget());
break;
}
case TABWIDGET_SETCURRENTINDEX: {
self->setCurrentIndex(drvGetInt(a1));
break;
}
case TABWIDGET_SETCURRENTWIDGET: {
self->setCurrentWidget(drvGetWidget(a1));
break;
}
case TABWIDGET_INDEXOF: {
drvSetInt(a2,self->indexOf(drvGetWidget(a1)));
break;
}
case TABWIDGET_INSERTTAB: {
self->insertTab(drvGetInt(a1),drvGetWidget(a2),drvGetString(a3));
break;
}
case TABWIDGET_REMOVETAB: {
self->removeTab(drvGetInt(a1));
break;
}
case TABWIDGET_SETTABTEXT: {
self->setTabText(drvGetInt(a1),drvGetString(a2));
break;
}
case TABWIDGET_SETTABTOOLTIP: {
self->setTabToolTip(drvGetInt(a1),drvGetString(a2));
break;
}
case TABWIDGET_TABTEXT: {
drvSetString(a2,self->tabText(drvGetInt(a1)));
break;
}
case TABWIDGET_TABTOOLTIP: {
drvSetString(a2,self->tabToolTip(drvGetInt(a1)));
break;
}
case TABWIDGET_WIDGETOF: {
drvSetHandle(a2,self->widget(drvGetInt(a1)));
break;
}
case TABWIDGET_ONCURRENTCHANGED: {
QObject::connect(self,SIGNAL(currentChanged(int)),drvNewSignal(self,a1,a2),SLOT(call(int)));
break;
}
default:
return 0;
}
return 1;
}