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


C++ QLayout::setSpacing方法代码示例

本文整理汇总了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);
    }
}
开发者ID:AlbanBedel,项目名称:mixxx,代码行数:28,代码来源:wwidgetgroup.cpp

示例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();
}
开发者ID:iananass,项目名称:smooth-task-next,代码行数:12,代码来源:SmoothToolTip.cpp

示例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);
    }
开发者ID:55171514,项目名称:qtcreator,代码行数:53,代码来源:searchwidget.cpp

示例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
}
开发者ID:ElderOrb,项目名称:qctools,代码行数:28,代码来源:PlotLegend.cpp

示例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 );
}
开发者ID:Erkan-Yilmaz,项目名称:lastfm-desktop,代码行数:7,代码来源:ItemSelectorWidget.cpp

示例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);
}
开发者ID:Zeitmaus,项目名称:tiled,代码行数:31,代码来源:tilesetdock.cpp

示例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)));
}
开发者ID:Mr-Kumar-Abhishek,项目名称:qt,代码行数:59,代码来源:qtresourceview.cpp

示例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);
}
开发者ID:NyFanomezana,项目名称:freemedforms,代码行数:58,代码来源:identitywidgetfactory.cpp

示例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);
}
开发者ID:sudowork,项目名称:GaoChat,代码行数:45,代码来源:clientgui.cpp

示例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);
    }
}
开发者ID:suyoghc,项目名称:mixxx,代码行数:45,代码来源:wwidgetgroup.cpp

示例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);
    }
}
开发者ID:xtuer,项目名称:Qt,代码行数:10,代码来源:UiUtil.cpp

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

示例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();
}
开发者ID:ugeneunipro,项目名称:ugene,代码行数:39,代码来源:DotPlotSplitter.cpp

示例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);
}
开发者ID:KDE,项目名称:rocs,代码行数:13,代码来源:grapheditorwidget.cpp

示例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();
}
开发者ID:AgnosticPope,项目名称:qt-creator,代码行数:51,代码来源:bookmarkmanager.cpp


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