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


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

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


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

示例1: PresentationWidget

/** add comments here */
LordExchange::LordExchange( QWidget * parent, const char * name )
	:QDialog( parent, name, true )
{
	_lordLeft = 0;
	_lordRight = 0;
	_socket = 0;

	_presentation = new PresentationWidget( this );

	QTabWidget * tab = new QTabWidget( this );
	_generalities = new DisplayBothGeneralities( this );
	_units = new DisplayBothUnits( this );
	_artefacts = new DisplayBothArtefacts( this );
	_machines = new DisplayBothMachines( this );
	tab->insertTab( _generalities, "Generalities" );
	tab->insertTab( _units, "Units" );
	tab->insertTab( _artefacts, "Artefacts" );
	tab->insertTab( _machines, "War Machines" );
	tab->setCurrentPage( 0 );

	QPushButton * butOk = createButtonOk( this );
	QHBoxLayout * layH1 = new QHBoxLayout();
	layH1->addStretch( 1 );
	layH1->addWidget( butOk );
	layH1->addStretch( 1 );

	QGridLayout * layout = new QGridLayout( this, 3, 1 );
	layout->addWidget( _presentation, 0 , 0 );
	layout->setRowStretch( 1, 1 );
	layout->addWidget( tab, 1, 0 );
	layout->addLayout( layH1, 2, 0 );
	layout->activate();

	connect( butOk, SIGNAL( clicked() ), SLOT( accept() ) );
}
开发者ID:q4a,项目名称:attal,代码行数:36,代码来源:lordExchange.cpp

示例2: addUIs

void MainWindow::addUIs()
{
	QGridLayout *pLayout = new QGridLayout(ui->centralWidget) ;
	m_pSplitter = new QSplitter(this) ;
	pLayout->addWidget(m_pSplitter) ;
	{
		m_pStageTree = new QTreeView(this) ;
		m_pStageTree->setModel(gEditData.getStageModel()) ;
		m_pStageTree->setMinimumSize(100, 300) ;
		m_pStageTree->setHeaderHidden(true) ;
		gEditData.setStageTreeView(m_pStageTree) ;

		m_pGameView = new Form_GameDetail(this) ;

		QTabWidget *pTabWidget = new QTabWidget(this) ;
		Form_Maptab *pMapTab = new Form_Maptab(this) ;
		pTabWidget->insertTab(0, pMapTab, "Map") ;
		pTabWidget->insertTab(1, new QWidget(this), "Object") ;	// TODO:GUI作る

		connect(m_pStageTree, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(slot_stageTreeCustomContextMenu(QPoint))) ;
		connect(m_pStageTree, SIGNAL(clicked(QModelIndex)), m_pGameView, SLOT(slot_clickStageTree(QModelIndex))) ;
		connect(pMapTab, SIGNAL(sig_changeMapSize()), m_pGameView, SLOT(slot_changeMapSize())) ;

		m_pSplitter->addWidget(m_pStageTree) ;
		m_pSplitter->addWidget(m_pGameView) ;
		m_pSplitter->addWidget(pTabWidget) ;
	}
}
开发者ID:chocoball,项目名称:StageEditor,代码行数:28,代码来源:mainwindow.cpp

示例3: QDialog

CVMIDialog::CVMIDialog(QWidget* parent) : QDialog(parent) // : QDialog (0, Qt::WindowMinMaxButtonsHint | Qt::WindowTitleHint|Qt::WindowSystemMenuHint|Qt::WindowCloseButtonHint|Qt::Dialog) 
{

  // Select page
  selectPage = new CVMISelectPage;
  Q_ASSERT(connect(selectPage, SIGNAL(vmSelected(CVMIRelease)), this, SLOT(showVMCreate(CVMIRelease))));
  selectPage->setReady(false);

  // Create page
  createPage = new CVMICreatePage;
  Q_ASSERT(connect(createPage, SIGNAL(back()), this, SLOT(showVMSelect()))); 
  Q_ASSERT(connect(createPage, SIGNAL(createVM(CVMIInstanceConfig)), this, SLOT(showVMInstall(CVMIInstanceConfig))));

  // Install page
  installPage = new CVMIInstallPage;
  Q_ASSERT(connect(installPage, SIGNAL(done()), this, SLOT(showVMSelect())));

  // Config page
  CVMIConfigPage* configPage = new CVMIConfigPage;
  Q_ASSERT(connect(configPage, SIGNAL(displayOptionChanged()), selectPage, SLOT(displayOptionChanged())));
  Q_ASSERT(connect(configPage, SIGNAL(configChanged()), this, SLOT(verifyConfig())));  
   
  // About page
  CVMIAboutPage* aboutPage = new CVMIAboutPage;

  // Stacked Widget 
  contentWidget = new QStackedWidget;
  contentWidget->addWidget (selectPage);
  contentWidget->addWidget (createPage);  
  contentWidget->addWidget (installPage);

  // Tabs 
  QTabWidget *tabWidget = new QTabWidget;
  tabWidget->insertTab(0, contentWidget, tr("Installer"));
  tabWidget->insertTab(1, configPage, tr("Preferences"));
  tabWidget->insertTab(2, aboutPage, tr("About"));

   // Window decoration
  setWindowTitle(tr("CernVM installation tool"));  
  setWindowFlags(windowFlags() | Qt::WindowMinMaxButtonsHint | Qt::CustomizeWindowHint);

  // Layout
  QHBoxLayout *bodyLayout = new QHBoxLayout;
  bodyLayout->addWidget(tabWidget);
  setLayout(bodyLayout);

  // Application icon
  this->setWindowIcon(QIcon(":images/application_icon.png"));
  verifyConfig();
}
开发者ID:artemharutyunyan,项目名称:cernvm-installer,代码行数:50,代码来源:CVMIDialog.cpp

示例4: dropEvent

void QtDNDTabBar::dropEvent(QDropEvent* dropEvent) {
	QtDNDTabBar* sourceTabBar = dynamic_cast<QtDNDTabBar*>(dropEvent->source());
	if (sourceTabBar && dropEvent->mimeData() && dropEvent->mimeData()->data("action") == QByteArray("application/tab-detach")) {
		QtDNDTabBar* source = dynamic_cast<QtDNDTabBar*>(dropEvent->source());

		int targetTabIndex = tabAt(dropEvent->pos());
		QRect rect = tabRect(targetTabIndex);
		if (targetTabIndex >= 0 && (dropEvent->pos().x() - rect.left() - rect.width()/2 > 0)) {
			targetTabIndex++;
		}

		QWidget* tab = source->getDragWidget();
		assert(tab);
		QTabWidget* targetTabWidget = dynamic_cast<QTabWidget*>(parentWidget());

		QString tabText = source->getDragText();

		/*
		 * When you add a widget to an empty QTabWidget, it's automatically made the current widget.
		 * Making the widget the current widget, widget->show() is called for the widget. Directly reacting
		 * to that event, and adding the widget again to the QTabWidget results in undefined behavior. For
		 * example the tab label is shown but the widget is neither has the old nor in the new QTabWidget as
		 * parent. Blocking signals on the QWidget to be added to a QTabWidget prevents this behavior.
		 */
		targetTabWidget->setUpdatesEnabled(false);
		tab->blockSignals(true);
		targetTabWidget->insertTab(targetTabIndex, tab, tabText);
		dropEvent->acceptProposedAction();
		tab->blockSignals(false);
		targetTabWidget->setUpdatesEnabled(true);
		onDropSucceeded();
	}
}
开发者ID:scopeInfinity,项目名称:swift,代码行数:33,代码来源:QtDNDTabBar.cpp

示例5: insertTab

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

示例6: tabInsertTab

int ScriptToolbox::tabInsertTab(QWidget * tab, int idx, QWidget * page, const QString & text)
{
  QTabWidget *tw = qobject_cast<QTabWidget*>(tab);
  int i = -1;
  if(tw)
    i = tw->insertTab(idx, page, text);
  return i;
}
开发者ID:,项目名称:,代码行数:8,代码来源:

示例7: managerLoginPage

//constructor
MainWindow::MainWindow(QWidget *parent) :QMainWindow(parent)
{
    managerLoginPage();
    receptionPage();
    cateringPage();

    QTabWidget *tabWidget = new QTabWidget;
    tabWidget->insertTab(0, receptionWidget,tr("&Reception"));
    tabWidget->insertTab(1, managerLoginWidget, tr("Manager Login"));
    tabWidget->insertTab(2, cateringWidget, tr("Catering Services"));
    tabWidget->setTabEnabled(0, true);


    setCentralWidget(tabWidget);
    cateringServices = new CateringServices;   //A universal catering service object. Reinitailise for new use.
    manager = new Management;

    updateVisit_MonthCount();          //update month count for token

}
开发者ID:ankeshanand,项目名称:surp,代码行数:21,代码来源:mainwindow.cpp

示例8: insertTab

int TabWidget::insertTab( lua_State * L ) 
{
	QTabWidget* obj = ObjectHelper<QTabWidget>::check( L, 1 );
	int index = 0;
	if ( Util::isNum( L, 2 ) )
	{
		index = Util::toInt( L, 2 );
	}
	QWidget* widget = ObjectHelper<QWidget>::check( L, 3 );
	if ( Util::isStr( L, 4) ) // QString* label = ValueInstaller2<QString>::cast( L, 5 ))
	{
		//QString* l = ValueInstaller2<QString>::check( L, 4 );
		Util::push( L, obj->insertTab( index, widget, Util::toString( L, 4 ) ) ); //   int insertTab ( int index, QWidget * widget, const QString & label )
	}
	else
	{
		QIcon* icon = ValueInstaller2<QIcon>::check( L, 4 );
		//QString* l = ValueInstaller2<QString>::check( L, 5 );
		Util::push( L, obj->insertTab( index, widget, *icon, Util::toString( L, 5 ) ) ); //   int insertTab ( int index, QWidget * widget, const QIcon & icon, const QString & label )
	}
	return 1;
}
开发者ID:Wushaowei001,项目名称:NAF,代码行数:22,代码来源:QtlTabWidget.cpp

示例9: createWidgets

void MainWindow::createWidgets()
{
  setCentralWidget(new QWidget(this));
  QVBoxLayout* mainFormBaseLayout = new QVBoxLayout(centralWidget(), 1, 1);

  QSplitter* splitter = new QSplitter(centralWidget());
  splitter->setOrientation( Qt::Vertical  );
  mainFormBaseLayout->addWidget(splitter);

  m_tabEditor = new EditorTabWidget(splitter, this);
  splitter->setCollapsible(m_tabEditor, false);
  splitter->setOpaqueResize(true);

  QTabWidget* tabDebug = new QTabWidget(splitter);
  splitter->setCollapsible(tabDebug, false);
  tabDebug->setGeometry(0,0,0,height()/15);

  QWidget* globalVarTab = new QWidget(tabDebug);
  QVBoxLayout* globalVarTabLayout = new QVBoxLayout(globalVarTab, 1, 1);

  m_globaVarList = new VariablesListView(globalVarTab);
  globalVarTabLayout->addWidget(m_globaVarList);
  tabDebug->insertTab(globalVarTab, QString("Global"));

  QWidget* tabStack = new QWidget(tabDebug);
  QVBoxLayout* varTabLayout = new QVBoxLayout(tabStack, 1, 1);
  QHBoxLayout* stackComboLayout = new QHBoxLayout(0, 6, 6);

  QLabel* stackLabel = new QLabel(tabStack);
  stackLabel->setText(("Stack:"));
  stackLabel->setSizePolicy(QSizePolicy((QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, stackLabel->sizePolicy().hasHeightForWidth()));
  stackComboLayout->addWidget(stackLabel);

  m_stackCombo = new DebuggerComboStack(tabStack);
  stackComboLayout->addWidget(m_stackCombo);
  varTabLayout->addLayout(stackComboLayout);

  m_localVarList= new VariablesListView(tabStack);
  varTabLayout->addWidget(m_localVarList);
  tabDebug->insertTab(tabStack, QString("Local"));

  QWidget* tabWatch = new QWidget(tabDebug);
  QVBoxLayout* watchTabLayout = new QVBoxLayout(tabWatch, 1, 1);

  QHBoxLayout* addWatchLayout = new QHBoxLayout(0, 6, 6);

  QLabel* addLabel = new QLabel(tabWatch);
  addLabel->setText(("Watch:"));
  addWatchLayout->addWidget(addLabel);

  m_edAddWatch = new KLineEdit(tabWatch);
  m_edAddWatch->setSizePolicy(QSizePolicy((QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, m_edAddWatch->sizePolicy().hasHeightForWidth()));
  addWatchLayout->addWidget(m_edAddWatch);

  m_btAddWatch = new KPushButton(tabWatch);
  m_btAddWatch->setSizePolicy(QSizePolicy((QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, m_btAddWatch->sizePolicy().hasHeightForWidth()));
  m_btAddWatch->setText(("Add"));
  addWatchLayout->addWidget(m_btAddWatch);

  QSpacerItem* spacer = new QSpacerItem(430, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
  addWatchLayout->addItem(spacer);
  watchTabLayout->addLayout(addWatchLayout);

  m_watchList = new WatchListView(tabWatch);
  watchTabLayout->addWidget(m_watchList);
  tabDebug->insertTab(tabWatch, QString("Watch"));

  QWidget* breakpointTab = new QWidget(tabDebug);
  QVBoxLayout* breakpointTabLayout = new QVBoxLayout(breakpointTab, 1, 1);

  m_breakpointList = new BreakpointListView(breakpointTab);
  breakpointTabLayout->addWidget(m_breakpointList);
  tabDebug->insertTab(breakpointTab, QString("Breakpoints"));

  QWidget* logTab = new QWidget(tabDebug);
  QVBoxLayout* logTabLayout = new QVBoxLayout(logTab, 1, 1);

  m_logListView = new LogListView(logTab);
  logTabLayout->addWidget(m_logListView);
  tabDebug->insertTab(logTab, QString("Messages"));

  QWidget* outputTab = new QWidget(tabDebug);
  QVBoxLayout* outputTabLayout = new QVBoxLayout(outputTab, 1, 1);

  m_edOutput = new KTextEdit(outputTab);
  outputTabLayout->addWidget(m_edOutput);
  m_edOutput->setReadOnly(true);
  m_edOutput->setTextFormat(Qt::PlainText);
  m_edOutput->setPaper( QBrush(QColor("white")));

  /*
  KTextEditor::Document* doc = KTextEditor::EditorChooser::createDocument(
      0L, "KTextEditor::Document");
  //doc->setReadWrite(false);
  m_edOutput = dynamic_cast<KTextEditor::EditInterface*>(doc);
  m_edOutput->setText("oioi");
  outputTabLayout->addWidget(doc->createView(outputTab));
  */

  tabDebug->insertTab(outputTab, QString("Output"));
//.........这里部分代码省略.........
开发者ID:thiago-silva,项目名称:protoeditor,代码行数:101,代码来源:mainwindow.cpp

示例10: QMainWindow

    OLD_MAIN(QWidget* pParent = nullptr)
        : QMainWindow(pParent)
    {
        Q_INIT_RESOURCE(Resources);

        // Settings persistence
        ReadSettings();

        // Appearance LUT
        PlayerApperances appearances;

        // Build player table model from file
        PlayerTableModel* playerTableModel = new PlayerTableModel(this);
        playerTableModel->LoadHittingProjections(appearances);
        playerTableModel->LoadPitchingProjections(appearances);
        playerTableModel->CalculateHittingScores();
        playerTableModel->CalculatePitchingScores();
        playerTableModel->InitializeTargetValues();

        // Draft delegate
        DraftDelegate* draftDelegate = new DraftDelegate(playerTableModel);
        LinkDelegate* linkDelegate = new LinkDelegate(this);
        TagDelegate* tagDelegate = new TagDelegate(this);

        // Hitter sort-model
        PlayerSortFilterProxyModel* hitterSortFilterProxyModel = new PlayerSortFilterProxyModel(Player::Hitter);
        hitterSortFilterProxyModel->setSourceModel(playerTableModel);
        hitterSortFilterProxyModel->setSortRole(PlayerTableModel::RawDataRole);

        // Hitter table view
        QTableView* hitterTableView = MakeTableView(hitterSortFilterProxyModel, true, PlayerTableModel::COLUMN_Z);
        hitterTableView->setItemDelegateForColumn(FindColumn(hitterSortFilterProxyModel, PlayerTableModel::COLUMN_DRAFT_BUTTON), draftDelegate);
        hitterTableView->setItemDelegateForColumn(FindColumn(hitterSortFilterProxyModel, PlayerTableModel::COLUMN_ID_LINK), linkDelegate);
        hitterTableView->setItemDelegateForColumn(FindColumn(hitterSortFilterProxyModel, PlayerTableModel::COLUMN_FLAG), tagDelegate);
        hitterTableView->setEditTriggers(QAbstractItemView::DoubleClicked | QAbstractItemView::SelectedClicked);

        // Context menu
        QMenu* contextMenu = new QMenu();
        contextMenu->addAction("&Remove Player");

        // Apply to hitter table view
        hitterTableView->setContextMenuPolicy(Qt::CustomContextMenu);
        connect(hitterTableView, &QWidget::customContextMenuRequested, [=](const QPoint& pos) {
            QPoint globalPos = hitterTableView->mapToGlobal(pos);
            QAction* selectedItem = contextMenu->exec(globalPos);
            if (selectedItem) {
                auto proxyIndex = hitterTableView->indexAt(pos);
                auto srcIndex = hitterSortFilterProxyModel->mapToSource(proxyIndex);
                playerTableModel->RemovePlayer(srcIndex.row());
            }
        });

        // Pitcher sort-model
        PlayerSortFilterProxyModel* pitcherSortFilterProxyModel = new PlayerSortFilterProxyModel(Player::Pitcher);
        pitcherSortFilterProxyModel->setSourceModel(playerTableModel);
        pitcherSortFilterProxyModel->setSortRole(PlayerTableModel::RawDataRole);
        
        // Pitcher table view
        QTableView* pitcherTableView = MakeTableView(pitcherSortFilterProxyModel, true, PlayerTableModel::COLUMN_Z);
        pitcherTableView->setItemDelegateForColumn(FindColumn(pitcherSortFilterProxyModel, PlayerTableModel::COLUMN_DRAFT_BUTTON), draftDelegate);
        pitcherTableView->setItemDelegateForColumn(FindColumn(pitcherSortFilterProxyModel, PlayerTableModel::COLUMN_ID_LINK), linkDelegate);
        pitcherTableView->setItemDelegateForColumn(FindColumn(pitcherSortFilterProxyModel, PlayerTableModel::COLUMN_FLAG), tagDelegate);
        pitcherTableView->setEditTriggers(QAbstractItemView::DoubleClicked | QAbstractItemView::SelectedClicked);

        // Top/Bottom splitter
        QSplitter* topBottomSplitter = new QSplitter(Qt::Vertical);
        topBottomSplitter->setContentsMargins(5, 5, 5, 5);

        // Hitter/Pitcher tab View
        enum PlayerTableTabs { Hitters, Pitchers, Unknown };
        QTabWidget* hitterPitcherTabs = new QTabWidget(this);
        hitterPitcherTabs->insertTab(PlayerTableTabs::Hitters, hitterTableView, "Hitters");
        hitterPitcherTabs->insertTab(PlayerTableTabs::Pitchers, pitcherTableView, "Pitchers");
        topBottomSplitter->addWidget(hitterPitcherTabs);

        // Tab lookup helper
        auto CaterogyToTab = [](uint32_t catergory) 
        {
            switch (catergory)
            {
            case Player::Hitter:
                return PlayerTableTabs::Hitters;
            case Player::Pitcher:
                return PlayerTableTabs::Pitchers;
            default:
                return PlayerTableTabs::Unknown;
            }
        };

        // Drafted filter action
        QAction* filterDrafted = new QAction(this);
        connect(filterDrafted, &QAction::toggled, hitterSortFilterProxyModel, &PlayerSortFilterProxyModel::OnFilterDrafted);
        connect(filterDrafted, &QAction::toggled, pitcherSortFilterProxyModel, &PlayerSortFilterProxyModel::OnFilterDrafted);
        filterDrafted->setText(tr("Drafted"));
        filterDrafted->setToolTip("Toggle Drafted Players");
        filterDrafted->setCheckable(true);
        filterDrafted->toggle();

        QAction* filterReplacement = new QAction(this);
        connect(filterReplacement, &QAction::toggled, hitterSortFilterProxyModel, &PlayerSortFilterProxyModel::OnFilterReplacement);
//.........这里部分代码省略.........
开发者ID:kspagnoli,项目名称:fbb,代码行数:101,代码来源:old_main.cpp

示例11: 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;
}
开发者ID:weigj,项目名称:loongide,代码行数:78,代码来源:cdrv.cpp

示例12: config


//.........这里部分代码省略.........
    QHBoxLayout *h1 = new QHBoxLayout;
    QHBoxLayout *h2 = new QHBoxLayout;
    QHBoxLayout *h3 = new QHBoxLayout;
    
    homeScreen = new QComboBox;
    homeScreen->addItem(tr("On display off"));
    homeScreen->addItem(tr("On suspend"));
    homeScreen->addItem(tr("Never"));
    label->setBuddy(homeScreen);
    connect(homeScreen, SIGNAL(activated(int)), this, SLOT(homeScreenActivated(int)));

    QString showHomeScreen = config.value("ShowHomeScreen", "Never").toString();
    if (showHomeScreen == "DisplayOff")
        homeScreen->setCurrentIndex(0);
    else if (showHomeScreen == "Suspend")
        homeScreen->setCurrentIndex(1);
    else
        homeScreen->setCurrentIndex(2);

    lock = new QCheckBox(tr("Lock keys"));
    lock->setCheckState(config.value("AutoKeyLock", false).toBool() ? Qt::Checked : Qt::Unchecked);
    lock->setEnabled(homeScreen->currentIndex() == homeScreen->count()-1 ? false : true);

    powerNote = new QLabel;
    powerNote->setWordWrap( true );
    QFont font = QApplication::font();
    font.setItalic( true );
    powerNote->setFont( font );
    homeScreenActivated( homeScreen->currentIndex() );

    screenSaver_vsi = new QValueSpaceItem( "/Hardware/ScreenSaver/State", this );
    connect( screenSaver_vsi, SIGNAL(contentsChanged()), this, SLOT(homeScreenActivated()) );
    h1->addSpacing(20);
    h1->addWidget(homeScreen);
    h2->addSpacing(20);
    h2->addWidget(lock);
    h3->addSpacing(20);
    h3->addWidget(powerNote);
    
    idleLayout->addWidget(label);
    idleLayout->addLayout(h1);
    idleLayout->addLayout(h2);
    idleLayout->addLayout(h3);
    idleLayout->addStretch(1);
    
    //secondary screen tab
    //TODO: reduce amount of duplicated code between tabs
    if (QApplication::desktop()->numScreens() > 1) {
        QWidget *secondary = new QWidget;
        QScrollArea *secondaryWrapper = new QScrollArea;
        secondaryWrapper->setFocusPolicy(Qt::NoFocus);
        secondaryWrapper->setFrameStyle(QFrame::NoFrame);
        secondaryWrapper->setWidget(secondary);
        secondaryWrapper->setWidgetResizable(true);
        secondaryWrapper->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); 
        QFormLayout *secondaryLayout = new QFormLayout(secondary);
        
        hsImgName = config.value("SecondaryHomeScreenPicture").toString();
        hsDisplayMode = config.value("SecondaryHomeScreenPictureMode", 0).toInt();
            
        secondaryImage = new QPushButton();
        secondaryImage->setIconSize(QSize(50,75));
        secondaryImage->setMinimumHeight(80);

        secondaryImageMode = new QComboBox;
        secondaryImageMode->addItem(tr("Scale & Crop"));
        secondaryImageMode->addItem(tr("Stretch"));
        secondaryImageMode->addItem(tr("Tile"));
        secondaryImageMode->addItem(tr("Center"));
        secondaryImageMode->addItem(tr("Scale"));
        secondaryImageMode->setCurrentIndex(hsDisplayMode);
        
        secondaryHsImage = QContent(hsImgName);
        if (!secondaryHsImage.isValid()) {
            secondaryImage->setText(tr("No image"));
            secondaryImageMode->setVisible(false);
        }
        else {
            secondaryImage->setIcon(QIcon(secondaryHsImage.fileName()));
        }
        connect( secondaryImage, SIGNAL(clicked()), this, SLOT(editSecondaryPhoto()) );
    
        QVBoxLayout *secondaryImageLayout = new QVBoxLayout;
        secondaryImageLayout->setContentsMargins(0, 0, 0, 0);
        secondaryImageLayout->setSpacing(0);
        secondaryImageLayout->addWidget(secondaryImage);
        secondaryImageLayout->addWidget(secondaryImageMode);
        secondaryLayout->addRow(tr("Image"), secondaryImageLayout);
        
        tabWidget->addTab(secondaryWrapper, tr("Secondary","Secondary Display"));
    }
    
    tabWidget->insertTab(0, appearanceWrapper, tr("Appearance"));
    tabWidget->insertTab(1, idle, tr("Idle"));
    tabWidget->setCurrentIndex(0);
    
    layout->addWidget(tabWidget);

    QDrmContentPlugin::initialize();
}
开发者ID:muromec,项目名称:qtopia-ezx,代码行数:101,代码来源:homescreen.cpp


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