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


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

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


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

示例1: 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());
  }
}
开发者ID:Allanis,项目名称:SaraWeb,代码行数:12,代码来源:Tab.cpp

示例2:

void GCF::Components::MainWindow::showChildWidget(QWidget* parent, QWidget* child)
{
    if(!parent || !child)
        return;

    if(parent == d->workspace)
    {
        d->workspace->setCurrentWidget(child);
    }
    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());
            int index = tw->indexOf(child);
            if(index < 0)
                child->show();
            else
            {
                child->setEnabled(true);
                tw->setCurrentWidget(child);
            }
        }
    }
}
开发者ID:banduladh,项目名称:levelfour,代码行数:27,代码来源:MainWindow.cpp

示例3: tabTabIndex

int ScriptToolbox::tabTabIndex(QWidget * tab, QWidget * page)
{
    QTabWidget *tw = qobject_cast<QTabWidget*>(tab);
    if(tw)
        return tw->indexOf(page);
    return 0;
}
开发者ID:,项目名称:,代码行数:7,代码来源:

示例4: indexOf

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

示例5: indexOf

int TabWidget::indexOf ( lua_State * L )// (QWidget* w)const int
{
	QTabWidget* obj = ObjectHelper<QTabWidget>::check( L, 1 );
	QWidget* w = ObjectHelper<QWidget>::check( L, 2 );
	Util::push( L, obj->indexOf( w ) );
	return 1;
}
开发者ID:Wushaowei001,项目名称:NAF,代码行数:7,代码来源:QtlTabWidget.cpp

示例6: updateIcon

void Tab::updateIcon(void) {
  QTabWidget* widget = qobject_cast<QTabWidget*>(parentWidget()->parentWidget());
  if(widget) {
    QIcon icon = _webView->icon();
    if(icon.isNull()) {
      icon = QIcon(":/defaultPageIcon.png");
    }
    widget->setTabIcon(widget->indexOf(this), icon);
  }
}
开发者ID:Allanis,项目名称:SaraWeb,代码行数:10,代码来源:Tab.cpp

示例7: 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);
}
开发者ID:an146,项目名称:vomid,代码行数:11,代码来源:w_file.cpp

示例8: 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
开发者ID:brainpower,项目名称:VManager,代码行数:41,代码来源:membereditdialog_ui.hpp

示例9: initTabIcons

void ConfigurationManager::initTabIcons()
{
    QTabWidget *tw = ui->tabWidget;
    if ( !tw->tabIcon(0).isNull() )
        return;

    tw->setTabIcon( tw->indexOf(ui->tabGeneral), getIcon("", IconWrench) );
    tw->setTabIcon( tw->indexOf(ui->tabLayout), getIcon("", IconColumns) );
    tw->setTabIcon( tw->indexOf(ui->tabHistory), getIcon("", IconListAlt) );
    tw->setTabIcon( tw->indexOf(ui->tabItems), getIcon("", IconThList) );
    tw->setTabIcon( tw->indexOf(ui->tabTray), getIcon("", IconInbox) );
    tw->setTabIcon( tw->indexOf(ui->tabNotifications), getIcon("", IconInfoCircle) );
    tw->setTabIcon( tw->indexOf(ui->tabShortcuts), getIcon("", IconKeyboard) );
    tw->setTabIcon( tw->indexOf(ui->tabAppearance), getIcon("", IconImage) );
}
开发者ID:m4r71n,项目名称:CopyQ,代码行数:15,代码来源:configurationmanager.cpp

示例10: 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;
}
开发者ID:Heathcode,项目名称:nesicide,代码行数:15,代码来源:cgraphicsbank.cpp

示例11: 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;
}
开发者ID:jpmac26,项目名称:PGE-Project,代码行数:46,代码来源:tileset_item_box.cpp

示例12: jumptab

void NotepadForm::jumptab()
{
	if (parent())
	{
		QTabWidget* p = qobject_cast<QTabWidget*>(parent()->parent());
		if (p)
		{
			qint32 max = p->count();
			qint32 cur = p->indexOf(this);

			if (sender()->objectName().startsWith('n')) {
				if (++cur >= max) cur = 0;
			} else {
				if (--cur < 0) cur = (max>0) ? (max-1) : 0;
			}

			p->setCurrentIndex(cur);
		}
	}
}
开发者ID:quinsmpang,项目名称:Tools,代码行数:20,代码来源:notepadform.cpp

示例13: contextMenuEvent

void CGraphicsBank::contextMenuEvent(QContextMenuEvent* event, QTreeView* parent)
{
   const QString EXPORT_PNG_TEXT    = "Export as PNG";
   const QString DELETE_TEXT        = "&Delete";

   QMenu menu(parent);
   menu.addAction(EXPORT_PNG_TEXT);
   menu.addSeparator();
   menu.addAction(DELETE_TEXT);

   QAction* ret = menu.exec(event->globalPos());

   if (ret)
   {
      if (ret->text() == DELETE_TEXT)
      {
         if (QMessageBox::question(parent, "Delete Source", "Are you sure you want to delete " + caption(),
                                   QMessageBox::Yes, QMessageBox::No) != QMessageBox::Yes)
         {
            return;
         }

         if (m_editor)
         {
            QTabWidget* tabWidget = (QTabWidget*)this->m_editor->parentWidget()->parentWidget();
            tabWidget->removeTab(tabWidget->indexOf(m_editor));
         }

         // TODO: Fix this logic so the memory doesn't get lost.
         nesicideProject->getProject()->getGraphicsBanks()->removeChild(this);
         nesicideProject->getProject()->getGraphicsBanks()->getGraphicsBanks().removeAll(this);
         //((CProjectTreeViewModel*)parent->model())->layoutChangedEvent();
      }
      else if (ret->text() == EXPORT_PNG_TEXT)
      {
         exportAsPNG();
      }
   }
}
开发者ID:nesicide,项目名称:nesicide,代码行数:39,代码来源:cgraphicsbank.cpp

示例14: apply

void JabberInfo::apply()
{
    if ((m_data == NULL) && (m_client->getState() == Client::Connected)){
        QString errMsg;
        QWidget *errWidget = edtCurrent;
        if (!edtPswd1->text().isEmpty() || !edtPswd2->text().isEmpty()){
            if (edtCurrent->text().isEmpty()){
                errMsg = i18n("Input current password");
            }else{
                if (edtPswd1->text() != edtPswd2->text()){
                    errMsg = i18n("Confirm password does not match");
                    errWidget = edtPswd2;
                }else if (edtCurrent->text() != m_client->getPassword()){
                    errMsg = i18n("Invalid password");
                }
            }
        }
        if (!errMsg.isEmpty()){
            for (QWidget *p = parentWidget(); p; p = p->parentWidget()){
                QTabWidget *tb = qobject_cast<QTabWidget*>(p);
                if (!tb)
                    continue;
                tb->setCurrentIndex(tb->indexOf(this));
                break;
            }
            emit raise(this);
            BalloonMsg::message(errMsg, errWidget);
            return;
        }
        if (!edtPswd1->text().isEmpty())
            m_client->changePassword(edtPswd1->text());
        // clear Textboxes
        edtCurrent->clear();
        edtPswd1->clear();
        edtPswd2->clear();
    }
}
开发者ID:,项目名称:,代码行数:37,代码来源:

示例15: settings


//.........这里部分代码省略.........
    m_options["always_on_top"] = Option(false, "checked", ui->checkBoxAlwaysOnTop);
    m_options["tab_position"] = Option(0, "currentIndex", ui->comboBoxTabPosition);
    m_options["text_wrap"] = Option(true, "checked", ui->checkBoxTextWrap);

    m_options["tray_items"] = Option(5, "value", ui->spinBoxTrayItems);
    m_options["tray_commands"] = Option(true, "checked", ui->checkBoxTrayShowCommands);
    m_options["tray_tab_is_current"] = Option(true, "checked", ui->checkBoxMenuTabIsCurrent);
    m_options["tray_images"] = Option(true, "checked", ui->checkBoxTrayImages);
    m_options["tray_tab"] = Option("", "text", ui->comboBoxMenuTab->lineEdit());

    // Tooltip to show on command line.
    ui->comboBoxMenuTab->lineEdit()->setToolTip( ui->comboBoxMenuTab->toolTip() );

    /* other options */
    m_options["tabs"] = Option(QStringList());
    m_options["command_history_size"] = Option(100);
    m_options["_last_hash"] = Option(0);
#ifndef NO_GLOBAL_SHORTCUTS
    /* shortcuts */
    m_options["toggle_shortcut"] = Option("", "text", ui->pushButton);
    m_options["menu_shortcut"] = Option("", "text", ui->pushButton_2);
    m_options["edit_clipboard_shortcut"] = Option("", "text", ui->pushButton_3);
    m_options["edit_shortcut"] = Option("", "text", ui->pushButton_4);
    m_options["second_shortcut"] = Option("", "text", ui->pushButton_5);
    m_options["show_action_dialog"] = Option("", "text", ui->pushButton_6);
    m_options["new_item_shortcut"] = Option("", "text", ui->pushButton_7);
#endif
#ifdef COPYQ_WS_X11
    /* X11 clipboard selection monitoring and synchronization */
    m_options["check_selection"] = Option(true, "checked", ui->checkBoxSel);
    m_options["copy_clipboard"] = Option(true, "checked", ui->checkBoxCopyClip);
    m_options["copy_selection"] = Option(true, "checked", ui->checkBoxCopySel);
#else
    ui->checkBoxCopySel->hide();
    ui->checkBoxSel->hide();
    ui->checkBoxCopyClip->hide();
#endif

    // values of last submitted action
    m_options["action_has_input"]  = Option(false);
    m_options["action_has_output"] = Option(false);
    m_options["action_separator"]  = Option("\\n");
    m_options["action_output_tab"] = Option("");

    /* appearance options */
    QString name;
    QPalette p;
    name = p.color(QPalette::Base).name();
    m_theme["bg"]          = Option(name, "VALUE", ui->pushButtonColorBg);
    m_theme["edit_bg"]     = Option(name, "VALUE", ui->pushButtonColorEditorBg);
    name = p.color(QPalette::Text).name();
    m_theme["fg"]          = Option(name, "VALUE", ui->pushButtonColorFg);
    m_theme["edit_fg"]     = Option(name, "VALUE", ui->pushButtonColorEditorFg);
    name = p.color(QPalette::Text).lighter(400).name();
    m_theme["num_fg"]      = Option(name, "VALUE", ui->pushButtonColorNumberFg);
    name = p.color(QPalette::AlternateBase).name();
    m_theme["alt_bg"]      = Option(name, "VALUE", ui->pushButtonColorAltBg);
    name = p.color(QPalette::Highlight).name();
    m_theme["sel_bg"]      = Option(name, "VALUE", ui->pushButtonColorSelBg);
    name = p.color(QPalette::HighlightedText).name();
    m_theme["sel_fg"]      = Option(name, "VALUE", ui->pushButtonColorSelFg);
    m_theme["find_bg"]     = Option("#ff0", "VALUE", ui->pushButtonColorFindBg);
    m_theme["find_fg"]     = Option("#000", "VALUE", ui->pushButtonColorFindFg);
    m_theme["font"]        = Option("", "VALUE", ui->pushButtonFont);
    m_theme["edit_font"]   = Option("", "VALUE", ui->pushButtonEditorFont);
    m_theme["find_font"]   = Option("", "VALUE", ui->pushButtonFoundFont);
    m_theme["num_font"]    = Option("", "VALUE", ui->pushButtonNumberFont);
    m_theme["show_number"] = Option(true, "checked", ui->checkBoxShowNumber);
    m_theme["show_scrollbars"] = Option(true, "checked", ui->checkBoxScrollbars);

    m_options["use_system_icons"] = Option(false, "checked", ui->checkBoxSystemIcons);

    /* datafile for items */
    QSettings settings(QSettings::IniFormat, QSettings::UserScope,
                       QCoreApplication::organizationName(),
                       QCoreApplication::applicationName());
    const QString settingsFileName = settings.fileName();
    m_datfilename = settingsFileName;
    m_datfilename.replace( QRegExp(".ini$"), QString("_tab_") );

    // Create directory to save items (otherwise it may not exist at time of saving).
    QDir settingsDir(settingsFileName + "/..");
    if ( settingsDir.mkdir(".") ) {
        log( tr("Cannot create directory for settings \"%1\"!").arg(settingsDir.path()),
             LogError );
    }

    connect(this, SIGNAL(finished(int)), SLOT(onFinished(int)));

    // Tab icons
    QTabWidget *tw = ui->tabWidget;
    tw->setTabIcon( tw->indexOf(ui->tabClipboard), getIcon("", IconPaste) );
    tw->setTabIcon( tw->indexOf(ui->tabGeneral), getIcon("", IconListOl) );
    tw->setTabIcon( tw->indexOf(ui->tabTray), getIcon("", IconInbox) );
    tw->setTabIcon( tw->indexOf(ui->tabCommands), getIcon("", IconCogs) );
    tw->setTabIcon( tw->indexOf(ui->tabShortcuts), getIcon("", IconHandUp) );
    tw->setTabIcon( tw->indexOf(ui->tabAppearance), getIcon("", IconPicture) );

    loadSettings();
}
开发者ID:yarod39,项目名称:CopyQ,代码行数:101,代码来源:configurationmanager.cpp


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