本文整理汇总了C++中QTabWidget类的典型用法代码示例。如果您正苦于以下问题:C++ QTabWidget类的具体用法?C++ QTabWidget怎么用?C++ QTabWidget使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了QTabWidget类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AbstractAnalysisWidget
/*! Constructor */
StateBasedPhiWidget::StateBasedPhiWidget(QWidget *parent) : AbstractAnalysisWidget(parent){
QVBoxLayout *mainVerticalBox = new QVBoxLayout(this);
//Create a state based phi analysis dao to be used by this class
stateDao = new StateBasedPhiAnalysisDao(Globals::getAnalysisDao()->getDBInfo());
//Initialize analysis parameters and other variables
initializeAnalysisInfo();
//Set up analysis runner with function to create threads to analyze for state-based phi
analysisRunner->setTimeStepThreadCreationFunction(&createAnalysisTimeStepThread);
//Add tool bar to top of widget
toolBar = getDefaultToolBar();
checkToolBarEnabled();//Can only carry out analysis if a network and archive are loaded
mainVerticalBox->addWidget(toolBar);
//Create a tabbed widget to hold progress and results
QTabWidget* tabWidget = new QTabWidget(this);
//Add the model and view displaying the current analysis
fullResultsModel = new FullResultsModel(&analysisInfo, stateDao);
QTableView* fullResultsTableView = new FullResultsTableView(this, fullResultsModel);
fullResultsTableView->setMinimumSize(500, 500);
tabWidget->addTab(fullResultsTableView, "Results");
//Add widget displaying progress
progressWidget = new ProgressWidget(this);
connect(analysisRunner, SIGNAL(progress(const QString&, unsigned int, unsigned int, unsigned int)), progressWidget, SLOT(updateProgress(const QString&, unsigned int, unsigned int, unsigned int)), Qt::QueuedConnection);
connect(analysisRunner, SIGNAL(timeStepComplete(unsigned int)), progressWidget, SLOT(timeStepComplete(unsigned int)), Qt::QueuedConnection);
progressWidget->setMinimumSize(500, 500);
QScrollArea* progressScrollArea = new QScrollArea(this);
progressScrollArea->setWidget(progressWidget);
tabWidget->addTab(progressScrollArea, "Progress");
mainVerticalBox->addWidget(tabWidget);
mainVerticalBox->addStretch(5);
}
示例2: getHierarchyNames
//-----------------------------------------------------------------------------
// Function: ComponentEditorSettingsPage::createWorkspacePages()
//-----------------------------------------------------------------------------
QStackedWidget* ComponentEditorSettingsPage::createWorkspacePages(QString currentWorkspaceName,
QStringList workspaceNames)
{
SettingsPage::settings().beginGroup("Workspaces");
SettingsPage::settings().beginGroup(currentWorkspaceName + "/ComponentEditorFilters/HW/Flat");
QStringList hwCheckBoxNames = SettingsPage::settings().childKeys();
SettingsPage::settings().endGroup(); // workspaceName/ComponentEditorFilters/HW
SettingsPage::settings().beginGroup(currentWorkspaceName + "/ComponentEditorFilters/SW");
QStringList swCheckBoxNames = SettingsPage::settings().childKeys();
SettingsPage::settings().endGroup(); // workspaceName/ComponentEditorFilters/SW
SettingsPage::settings().endGroup(); // Workspaces
QStringList hierarchyNames = getHierarchyNames();
hwCheckBoxNames = changeNameSeparators(hwCheckBoxNames);
swCheckBoxNames = changeNameSeparators(swCheckBoxNames);
QStackedWidget* workspaces = new QStackedWidget;
for (int workspaceIndex = 0; workspaceIndex < workspaceNames.size(); ++workspaceIndex)
{
QTableWidget* hwTable = new QTableWidget (hwCheckBoxNames.size(), hierarchyNames.size(), this);
setHwTable(hwTable, hierarchyNames, hwCheckBoxNames, workspaceIndex);
QTableWidget* swTable = new QTableWidget (swCheckBoxNames.size(), 1, this);
QStringList swHeader("Global");
setSwTable(swTable, swHeader, swCheckBoxNames, workspaceIndex);
QTabWidget* wareTab = new QTabWidget;
wareTab->addTab(hwTable, "Hardware");
wareTab->addTab(swTable, "Software");
workspaces->addWidget(wareTab);
}
return (workspaces);
}
示例3: QDialog
void Dialog::ouvrirAbout()
{
QDialog *APropos = new QDialog(this, Qt::WindowCloseButtonHint);
APropos->setFixedSize(300, 200);
APropos->setWindowTitle("A Propos de QColor Slider RGB");
QTabWidget *tab = new QTabWidget(APropos); //QTABWIDGET incluant un QLabel et deux QTextEdit
tab->setGeometry(5, 5, 290, 190);
QLabel *infos = new QLabel(APropos);
infos->setTextFormat(Qt::RichText); //format texte RTF
infos->setText("<P><h3>QColor Slider RGB</h3></p><p>Créer par Pierre Leroux</p><p>Compilé le 12/01/2012<p><p>Version 1.0</p>");
infos->setAlignment(Qt::AlignCenter);
QTextEdit *Alire = new QTextEdit(APropos);
Alire->setText("Ce programme est fournit « EN L'ÉTAT », SANS GARANTIE D'AUCUNE SORTE, INCLUANT, SANS S'Y LIMITER, LES GARANTIES D'ABSENCE DE DÉFAUT, DE QUALITÉ MARCHANDE, D'ADÉQUATION À UN USAGE PARTICULIER.");
Alire->setReadOnly(true);
QTextEdit *licence = new QTextEdit(APropos);
licence->setText("<p>This program is free software: you can redistribute it and/or modify"
"it under the terms of the GNU General Public License as published by"
"the Free Software Foundation, either version 3 of the License, or"
"(at your option) any later version."
"This program is distributed in the hope that it will be useful,"
"but WITHOUT ANY WARRANTY; without even the implied warranty of"
"MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the"
"GNU General Public License for more details."
"You should have received a copy of the GNU General Public License"
"along with this program. If not, see http://www.gnu.org/licenses/.</p>");
licence->setReadOnly(true);
tab->addTab(infos, "Information");
tab->addTab(Alire, "A lire");
tab->addTab(licence, "GNU General Public License");
APropos->exec(); //ouverture de la fenetre
}
示例4: 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);
}
}
}
示例5: QGroupBox
/**
* Sets up the documentation group.
* @param margin The margin of the group.
*/
void ClassifierListPage::setupDocumentationGroup(int margin)
{
m_docGB = new QGroupBox(i18n("Documentation"), this);
QVBoxLayout* docLayout = new QVBoxLayout(m_docGB);
docLayout->setSpacing(10);
docLayout->setMargin(margin);
if (m_itemType == UMLObject::ot_Operation) {
m_docTE = new KTextEdit();
m_pCodeTE = new CodeTextEdit();
#if QT_VERSION >= 0x050000
QTabWidget* tabWidget = new QTabWidget();
#else
KTabWidget* tabWidget = new KTabWidget();
#endif
tabWidget->addTab(m_docTE, i18n("Comment"));
tabWidget->addTab(m_pCodeTE, i18n("Source Code"));
docLayout->addWidget(tabWidget);
}
else {
m_docTE = new KTextEdit();
docLayout->addWidget(m_docTE);
}
}
示例6: KPageDialog
AccountseditorConfigDialog::AccountseditorConfigDialog( ViewBase *view, AccountTreeView *treeview, QWidget *p)
: KPageDialog(p),
m_view( view ),
m_treeview( treeview )
{
setWindowTitle( i18n("Settings") );
QTabWidget *tab = new QTabWidget();
QWidget *w = ViewBase::createPageLayoutWidget( view );
tab->addTab( w, w->windowTitle() );
m_pagelayout = w->findChild<KoPageLayoutWidget*>();
Q_ASSERT( m_pagelayout );
m_headerfooter = ViewBase::createHeaderFooterWidget( view );
m_headerfooter->setOptions( view->printingOptions() );
tab->addTab( m_headerfooter, m_headerfooter->windowTitle() );
KPageWidgetItem *page = addPage( tab, i18n( "Printing" ) );
page->setHeader( i18n( "Printing Options" ) );
connect( this, SIGNAL(accepted()), this, SLOT(slotOk()));
}
示例7: QMainWindow
MainWindow::MainWindow(ModuleLoader &moduleLoader, const ProgramLoader &programLoader, QWidget *parent)
: QMainWindow(parent),
moduleLoader(moduleLoader),
programLoader(programLoader)
{
createActions();
createMenus();
setAcceptDrops(true);
treeWidget = new TreeWidget(programLoader, this);
hexFileWidget = new HexFileWidget(this);
logWidget = new LogWidget();
setCentralWidget(new QWidget(this));
QHBoxLayout* layout = new QHBoxLayout(centralWidget());
QTabWidget* tab = new QTabWidget(centralWidget());
tab->addTab(hexFileWidget, "hex");
tab->addTab(logWidget, "log");
layout->addWidget(treeWidget, 1);
layout->addWidget(tab);
layout->setContentsMargins(0,0,0,0);
centralWidget()->setLayout(layout);
QAction* search = new QAction(this);
search->setShortcut(QKeySequence::Find);
addAction(search);
connect(treeWidget,SIGNAL(pathChanged(QString)), hexFileWidget, SLOT(setFile(QString)));
connect(treeWidget,SIGNAL(positionChanged(qint64, qint64)), hexFileWidget, SLOT(gotoPosition(qint64)));
connect(treeWidget,SIGNAL(positionChanged(qint64, qint64)), hexFileWidget, SLOT(highlight(qint64,qint64)));
connect(treeWidget,SIGNAL(eventDropped(QDropEvent*)),this, SLOT(dropEvent(QDropEvent*)));
connect(search, SIGNAL(triggered()), hexFileWidget, SLOT(focusSearch()));
connect(treeWidget,SIGNAL(openFragmentedFile(Object&)), this, SLOT(openFragmentedFile(Object&)));
connect(hexFileWidget, SIGNAL(selected(qint64)), treeWidget, SLOT(updateByFilePosition(qint64)));
}
示例8: QDialog
/** Geocache information dialog */
CacheInfoDialog::CacheInfoDialog(Cache * cache, QWidget * parent) :
QDialog(parent), cache_(cache) {
setWindowTitle(cache->name + " (" + cache->waypoint + ")");
// Grid layout as main layout
QGridLayout * mainLayout = new QGridLayout(this);
// cache name
mainLayout->addWidget(new QLabel("<big><b>" + cache->name + "</b></big>"), 0,
0, Qt::AlignLeft);
// cache icon
QLabel * pic = new QLabel;
pic->setPixmap(cacheIcon(cache));
mainLayout->addWidget(pic, 0, 1, Qt::AlignRight);
// tab pages
// setup description browser
QTextBrowser * descBrowser = new QTextBrowser();
descBrowser->setHtml(cache->desc);
descBrowser->setOpenExternalLinks(true);
// prepare tab widgets
QTabWidget * tab = new QTabWidget;
tab->addTab(new InfoTab(cache), "General");
tab->addTab(descBrowser, "Description");
mainLayout->addWidget(tab, 1, 0, 1, 2);
// button box
QDialogButtonBox * buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok);
connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
mainLayout->addWidget(buttonBox, 2, 0, 1, 2, Qt::AlignRight);
setLayout(mainLayout);
}
示例9: setupUi
void setupUi(QDialog *dialog)
{
vbl = new QVBoxLayout(dialog);
name = new QLabel(dialog);
name->setTextFormat(Qt::RichText);
name->setWordWrap(true);
name->setTextInteractionFlags(Qt::TextSelectableByMouse|Qt::TextSelectableByKeyboard);
vbl->addWidget(name);
status = new QLabel(dialog);
status->setWordWrap(true);
status->setTextFormat(Qt::RichText);
status->setTextInteractionFlags(Qt::TextSelectableByMouse|Qt::TextSelectableByKeyboard);
vbl->addWidget(status);
profileTabs = new QTabWidget(dialog);
profileTab = new QTextEdit();
profileTab->setReadOnly(true);
profileTabs->addTab(profileTab, QString("Profile"));
kinkTab = new QTextEdit();
kinkTab->setReadOnly(true);
profileTabs->addTab(kinkTab, QString("Kinks"));
profileTabs->setCurrentIndex(0);
vbl->addWidget(profileTabs);
buttons = new QDialogButtonBox(Qt::Horizontal, dialog);
closeButton = new QPushButton(QIcon(":/images/cross.png"), QString("Close"));
buttons->addButton(closeButton, QDialogButtonBox::RejectRole);
vbl->addWidget(buttons);
dialog->setLayout(vbl);
dialog->setWindowTitle(QString("Character Info"));
QObject::connect(buttons, SIGNAL(rejected()), dialog, SLOT(reject()));
QMetaObject::connectSlotsByName(dialog);
}
示例10: i18n
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();
}
}
示例11: QTabWidget
QWidget* Sis3350UI::createTabs()
{
QTabWidget* tabs = new QTabWidget();
tabs->addTab(createDevCtrlTab(),tr("Dev Ctrl"));
tabs->addTab(createTriggerTab(),tr("Trigger"));
tabs->addTab(createGainTab(),tr("Gain"));
tabs->addTab(createRunTab(),tr("Run"));
tabs->addTab(createClockTab(),tr("Clock"));
tabs->addTab(createIrqTab(),tr("Irq"));
return tabs;
}
示例12: QDialog
AboutDialog::AboutDialog(QWidget *p) : QDialog(p) {
setWindowTitle(tr("About Mumble"));
QTabWidget *qtwTab = new QTabWidget(this);
QVBoxLayout *vblMain = new QVBoxLayout(this);
QTextEdit *qteLicense=new QTextEdit(qtwTab);
qteLicense->setReadOnly(true);
qteLicense->setPlainText(QLatin1String(licenseMumble));
QWidget *about=new QWidget(qtwTab);
QLabel *icon=new QLabel(about);
icon->setPixmap(g.mw->qiIcon.pixmap(g.mw->qiIcon.actualSize(QSize(128, 128))));
QLabel *text=new QLabel(about);
text->setOpenExternalLinks(true);
text->setText(tr(
"<h3>Mumble (%1)</h3>"
"<p>Copyright %3 Thorvald Natvig<br />[email protected]</p>"
"<p><b>A voice-chat utility for gamers</b></p>"
"<p><tt><a href=\"%2\">%2</a></tt></p>"
).arg(QLatin1String(MUMBLE_RELEASE)).arg(QLatin1String("http://mumble.sourceforge.net/")).arg(QLatin1String("2005-2010")));
QHBoxLayout *qhbl=new QHBoxLayout(about);
qhbl->addWidget(icon);
qhbl->addWidget(text);
qtwTab->addTab(about, tr("&About Mumble"));
qtwTab->addTab(qteLicense, tr("&License"));
QPushButton *okButton = new QPushButton(tr("OK"), this);
connect(okButton, SIGNAL(clicked()), this, SLOT(accept()));
vblMain->addWidget(qtwTab);
vblMain->addWidget(okButton);
}
示例13: QWidget
QChest::QChest(MH3U_SE *mh3u, QWidget *parent) : QWidget(parent)
{
this->mh3u = mh3u;
QSignalMapper *signalMapper = new QSignalMapper(this);
connect(signalMapper, SIGNAL(mapped(int)), this, SLOT(buttonClicked(int)));
QTabWidget *tabs = new QTabWidget(this);
QWidget *tab;
QGridLayout *tab_layout;
for (uint32_t i = 0; i < 10; i++)
{
tab = new QWidget(this);
tabs->addTab(tab, QString("Panel ") + QString::number(i+1));
tab_layout = new QGridLayout(tab);
tab->setLayout(tab_layout);
for (uint32_t j = 0; j < 100; j++)
{
m_buttons[i][j] = new QPushButton(QString::number(mh3u->savedata->chest[i][j].id), tab);
m_buttons[i][j]->setFixedHeight(32);
m_buttons[i][j]->setFixedWidth(32);
tab_layout->addWidget(m_buttons[i][j], j / 10, j % 10);
signalMapper->setMapping(m_buttons[i][j], i * 100 + j);
connect(m_buttons[i][j], SIGNAL(clicked(bool)), signalMapper, SLOT(map()));
}
}
QLayout *main_layout = new QGridLayout(this);
main_layout->addWidget(tabs);
this->setLayout(main_layout);
this->setWindowTitle("Chest editor");
}
示例14: QDialog
SettingsDialog::SettingsDialog(QWidget *parent)
: QDialog(parent, Qt::MSWindowsFixedSizeDialogHint | Qt::WindowTitleHint),
sw(this)
{
connect(&sw, SIGNAL(clickClose()), SLOT(close()));
QTabWidget *tab = new QTabWidget(this);
tab->addTab(&sw, tr("Common"));
if(FileAssoc::isSupportAssociation()){
QGridLayout *gl = new QGridLayout;
const int CountOfColumn = 3;
QStringList formatList = QString(SUPPORT_FORMAT).remove("*.").split(' ');
QCheckBox *cb;
for(int i = 0, size = formatList.size(); i < size; ++i){
cb = new QCheckBox(formatList.at(i));
//! before connect(). otherwise it will launch the function changeAssociation(bool).
cb->setChecked(FileAssoc::checkAssociation(formatList.at(i)));
connect(cb, SIGNAL(toggled(bool)),
SLOT(changeAssociation(bool)));
gl->addWidget(cb, i / CountOfColumn, i % CountOfColumn);
}
QWidget *assocWidget = new QWidget(this);
assocWidget->setLayout(gl);
tab->addTab(assocWidget, tr("File Association"));
}
QVBoxLayout *layout = new QVBoxLayout(this);
layout->addWidget(tab);
setLayout(layout);
setWindowTitle(GlobalStr::PROJECT_NAME());
}
示例15: ShortcutsConfigBase
ShortcutsConfig::ShortcutsConfig(QWidget *parent, ShortcutsPlugin *plugin)
: ShortcutsConfigBase(parent)
{
m_plugin = plugin;
lstKeys->setSorting(0);
loadMenu(MenuMain, true);
loadMenu(MenuGroup, false);
loadMenu(MenuContact, false);
loadMenu(MenuStatus, true);
adjustColumns();
selectionChanged();
connect(lstKeys, SIGNAL(selectionChanged()), this, SLOT(selectionChanged()));
connect(edtKey, SIGNAL(changed()), this, SLOT(keyChanged()));
connect(btnClear, SIGNAL(clicked()), this, SLOT(keyClear()));
connect(chkGlobal, SIGNAL(toggled(bool)), this, SLOT(globalChanged(bool)));
for (QObject *p = parent; p != NULL; p = p->parent()){
if (!p->inherits("QTabWidget"))
continue;
QTabWidget *tab = static_cast<QTabWidget*>(p);
mouse_cfg = new MouseConfig(tab, plugin);
tab->addTab(mouse_cfg, i18n("Mouse"));
break;
}
}