本文整理汇总了C++中QLayout::setSpacing方法的典型用法代码示例。如果您正苦于以下问题:C++ QLayout::setSpacing方法的具体用法?C++ QLayout::setSpacing怎么用?C++ QLayout::setSpacing使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QLayout
的用法示例。
在下文中一共展示了QLayout::setSpacing方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setup
void WWidgetGroup::setup(QDomNode node) {
setContentsMargins(0, 0, 0, 0);
// Set background pixmap if available
if (!WWidget::selectNode(node, "BackPath").isNull()) {
setPixmapBackground(WWidget::getPath(WWidget::selectNodeQString(node, "BackPath")));
}
QLayout* pLayout = NULL;
if (!XmlParse::selectNode(node, "Layout").isNull()) {
QString layout = XmlParse::selectNodeQString(node, "Layout");
if (layout == "vertical") {
pLayout = new QVBoxLayout();
pLayout->setSpacing(0);
pLayout->setContentsMargins(0, 0, 0, 0);
pLayout->setAlignment(Qt::AlignCenter);
} else if (layout == "horizontal") {
pLayout = new QHBoxLayout();
pLayout->setSpacing(0);
pLayout->setContentsMargins(0, 0, 0, 0);
pLayout->setAlignment(Qt::AlignCenter);
}
}
if (pLayout) {
setLayout(pLayout);
}
}
示例2: previewLayoutChanged
void SmoothToolTip::previewLayoutChanged(Applet::PreviewLayoutType previewLayout) {
QLayout *layout = m_widget->layout();
switch (previewLayout) {
case Applet::NewPreviewLayout:
layout->setSpacing(0);
break;
case Applet::ClassicPreviewLayout:
default:
layout->setSpacing(3);
}
layout->activate();
}
示例3: showEvent
void SearchWidget::showEvent(QShowEvent *event)
{
if (!event->spontaneous() && !searchEngine) {
QVBoxLayout *vLayout = new QVBoxLayout(this);
vLayout->setMargin(0);
vLayout->setSpacing(0);
searchEngine = new QHelpSearchEngine(&LocalHelpManager::helpEngine(), this);
Utils::StyledBar *toolbar = new Utils::StyledBar(this);
toolbar->setSingleRow(false);
QHelpSearchQueryWidget *queryWidget = searchEngine->queryWidget();
QLayout *tbLayout = new QVBoxLayout();
tbLayout->setSpacing(6);
tbLayout->setMargin(4);
tbLayout->addWidget(queryWidget);
toolbar->setLayout(tbLayout);
Utils::StyledBar *toolbar2 = new Utils::StyledBar(this);
toolbar2->setSingleRow(false);
tbLayout = new QVBoxLayout();
tbLayout->setSpacing(0);
tbLayout->setMargin(0);
tbLayout->addWidget(resultWidget = searchEngine->resultWidget());
toolbar2->setLayout(tbLayout);
vLayout->addWidget(toolbar);
vLayout->addWidget(toolbar2);
setFocusProxy(queryWidget);
connect(queryWidget, SIGNAL(search()), this, SLOT(search()));
connect(resultWidget, &QHelpSearchResultWidget::requestShowLink, this,
[this](const QUrl &url) {
emit linkActivated(url, currentSearchTerms(), false/*newPage*/);
});
connect(searchEngine, SIGNAL(searchingStarted()), this,
SLOT(searchingStarted()));
connect(searchEngine, SIGNAL(searchingFinished(int)), this,
SLOT(searchingFinished(int)));
QTextBrowser* browser = resultWidget->findChild<QTextBrowser*>();
browser->viewport()->installEventFilter(this);
connect(searchEngine, SIGNAL(indexingStarted()), this,
SLOT(indexingStarted()));
connect(searchEngine, SIGNAL(indexingFinished()), this,
SLOT(indexingFinished()));
QMetaObject::invokeMethod(&LocalHelpManager::helpEngine(), "setupFinished",
Qt::QueuedConnection);
}
示例4: QwtLegend
//---------------------------------------------------------------------------
PlotLegend::PlotLegend( QWidget *parent ):
QwtLegend( parent )
{
setMinimumHeight( 1 );
setMaxColumns( 1 );
setContentsMargins( 0, 0, 0, 0 );
QLayout* layout = contentsWidget()->layout();
layout->setAlignment( Qt::AlignLeft | Qt::AlignTop );
layout->setSpacing( 0 );
QScrollArea *scrollArea = findChild<QScrollArea *>();
if ( scrollArea )
{
scrollArea->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
scrollArea->setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
}
#if 1
QFont fnt = font();
if ( fnt.pointSize() > 8 )
{
fnt.setPointSize( 8 );
setFont( fnt );
}
#endif
}
示例5: FlowLayout
ItemSelectorWidget::ItemSelectorWidget( QWidget* parent )
:StylableWidget(parent), m_clearText( false )
{
QLayout* layout = new FlowLayout( this, 0, 0, 0 );
layout->setContentsMargins( 0, 0, 0, 0 );
layout->setSpacing( 0 );
}
示例6: QDockWidget
TilesetDock::TilesetDock(QWidget *parent):
QDockWidget(parent),
mMapDocument(0),
mDropDown(new QComboBox),
mViewStack(new QStackedWidget),
mCurrentTile(0),
mCurrentTiles(0)
{
setObjectName(QLatin1String("TilesetDock"));
QWidget *w = new QWidget(this);
QLayout *l = new QVBoxLayout(w);
l->setSpacing(0);
l->setMargin(0);
l->addWidget(mDropDown);
l->addWidget(mViewStack);
mDropDown->setEditable(false);
connect(mDropDown, SIGNAL(currentIndexChanged(int)),
mViewStack, SLOT(setCurrentIndex(int)));
connect(mViewStack, SIGNAL(currentChanged(int)),
this, SLOT(updateCurrentTiles()));
connect(TilesetManager::instance(), SIGNAL(tilesetChanged(Tileset*)),
this, SLOT(tilesetChanged(Tileset*)));
setWidget(w);
retranslateUi();
setAcceptDrops(true);
}
示例7: QWidget
QtResourceView::QtResourceView(QDesignerFormEditorInterface *core, QWidget *parent) :
QWidget(parent),
d_ptr(new QtResourceViewPrivate(core))
{
d_ptr->q_ptr = this;
QIcon editIcon = QIcon::fromTheme("document-properties", qdesigner_internal::createIconSet(QLatin1String("edit.png")));
d_ptr->m_editResourcesAction = new QAction(editIcon, tr("Edit Resources..."), this);
d_ptr->m_toolBar->addAction(d_ptr->m_editResourcesAction);
connect(d_ptr->m_editResourcesAction, SIGNAL(triggered()), this, SLOT(slotEditResources()));
d_ptr->m_editResourcesAction->setEnabled(false);
QIcon refreshIcon = QIcon::fromTheme("view-refresh", qdesigner_internal::createIconSet(QLatin1String("reload.png")));
d_ptr->m_reloadResourcesAction = new QAction(refreshIcon, tr("Reload"), this);
d_ptr->m_toolBar->addAction(d_ptr->m_reloadResourcesAction);
connect(d_ptr->m_reloadResourcesAction, SIGNAL(triggered()), this, SLOT(slotReloadResources()));
d_ptr->m_reloadResourcesAction->setEnabled(false);
QIcon copyIcon = QIcon::fromTheme("edit-copy", qdesigner_internal::createIconSet(QLatin1String("editcopy.png")));
d_ptr->m_copyResourcePathAction = new QAction(copyIcon, tr("Copy Path"), this);
connect(d_ptr->m_copyResourcePathAction, SIGNAL(triggered()), this, SLOT(slotCopyResourcePath()));
d_ptr->m_copyResourcePathAction->setEnabled(false);
//d_ptr->m_filterWidget = new qdesigner_internal::FilterWidget(0, qdesigner_internal::FilterWidget::LayoutAlignNone);
d_ptr->m_filterWidget = new qdesigner_internal::FilterWidget(d_ptr->m_toolBar);
d_ptr->m_toolBar->addWidget(d_ptr->m_filterWidget);
connect(d_ptr->m_filterWidget, SIGNAL(filterChanged(QString)), this, SLOT(slotFilterChanged(QString)));
d_ptr->m_splitter = new QSplitter;
d_ptr->m_splitter->setChildrenCollapsible(false);
d_ptr->m_splitter->addWidget(d_ptr->m_treeWidget);
d_ptr->m_splitter->addWidget(d_ptr->m_listWidget);
QLayout *layout = new QVBoxLayout(this);
layout->setMargin(0);
layout->setSpacing(0);
layout->addWidget(d_ptr->m_toolBar);
layout->addWidget(d_ptr->m_splitter);
d_ptr->m_treeWidget->setColumnCount(1);
d_ptr->m_treeWidget->header()->hide();
d_ptr->m_treeWidget->setSizePolicy(QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding));
d_ptr->m_listWidget->setViewMode(QListView::IconMode);
d_ptr->m_listWidget->setResizeMode(QListView::Adjust);
d_ptr->m_listWidget->setIconSize(QSize(48, 48));
d_ptr->m_listWidget->setGridSize(QSize(64, 64));
connect(d_ptr->m_treeWidget, SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)),
this, SLOT(slotCurrentPathChanged(QTreeWidgetItem*)));
connect(d_ptr->m_listWidget, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)),
this, SLOT(slotCurrentResourceChanged(QListWidgetItem*)));
connect(d_ptr->m_listWidget, SIGNAL(itemActivated(QListWidgetItem*)),
this, SLOT(slotResourceActivated(QListWidgetItem*)));
d_ptr->m_listWidget->setContextMenuPolicy(Qt::CustomContextMenu);
connect(d_ptr->m_listWidget, SIGNAL(customContextMenuRequested(QPoint)),
this, SLOT(slotListWidgetContextMenuRequested(QPoint)));
}
示例8: setObjectName
IdentityFormWidget::IdentityFormWidget(Form::FormItem *formItem, QWidget *parent) :
Form::IFormWidget(formItem,parent),
m_ContainerLayout(0)
{
setObjectName("IdentityFormWidget");
// Create the central widget / layout
QGridLayout *mainLayout = new QGridLayout(this);
mainLayout->setSpacing(0);
mainLayout->setMargin(0);
// get options
const QStringList &options = formItem->getOptions();
m_Identity = new Identity::IdentityEditorWidget(this);
m_Identity->initialize();
Identity::IdentityEditorWidget::AvailableWidgets widgets = Identity::IdentityEditorWidget::FullIdentity;
if (options.contains("with-photo", Qt::CaseInsensitive))
widgets |= Identity::IdentityEditorWidget::Photo;
if (options.contains("with-address", Qt::CaseInsensitive))
widgets |= Identity::IdentityEditorWidget::FullAddress;
if (options.contains("with-login", Qt::CaseInsensitive))
widgets |= Identity::IdentityEditorWidget::FullLogin;
m_Identity->setAvailableWidgets(widgets);
if (options.contains("xml", Qt::CaseInsensitive))
m_Identity->setXmlInOut(true);
if (options.contains("readonly", Qt::CaseInsensitive))
m_Identity->setReadOnly(true);
// QtUi Loaded ?
const QString &layout = formItem->spec()->value(Form::FormItemSpec::Spec_UiInsertIntoLayout).toString();
if (!layout.isEmpty()) {
// Find layout
QLayout *lay = formItem->parentFormMain()->formWidget()->findChild<QLayout*>(layout);
if (lay) {
lay->addWidget(m_Identity);
lay->setMargin(0);
lay->setSpacing(0);
} else {
LOG_ERROR("Using the QtUiLinkage, layout not found in the ui: " + formItem->uuid());
}
} else {
mainLayout->addWidget(m_Identity, 1, 0);
}
if (options.contains("compact", Qt::CaseInsensitive)) {
m_Identity->layout()->setSpacing(0);
m_Identity->layout()->setMargin(0);
}
setFocusedWidget(m_Identity);
// create itemdata
IdentityWidgetData *data = new IdentityWidgetData(m_FormItem);
data->setIdentityFormWiget(this);
m_FormItem->setItemData(data);
}
示例9: QWidget
Tab::Tab(QWidget *parent) : QWidget (parent) {
// Will contain chat window and list of online peers
outputSplitter = new QSplitter;
// Will split the outputSplitter from the input line
inputSplitter = new QSplitter;
inputSplitter->setOrientation(Qt::Vertical);
// Contains the top portion (output) and bottom (input)
QLayout *groupLayout = new QVBoxLayout;
// Chat input
chatInput = new QTextEdit;
chatInput->setMinimumHeight(20);
chatInput->setMaximumHeight(100);
chatInput->installEventFilter(this);
// Add chat viewer and chat input to main splitter
inputSplitter->addWidget(outputSplitter);
inputSplitter->addWidget(chatInput);
// Configure sizing for main vertical splitter
inputSplitter->setStretchFactor(0,99);
inputSplitter->setStretchFactor(1,1);
inputSplitter->setCollapsible(1,false);
// Populate chat container
QWidget *chatContainer = new QWidget;
QLayout *chatContainerLayout = new QVBoxLayout;
chat = new QTextBrowser;
chatContainerLayout->addWidget(new QLabel("Chat:"));
chatContainerLayout->addWidget(chat);
chatContainerLayout->setMargin(0);
chatContainerLayout->setSpacing(2);
chatContainer->setLayout(chatContainerLayout);
// Add chat viewer and online list to splitter
outputSplitter->addWidget(chatContainer);
groupLayout->addWidget(inputSplitter);
groupLayout->setMargin(10);
groupLayout->setSpacing(5);
setLayout(groupLayout);
this->setParent(parent);
}
示例10: setup
void WWidgetGroup::setup(QDomNode node, const SkinContext& context) {
setContentsMargins(0, 0, 0, 0);
// Set background pixmap if available
if (context.hasNode(node, "BackPath")) {
setPixmapBackground(context.getSkinPath(context.selectString(node, "BackPath")));
}
QLayout* pLayout = NULL;
if (context.hasNode(node, "Layout")) {
QString layout = context.selectString(node, "Layout");
if (layout == "vertical") {
pLayout = new QVBoxLayout();
pLayout->setSpacing(0);
pLayout->setContentsMargins(0, 0, 0, 0);
pLayout->setAlignment(Qt::AlignCenter);
} else if (layout == "horizontal") {
pLayout = new QHBoxLayout();
pLayout->setSpacing(0);
pLayout->setContentsMargins(0, 0, 0, 0);
pLayout->setAlignment(Qt::AlignCenter);
}
}
if (pLayout && context.hasNode(node, "SizeConstraint")) {
QMap<QString, QLayout::SizeConstraint> constraints;
constraints["SetDefaultConstraint"] = QLayout::SetDefaultConstraint;
constraints["SetFixedSize"] = QLayout::SetFixedSize;
constraints["SetMinimumSize"] = QLayout::SetMinimumSize;
constraints["SetMaximumSize"] = QLayout::SetMaximumSize;
constraints["SetMinAndMaxSize"] = QLayout::SetMinAndMaxSize;
constraints["SetNoConstraint"] = QLayout::SetNoConstraint;
QString sizeConstraintStr = context.selectString(node, "SizeConstraint");
if (constraints.contains(sizeConstraintStr)) {
pLayout->setSizeConstraint(constraints[sizeConstraintStr]);
} else {
qDebug() << "Could not parse SizeConstraint:" << sizeConstraintStr;
}
}
if (pLayout) {
setLayout(pLayout);
}
}
示例11: setWidgetPaddingAndSpacing
// 设置 widget 的 padding 和 spacing
void UiUtil::setWidgetPaddingAndSpacing(QWidget *widget, int padding, int spacing) {
// 设置 Widget 的 padding 和 spacing
QLayout *layout = widget->layout();
if (nullptr != layout) {
layout->setContentsMargins(padding, padding, padding, padding);
layout->setSpacing(spacing);
}
}
示例12: setLayoutSpacing
void WWidgetGroup::setLayoutSpacing(int spacing) {
//qDebug() << "WWidgetGroup::setSpacing" << spacing;
if (spacing < 0) {
qDebug() << "WWidgetGroup: Invalid spacing:" << spacing;
return;
}
QLayout* pLayout = layout();
if (pLayout) {
pLayout->setSpacing(spacing);
}
}
示例13: ADVSplitWidget
DotPlotSplitter::DotPlotSplitter(AnnotatedDNAView* a)
: ADVSplitWidget(a),
locked(false)
{
syncLockAction = createAction(":core/images/sync_lock.png", tr("Multiple view synchronization lock"), SLOT(sl_toggleSyncLock(bool)));
filterAction = createAction(":dotplot/images/filter.png", tr("Filter results"), SLOT(sl_toggleFilter()), false);
zoomInAction = createAction(":core/images/zoom_in.png", tr("Zoom in (<b> + </b>)"), SLOT(sl_toggleZoomIn()), false);
zoomOutAction = createAction(":core/images/zoom_out.png", tr("Zoom out (<b> - </b>)"), SLOT(sl_toggleZoomOut()), false);
resetZoomingAction = createAction(":core/images/zoom_whole.png", tr("Reset zooming (<b>0</b>)"), SLOT(sl_toggleZoomReset()), false);
selAction = createAction(":dotplot/images/cursor.png", tr("Select tool (<b>S</b>)"), SLOT(sl_toggleSel()));
handAction = createAction(":dotplot/images/hand_icon.png", tr("Hand tool (<b>H</b>)"), SLOT(sl_toggleHand()));
splitter = new QSplitter(Qt::Horizontal);
WidgetWithLocalToolbar* wgt = new WidgetWithLocalToolbar(this);
QLayout* l = new QVBoxLayout();
l->setMargin(0);
l->setSpacing(0);
l->addWidget(splitter);
wgt->setContentLayout(l);
wgt->addActionToLocalToolbar(filterAction);
wgt->addActionToLocalToolbar(syncLockAction);
wgt->addActionToLocalToolbar(zoomInAction);
wgt->addActionToLocalToolbar(zoomOutAction);
wgt->addActionToLocalToolbar(resetZoomingAction);
wgt->addActionToLocalToolbar(selAction);
wgt->addActionToLocalToolbar(handAction);
QLayout* mainLayout = new QVBoxLayout();
mainLayout->setSpacing(0);
mainLayout->setMargin(0);
mainLayout->addWidget(wgt);
setLayout(mainLayout);
setAcceptDrops(false);
setFocus();
}
示例14: QWidget
GraphEditorWidget::GraphEditorWidget(QWidget *parent)
: QWidget(parent)
, m_viewWidgets(new QTabWidget(this))
, m_project(0)
, m_editor(0)
{
QLayout *layout = new QVBoxLayout();
m_viewWidgets->setTabsClosable(false);
m_viewWidgets->setMovable(true);
layout->addWidget(m_viewWidgets);
layout->setSpacing(0);
setLayout(layout);
}
示例15: setup
void BookmarkWidget::setup()
{
regExp.setPatternSyntax(QRegExp::FixedString);
regExp.setCaseSensitivity(Qt::CaseInsensitive);
QLayout *vlayout = new QVBoxLayout(this);
vlayout->setMargin(0);
vlayout->setSpacing(0);
searchField = new Utils::FancyLineEdit(this);
searchField->setFiltering(true);
setFocusProxy(searchField);
Utils::StyledBar *toolbar = new Utils::StyledBar(this);
toolbar->setSingleRow(false);
QLayout *tbLayout = new QHBoxLayout();
tbLayout->setMargin(4);
tbLayout->addWidget(searchField);
toolbar->setLayout(tbLayout);
vlayout->addWidget(toolbar);
searchField->installEventFilter(this);
connect(searchField, &Utils::FancyLineEdit::textChanged,
this, &BookmarkWidget::filterChanged);
treeView = new TreeView(this);
vlayout->addWidget(treeView);
filterBookmarkModel = new QSortFilterProxyModel(this);
treeView->setModel(filterBookmarkModel);
treeView->setDragEnabled(true);
treeView->setAcceptDrops(true);
treeView->setAutoExpandDelay(1000);
treeView->setDropIndicatorShown(true);
treeView->viewport()->installEventFilter(this);
treeView->setContextMenuPolicy(Qt::CustomContextMenu);
connect(treeView, &TreeView::expanded, this, &BookmarkWidget::expand);
connect(treeView, &TreeView::collapsed, this, &BookmarkWidget::expand);
connect(treeView, &TreeView::activated, this, &BookmarkWidget::activated);
connect(treeView, &TreeView::customContextMenuRequested,
this, &BookmarkWidget::customContextMenuRequested);
filterBookmarkModel->setFilterKeyColumn(0);
filterBookmarkModel->setDynamicSortFilter(true);
filterBookmarkModel->setSourceModel(bookmarkManager->treeBookmarkModel());
expandItems();
}