本文整理汇总了C++中QTabWidget::setUsesScrollButtons方法的典型用法代码示例。如果您正苦于以下问题:C++ QTabWidget::setUsesScrollButtons方法的具体用法?C++ QTabWidget::setUsesScrollButtons怎么用?C++ QTabWidget::setUsesScrollButtons使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QTabWidget
的用法示例。
在下文中一共展示了QTabWidget::setUsesScrollButtons方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QSignalMapper
PreferencesDialog::PreferencesDialog()
{
setWindowTitle(tr("%1 - Preferences").arg(PROGRAM_NAME));
setAttribute(Qt::WA_DeleteOnClose);
sm_writer_state = new QSignalMapper(this);
sm_writer_format = new QSignalMapper(this);
sm_writer_postfix = new QSignalMapper(this);
QVBoxLayout* vbox = new QVBoxLayout(this);
vbox->setSizeConstraint(QLayout::SetFixedSize);
QTabWidget *tabWidget = new QTabWidget;
vbox->addWidget(tabWidget);
tabWidget->addTab(createRecordingTab(tabWidget), tr("Au&tomatic Recording"));
tabWidget->addTab(createPathTab(tabWidget), tr("&File paths"));
tabWidget->addTab(createFormatTab(tabWidget), tr("W&riters"));
tabWidget->addTab(createMiscTab(tabWidget), tr("&Misc"));
tabWidget->setUsesScrollButtons(false);
QHBoxLayout *hbox = new QHBoxLayout;
QPushButton* button = new QPushButton(tr("&Close"));
button->setDefault(true);
connect(button, SIGNAL(clicked(bool)), this, SLOT(accept()));
hbox->addStretch();
hbox->addWidget(button);
vbox->addLayout(hbox);
show();
}
示例2: QDialog
ConfigTabDialog::ConfigTabDialog(QWidget *parent_) :
QDialog(parent_)
{
QWidget *pStartupWidget = new QWidget;
_startupForm.setupUi(pStartupWidget);
QWidget *pHistoryWidget = new QWidget;
_historyForm.setupUi(pHistoryWidget);
QTabWidget *pTabWidget = new QTabWidget;
pTabWidget->addTab(pStartupWidget, QIcon(":/res/fork.png"), "Start");
pTabWidget->addTab(&_pathsWidget, QIcon(":/res/drive-harddisk.png"), QString::fromUtf8("Ścieżki"));
pTabWidget->addTab(pHistoryWidget, QIcon(":/res/document-save.png"), "Historia");
pTabWidget->setUsesScrollButtons(false);
QDialogButtonBox *pButtonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
connect(pButtonBox, SIGNAL(accepted()), this, SLOT(accept()));
connect(pButtonBox, SIGNAL(rejected()), this, SLOT(reject()));
QVBoxLayout *pMainLayout = new QVBoxLayout;
pMainLayout->addWidget(pTabWidget);
pMainLayout->addWidget(pButtonBox);
setLayout(pMainLayout);
setWindowTitle("Konfiguracja");
setWindowIcon(QIcon(":/res/configure.png"));
foreach (int version, DictInstance::versionList())
{
const DictInst& instance = DictInstance::dictInst(version);
_pathsWidget.addDictionary(instance.getForeignIconName(),
instance.getDescription(), version);
_startupForm.selectedComboBox->addItem(QIcon(instance.getForeignIconName()),
instance.getDescription(),
QVariant(version+YdpTypes::Foreign));
_startupForm.selectedComboBox->addItem(QIcon(instance.getNativeIconName()),
instance.getDescription(),
QVariant(version+YdpTypes::Native));
}
}
示例3: QDialog
PreferencesDialog::PreferencesDialog(Preferences& preferences, QWidget* parent)
: QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint),
m_preferences(preferences)
{
setWindowTitle(tr("Preferences"));
QTabWidget* tabs = new QTabWidget(this);
tabs->addTab(initGeneralTab(), tr("General"));
tabs->addTab(initStatisticsTab(), tr("Statistics"));
tabs->addTab(initToolbarTab(), tr("Toolbar"));
tabs->addTab(initSpellingTab(), tr("Spell Checking"));
tabs->setUsesScrollButtons(false);
QDialogButtonBox* buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, this);
connect(buttons, SIGNAL(accepted()), this, SLOT(accept()));
connect(buttons, SIGNAL(rejected()), this, SLOT(reject()));
QVBoxLayout* layout = new QVBoxLayout(this);
layout->addWidget(tabs);
layout->addWidget(buttons);
// Load settings
switch (m_preferences.goalType()) {
case 1:
m_option_time->setChecked(true);
break;
case 2:
m_option_wordcount->setChecked(true);
break;
default:
m_option_none->setChecked(true);
break;
}
m_time->setValue(m_preferences.goalMinutes());
m_wordcount->setValue(m_preferences.goalWords());
m_show_characters->setChecked(m_preferences.showCharacters());
m_show_pages->setChecked(m_preferences.showPages());
m_show_paragraphs->setChecked(m_preferences.showParagraphs());
m_show_words->setChecked(m_preferences.showWords());
switch (m_preferences.pageType()) {
case 1:
m_option_paragraphs->setChecked(true);
break;
case 2:
m_option_words->setChecked(true);
break;
default:
m_option_characters->setChecked(true);
break;
}
m_page_characters->setValue(m_preferences.pageCharacters());
m_page_paragraphs->setValue(m_preferences.pageParagraphs());
m_page_words->setValue(m_preferences.pageWords());
if (m_preferences.accurateWordcount()) {
m_option_accurate_wordcount->setChecked(true);
} else {
m_option_estimate_wordcount->setChecked(true);
}
m_always_center->setChecked(m_preferences.alwaysCenter());
m_block_cursor->setChecked(m_preferences.blockCursor());
m_rich_text->setChecked(m_preferences.richText());
m_smooth_fonts->setChecked(m_preferences.smoothFonts());
m_smart_quotes->setChecked(m_preferences.smartQuotes());
m_double_quotes->setCurrentIndex(m_preferences.doubleQuotes());
m_single_quotes->setCurrentIndex(m_preferences.singleQuotes());
m_typewriter_sounds->setChecked(m_preferences.typewriterSounds());
m_auto_save->setChecked(m_preferences.autoSave());
m_save_positions->setChecked(m_preferences.savePositions());
int style = m_toolbar_style->findData(m_preferences.toolbarStyle());
if (style == -1) {
style = m_toolbar_style->findData(Qt::ToolButtonTextUnderIcon);
}
m_toolbar_style->setCurrentIndex(style);
QStringList actions = m_preferences.toolbarActions();
int pos = 0;
foreach (const QString& action, actions) {
QString text = action;
bool checked = !text.startsWith("^");
if (!checked) {
text.remove(0, 1);
}
QListWidgetItem* item = 0;
if (text != "|") {
int count = m_toolbar_actions->count();
for (int i = pos; i < count; ++i) {
if (m_toolbar_actions->item(i)->data(Qt::UserRole).toString() == text) {
item = m_toolbar_actions->takeItem(i);
break;
}
}
} else if (checked) {
item = new QListWidgetItem(QString(20, QChar('-')));
item->setData(Qt::UserRole, "|");
//.........这里部分代码省略.........
示例4: createWidget
void ZObjsManagerWidget::createWidget()
{
QTabWidget *tabs = new QTabWidget(this);
tabs->setElideMode(Qt::ElideNone);
tabs->setUsesScrollButtons(true);
m_swcObjsTreeView = new QTreeView(this);
m_swcObjsTreeView->setTextElideMode(Qt::ElideLeft);
m_swcObjsTreeView->setExpandsOnDoubleClick(false);
m_swcObjsTreeView->setModel(m_doc->swcObjsModel());
m_swcObjsTreeView->setSelectionMode(QAbstractItemView::ExtendedSelection);
m_swcObjsTreeView->setContextMenuPolicy(Qt::CustomContextMenu);
connect(m_swcObjsTreeView, SIGNAL(doubleClicked(QModelIndex)),
this, SLOT(swcItemDoubleClicked(QModelIndex)));
connect(m_swcObjsTreeView->selectionModel(),
SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
this, SLOT(swcSelectionChangedFromTreeView(QItemSelection,QItemSelection)));
tabs->addTab(m_swcObjsTreeView, "Neurons");
if (NeutubeConfig::getInstance().getObjManagerConfig().isCategorizedSwcNodeOn()) {
m_swcNodeObjsTreeView = new QTreeView(this);
m_swcNodeObjsTreeView->setExpandsOnDoubleClick(false);
m_swcNodeObjsTreeView->setModel(m_doc->swcNodeObjsModel());
m_swcNodeObjsTreeView->setSelectionMode(QAbstractItemView::ExtendedSelection);
m_swcNodeObjsTreeView->setContextMenuPolicy(Qt::CustomContextMenu);
connect(m_swcNodeObjsTreeView, SIGNAL(doubleClicked(QModelIndex)),
this, SLOT(processDoubleClickOnCategorizedSwcNode(QModelIndex)));
connect(m_swcNodeObjsTreeView->selectionModel(),
SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
this, SLOT(updateSelectionFromCategorizedSwcNode(QItemSelection,QItemSelection)));
tabs->addTab(m_swcNodeObjsTreeView, "Neuron Nodes");
}
if (NeutubeConfig::getInstance().getMainWindowConfig().isMarkPunctaOn()) {
m_punctaObjsTreeView = new QTreeView(this);
m_punctaObjsTreeView->setSortingEnabled(true);
m_punctaObjsTreeView->setExpandsOnDoubleClick(false);
m_punctaProxyModel = new QSortFilterProxyModel(this);
m_punctaProxyModel->setSourceModel(m_doc->punctaObjsModel());
//m_punctaObjsTreeView->setModel(m_doc->punctaObjsModel());
m_punctaObjsTreeView->setModel(m_punctaProxyModel);
m_punctaObjsTreeView->setSelectionMode(QAbstractItemView::ExtendedSelection);
m_punctaObjsTreeView->setContextMenuPolicy(Qt::CustomContextMenu);
connect(m_punctaObjsTreeView, SIGNAL(doubleClicked(QModelIndex)),
this, SLOT(punctaItemDoubleClicked(QModelIndex)));
connect(m_punctaObjsTreeView->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
this, SLOT(punctaSelectionChangedFromTreeView(QItemSelection,QItemSelection)));
m_punctaObjsTreeView->sortByColumn(0, Qt::AscendingOrder);
tabs->addTab(m_punctaObjsTreeView, "Puncta");
}
if (GET_APPLICATION_NAME == "FlyEM") {
m_seedObjsTreeView = new QTreeView(this);
m_seedObjsTreeView->setSortingEnabled(false);
m_seedObjsTreeView->setExpandsOnDoubleClick(false);
m_seedObjsTreeView->setModel(m_doc->seedObjsModel());
m_seedObjsTreeView->setSelectionMode(QAbstractItemView::ExtendedSelection);
m_seedObjsTreeView->setContextMenuPolicy(Qt::CustomContextMenu);
tabs->addTab(m_seedObjsTreeView, "Seeds");
}
QHBoxLayout *layout = new QHBoxLayout;
layout->addWidget(tabs);
setLayout(layout);
if (m_doc->hasSelectedPuncta()) {
//std::set<ZPunctum*> *selectedPuncta = m_doc->selectedPuncta();
QList<ZPunctum*> selected =
m_doc->getSelectedObjectList<ZPunctum>(ZStackObject::TYPE_PUNCTUM);
QList<ZPunctum*> deselected;
//std::copy(selectedPuncta->begin(), selectedPuncta->end(), std::back_inserter(selected));
punctaSelectionChanged(selected, deselected);
}
if (!m_doc->hasSelectedSwc()) {
//std::set<ZSwcTree*> *selectedSwcs = m_doc->selectedSwcs();
QList<ZSwcTree*> selected =
m_doc->getSelectedObjectList<ZSwcTree>(ZStackObject::TYPE_SWC);
QList<ZSwcTree*> deselected;
//std::copy(selectedSwcs->begin(), selectedSwcs->end(), std::back_inserter(selected));
swcSelectionChanged(selected, deselected);
}
if (m_doc->hasSelectedSwcNode()) {
std::set<Swc_Tree_Node*> nodeSet = m_doc->getSelectedSwcNodeSet();
QList<Swc_Tree_Node*> selected;
QList<Swc_Tree_Node*> deselected;
std::copy(nodeSet.begin(), nodeSet.end(),
std::back_inserter(selected));
swcTreeNodeSelectionChanged(selected, deselected);
}
connect(m_doc,
SIGNAL(punctaSelectionChanged(QList<ZPunctum*>,QList<ZPunctum*>)),
this, SLOT(punctaSelectionChanged(QList<ZPunctum*>,QList<ZPunctum*>)));
connect(m_doc,
SIGNAL(swcSelectionChanged(QList<ZSwcTree*>,QList<ZSwcTree*>)),
this, SLOT(swcSelectionChanged(QList<ZSwcTree*>,QList<ZSwcTree*>)));
connect(m_doc,
SIGNAL(swcTreeNodeSelectionChanged(QList<Swc_Tree_Node*>,QList<Swc_Tree_Node*>)),
this, SLOT(swcTreeNodeSelectionChanged(QList<Swc_Tree_Node*>,QList<Swc_Tree_Node*>)));
}
示例5: dialog
/**
* \fn qt4DiaFactoryRunTabs
*/
uint8_t qt4DiaFactoryRunTabs(const char *title,uint32_t nb,diaElemTabs **tabs)
{
QDialog dialog(qtLastRegisteredDialog());
qtRegisterDialog(&dialog);
ADM_assert(title);
ADM_assert(nb);
ADM_assert(tabs);
dialog.setWindowTitle(QString::fromUtf8(title));
QVBoxLayout *vboxLayout = new QVBoxLayout();
QGridLayout *layout = new QGridLayout();
QSpacerItem *spacer = new QSpacerItem(20, 16, QSizePolicy::Minimum, QSizePolicy::Fixed);
QTabWidget *wtabs = new QTabWidget();
QDialogButtonBox *buttonBox = new QDialogButtonBox();
buttonBox->setStandardButtons(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
QObject::connect(buttonBox, SIGNAL(accepted()), &dialog, SLOT(accept()));
QObject::connect(buttonBox, SIGNAL(rejected()), &dialog, SLOT(reject()));
for(int i=0;i<nb;i++)
{
ADM_assert(tabs[i]);
insertTab(i,tabs[i],wtabs);
}
vboxLayout->addLayout(layout);
vboxLayout->addWidget(wtabs,0,0);
vboxLayout->addItem(spacer);
vboxLayout->addWidget(buttonBox,1,0);
dialog.setLayout(vboxLayout);
// Expand to see all tabs but still allow the window to be resized smaller
wtabs->setUsesScrollButtons(false);
dialog.adjustSize();
wtabs->setUsesScrollButtons(true);
if(dialog.exec()==QDialog::Accepted)
{
// Read tabs
for(int tab=0;tab<nb;tab++)
{
ADM_assert(tabs[tab]);
diaElemTabs *myTab=tabs[tab];
for(int i=0;i<myTab->nbElems;i++)
{
myTab->dias[i]->getMe();
}
}
qtUnregisterDialog(&dialog);
return 1;
}
qtUnregisterDialog(&dialog);
return 0;
}
示例6: setUsesScrollButtons
void QTabWidgetProto::setUsesScrollButtons(bool useButtons)
{
QTabWidget *item = qscriptvalue_cast<QTabWidget*>(thisObject());
if (item)
item->setUsesScrollButtons(useButtons);
}
示例7: if
ExtendedAboutDialog::ExtendedAboutDialog(const KAboutData *aboutData, const OcsData *ocsData, QWidget *parent)
: KDialog(parent)
, d(new Private(this))
{
DEBUG_BLOCK
if (aboutData == 0)
aboutData = KGlobal::mainComponent().aboutData();
d->aboutData = aboutData;
if (!aboutData) {
QLabel *errorLabel = new QLabel(i18n("<qt>No information available.<br />"
"The supplied KAboutData object does not exist.</qt>"), this);
errorLabel->setTextInteractionFlags(Qt::TextBrowserInteraction);
setMainWidget(errorLabel);
return;
}
if( !ocsData )
{
QLabel *errorLabel = new QLabel(i18n("<qt>No information available.<br />"
"The supplied OcsData object does not exist.</qt>"), this);
errorLabel->setTextInteractionFlags(Qt::TextBrowserInteraction);
setMainWidget(errorLabel);
return;
}
m_ocsData = *ocsData;
setPlainCaption(i18n("About %1", aboutData->programName()));
setButtons(KDialog::Close);
setDefaultButton(KDialog::Close);
setModal(false);
//Set up the title widget...
KTitleWidget *titleWidget = new KTitleWidget(this);
QIcon windowIcon;
if (!aboutData->programIconName().isEmpty()) {
windowIcon = KIcon(aboutData->programIconName());
} else {
windowIcon = qApp->windowIcon();
}
titleWidget->setPixmap(windowIcon.pixmap(64, 64), KTitleWidget::ImageLeft);
if (aboutData->programLogo().canConvert<QPixmap>())
titleWidget->setPixmap(aboutData->programLogo().value<QPixmap>(), KTitleWidget::ImageLeft);
else if (aboutData->programLogo().canConvert<QImage>())
titleWidget->setPixmap(QPixmap::fromImage(aboutData->programLogo().value<QImage>()), KTitleWidget::ImageLeft);
titleWidget->setText(i18n("<html><font size=\"5\">%1</font><br /><b>Version %2</b><br />Using KDE %3</html>",
aboutData->programName(), aboutData->version(), KDE::versionString()));
//Now let's add the tab bar...
QTabWidget *tabWidget = new QTabWidget;
tabWidget->setUsesScrollButtons(false);
//Set up the first page...
QString aboutPageText = aboutData->shortDescription() + '\n';
if (!aboutData->otherText().isEmpty())
aboutPageText += '\n' + aboutData->otherText() + '\n';
if (!aboutData->copyrightStatement().isEmpty())
aboutPageText += '\n' + aboutData->copyrightStatement() + '\n';
if (!aboutData->homepage().isEmpty())
aboutPageText += '\n' + QString("<a href=\"%1\">%1</a>").arg(aboutData->homepage()) + '\n';
aboutPageText = aboutPageText.trimmed();
QLabel *aboutLabel = new QLabel;
aboutLabel->setWordWrap(true);
aboutLabel->setOpenExternalLinks(true);
aboutLabel->setText(aboutPageText.replace('\n', "<br />"));
aboutLabel->setTextInteractionFlags(Qt::TextBrowserInteraction);
QVBoxLayout *aboutLayout = new QVBoxLayout;
aboutLayout->addStretch();
aboutLayout->addWidget(aboutLabel);
const int licenseCount = aboutData->licenses().count();
debug()<< "About to show license stuff";
debug()<< "License count is"<<licenseCount;
for (int i = 0; i < licenseCount; ++i) {
const KAboutLicense &license = aboutData->licenses().at(i);
QLabel *showLicenseLabel = new QLabel;
showLicenseLabel->setText(QString("<a href=\"%1\">%2</a>").arg(QString::number(i),
i18n("License: %1",
license.name(KAboutData::FullName))));
showLicenseLabel->setTextInteractionFlags(Qt::TextBrowserInteraction);
connect(showLicenseLabel, SIGNAL(linkActivated(QString)), this, SLOT(_k_showLicense(QString)));
aboutLayout->addWidget(showLicenseLabel);
}
debug()<<"License widget added";
aboutLayout->addStretch();
//.........这里部分代码省略.........
示例8: setUsesScrollButtons
int TabWidget::setUsesScrollButtons ( lua_State * L ) //( bool useButtons )void
{
QTabWidget* obj = ObjectHelper<QTabWidget>::check( L, 1 );
obj->setUsesScrollButtons( Util::toBool( L, 2 ) );
return 0;
}