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


C++ QSizePolicy::verticalPolicy方法代码示例

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


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

示例1: valueToString

QString KPropertySizePolicyDelegate::valueToString(const QVariant& value, const QLocale &locale) const
{
    const QSizePolicy sp(value.value<QSizePolicy>());
    if (locale.language() == QLocale::C) {
        return QString::fromLatin1("%1, %2, %3, %4")
                .arg(KPropertyUtils::keyForEnumValue("SizePolicy", sp.horizontalPolicy()))
                .arg(KPropertyUtils::keyForEnumValue("SizePolicy", sp.verticalPolicy()))
                .arg(sp.horizontalStretch())
                .arg(sp.verticalStretch());
    }
    return QObject::tr("%1, %2, %3, %4", "Size Policy")
        .arg(s_sizePolicyListData->nameForPolicy(sp.horizontalPolicy()))
        .arg(s_sizePolicyListData->nameForPolicy(sp.verticalPolicy()))
        .arg(locale.toString(sp.horizontalStretch()))
        .arg(locale.toString(sp.verticalStretch()));
}
开发者ID:KDE,项目名称:kproperty,代码行数:16,代码来源:sizepolicyedit.cpp

示例2: setValue

void SizePolicyComposedProperty::setValue(Property *property,
    const QVariant &value, bool rememberOldValue)
{
    const QSizePolicy sp( value.value<QSizePolicy>() );
    property->child("hor_policy")->setValue(sp.horizontalPolicy(), rememberOldValue, false);
    property->child("vert_policy")->setValue(sp.verticalPolicy(), rememberOldValue, false);
    property->child("hor_stretch")->setValue(sp.horizontalStretch(), rememberOldValue, false);
    property->child("vert_stretch")->setValue(sp.verticalStretch(), rememberOldValue, false);
}
开发者ID:crayonink,项目名称:calligra-2,代码行数:9,代码来源:sizepolicyedit.cpp

示例3: setGeometry

/*!
    \reimp
*/
void QWidgetItem::setGeometry(const QRect &rect)
{
    if (isEmpty())
        return;

    QRect r = !wid->testAttribute(Qt::WA_LayoutUsesWidgetRect)
            ? fromLayoutItemRect(wid->d_func(), rect)
            : rect;
    const QSize widgetRectSurplus = r.size() - rect.size(); 

    /* 
       For historical reasons, this code is done using widget rect 
       coordinates, not layout item rect coordinates. However, 
       QWidgetItem's sizeHint(), maximumSize(), and heightForWidth() 
       all work in terms of layout item rect coordinates, so we have to 
       add or subtract widgetRectSurplus here and there. The code could 
       be much simpler if we did everything using layout item rect 
       coordinates and did the conversion right before the call to 
       QWidget::setGeometry(). 
     */ 

    QSize s = r.size().boundedTo(maximumSize() + widgetRectSurplus);  
    int x = r.x();
    int y = r.y();
    if (align & (Qt::AlignHorizontal_Mask | Qt::AlignVertical_Mask)) {
        QSize pref(sizeHint());
        QSizePolicy sp = wid->sizePolicy();
        if (sp.horizontalPolicy() == QSizePolicy::Ignored)
            pref.setWidth(wid->sizeHint().expandedTo(wid->minimumSize()).width());
        if (sp.verticalPolicy() == QSizePolicy::Ignored)
            pref.setHeight(wid->sizeHint().expandedTo(wid->minimumSize()).height());
        pref += widgetRectSurplus;
        if (align & Qt::AlignHorizontal_Mask)
            s.setWidth(qMin(s.width(), pref.width()));
        if (align & Qt::AlignVertical_Mask) {
            if (hasHeightForWidth())
                s.setHeight(qMin(s.height(), 
                                 heightForWidth(s.width() - widgetRectSurplus.width()) 
                                 + widgetRectSurplus.height()));
            else
                s.setHeight(qMin(s.height(), pref.height()));
        }
    }
    Qt::Alignment alignHoriz = QStyle::visualAlignment(wid->layoutDirection(), align);
    if (alignHoriz & Qt::AlignRight)
        x = x + (r.width() - s.width());
    else if (!(alignHoriz & Qt::AlignLeft))
        x = x + (r.width() - s.width()) / 2;

    if (align & Qt::AlignBottom)
        y = y + (r.height() - s.height());
    else if (!(align & Qt::AlignTop))
        y = y + (r.height() - s.height()) / 2;

    wid->setGeometry(x, y, s.width(), s.height());
}
开发者ID:cdaffara,项目名称:symbiandump-mw3,代码行数:59,代码来源:qlayoutitem.cpp

示例4: displayText

QString SizePolicyDelegate::displayText( const QVariant& value ) const
{
    const QSizePolicy sp(value.value<QSizePolicy>());

    return QString::fromLatin1(SIZEPOLICY_MASK)
        .arg(s_sizePolicyListData->nameForPolicy(sp.horizontalPolicy()))
        .arg(s_sizePolicyListData->nameForPolicy(sp.verticalPolicy()))
        .arg(sp.horizontalStretch())
        .arg(sp.verticalStretch());
}
开发者ID:crayonink,项目名称:calligra-2,代码行数:10,代码来源:sizepolicyedit.cpp

示例5: WBHistoryCompletionModel

WBWebView *WBTabWidget::newTab(bool makeCurrent)
{
    // line edit
    WBUrlLineEdit *urlLineEdit = new WBUrlLineEdit;

    QSizePolicy urlPolicy = urlLineEdit->sizePolicy();
    urlLineEdit->setSizePolicy(QSizePolicy::MinimumExpanding, urlPolicy.verticalPolicy());

    QLineEdit *lineEdit = urlLineEdit->lineEdit();
    QSizePolicy policy = lineEdit->sizePolicy();
    lineEdit->setSizePolicy(QSizePolicy::MinimumExpanding, policy.verticalPolicy());

    if (!mLineEditCompleter && count() > 0)
    {
        WBHistoryCompletionModel *completionModel = new WBHistoryCompletionModel(this);
        completionModel->setSourceModel(WBBrowserWindow::historyManager()->historyFilterModel());
        mLineEditCompleter = new QCompleter(completionModel, this);
        // Should this be in Qt by default?
        QAbstractItemView *popup = mLineEditCompleter->popup();
        QListView *listView = qobject_cast<QListView*>(popup);
        if (listView)
            listView->setUniformItemSizes(true);
    }

    lineEdit->setCompleter(mLineEditCompleter);
    connect(lineEdit, SIGNAL(returnPressed()), this, SLOT(lineEditReturnPressed()));
    mLineEdits->addWidget(urlLineEdit);
    mLineEdits->setSizePolicy(lineEdit->sizePolicy());

    // optimization to delay creating the more expensive WebView, history, etc
    if (count() == 0)
    {
        QWidget *emptyWidget = new QWidget;
        QPalette p = emptyWidget->palette();
        p.setColor(QPalette::Window, palette().color(QPalette::Base));
        emptyWidget->setPalette(p);
        emptyWidget->setAutoFillBackground(true);
        disconnect(this, SIGNAL(currentChanged(int)), this, SLOT(currentChanged(int)));
        addTab(emptyWidget, tr("(Untitled)"));
        connect(this, SIGNAL(currentChanged(int)), this, SLOT(currentChanged(int)));
        return 0;
    }
开发者ID:OpenBoard-org,项目名称:OpenBoard,代码行数:42,代码来源:WBTabWidget.cpp

示例6: ExLineEdit

/*
    SearchLineEdit is an enhanced QLineEdit
    - A Search icon on the left with optional menu
    - When there is no text and doesn't have focus an "inactive text" is displayed
    - When there is text a clear button is displayed on the right hand side
 */
SearchLineEdit::SearchLineEdit(QWidget *parent) : ExLineEdit(parent),
    m_searchButton(new SearchButton(this))
{
    connect(lineEdit(), SIGNAL(textChanged(QString)),
            this, SIGNAL(textChanged(QString)));
    setLeftWidget(m_searchButton);
    m_inactiveText = tr("Search");

    QSizePolicy policy = sizePolicy();
    setSizePolicy(QSizePolicy::Preferred, policy.verticalPolicy());
}
开发者ID:RobertoMalatesta,项目名称:emscripten-qt,代码行数:17,代码来源:searchlineedit.cpp

示例7: toString

QString LayoutDumper::toString(const QSizePolicy& policy)
{
    QString result = QString("(%1, %2)")
            .arg(toString(policy.horizontalPolicy()))
            .arg(toString(policy.verticalPolicy()));
    if (policy.hasHeightForWidth()) {
        result += " [hasHeightForWidth]";
    }
    if (policy.hasWidthForHeight()) {
        result += " [hasWidthForHeight]";
    }
    return result;
}
开发者ID:RudolfCardinal,项目名称:camcops,代码行数:13,代码来源:layoutdumper.cpp

示例8: sizePolicyToString

static QString sizePolicyToString(const QSizePolicy &p)
{
    QString rc; {
        QTextStream str(&rc);
        str << "Control=" << p.controlType() << " expdirs=" << p.expandingDirections()
            << " hasHeightForWidth=" << p.hasHeightForWidth()
            << " H: Policy=" << p.horizontalPolicy()
            << " stretch=" << p.horizontalStretch()
            << " V: Policy=" << p.verticalPolicy()
            << " stretch=" << p.verticalStretch();
    }
    return rc;
}
开发者ID:mohdpatah,项目名称:qt,代码行数:13,代码来源:qdesigner_widgetitem.cpp

示例9: WBExLineEdit

/*
    SearchLineEdit is an enhanced QLineEdit
    - A Search icon on the left with optional menu
    - When there is no text and doesn't have focus an "inactive text" is displayed
    - When there is text a clear button is displayed on the right hand side
 */
WBSearchLineEdit::WBSearchLineEdit(QWidget *parent)
    : WBExLineEdit(parent),
    mSearchButton(new WBSearchButton(this))
{
    connect(lineEdit(), SIGNAL(textChanged(const QString &)),
            this, SIGNAL(textChanged(const QString &)));
    setLeftWidget(mSearchButton);
    mInactiveText = tr("Search");

    setMinimumWidth(150);

    QSizePolicy policy = sizePolicy();
    setSizePolicy(QSizePolicy::Maximum, policy.verticalPolicy());
}
开发者ID:colombc,项目名称:Sankore-3.1,代码行数:20,代码来源:WBSearchLineEdit.cpp

示例10: ExLineEdit

SearchLineEdit::SearchLineEdit(QWidget *parent)
    : ExLineEdit(parent), searchButton(new SearchButton(this)) {
    connect(m_lineEdit, SIGNAL(textChanged(const QString &)), SIGNAL(textChanged(const QString &)));
    connect(m_lineEdit, SIGNAL(textEdited(const QString &)), SIGNAL(textEdited(const QString &)));
    connect(m_lineEdit, SIGNAL(returnPressed()), SLOT(returnPressed()));

    setLeftWidget(searchButton);
    inactiveText = tr("Search");

    QSizePolicy policy = sizePolicy();
    setSizePolicy(QSizePolicy::Preferred, policy.verticalPolicy());

    // completion
    autoComplete = new AutoComplete(this, m_lineEdit);
    connect(autoComplete, SIGNAL(suggestionAccepted(Suggestion *)),
            SIGNAL(suggestionAccepted(Suggestion *)));
}
开发者ID:flaviotordini,项目名称:musique,代码行数:17,代码来源:searchlineedit.cpp

示例11: LineEdit

/*
    SearchLineEdit is an enhanced QLineEdit
    - A Search icon on the left with optional menu
    - When there is no text and doesn't have focus an "inactive text" is displayed
    - When there is text a clear button is displayed on the right hand side
 */
SearchLineEdit::SearchLineEdit(QWidget *parent)
    : LineEdit(parent)
    , m_searchButton(new SearchButton(this))
{
    addWidget(m_searchButton, LeftSide);
    m_inactiveText = tr("Search");

    QSizePolicy policy = sizePolicy();
    setSizePolicy(QSizePolicy::Preferred, policy.verticalPolicy());

    // clear button on the right
    ClearButton *m_clearButton = new ClearButton(this);
    connect(m_clearButton, SIGNAL(clicked()),
            this, SLOT(clear()));
    connect(this, SIGNAL(textChanged(const QString&)),
            m_clearButton, SLOT(textChanged(const QString&)));
    addWidget(m_clearButton, RightSide);
    m_clearButton->hide();
}
开发者ID:fbt-xx,项目名称:arora,代码行数:25,代码来源:searchlineedit.cpp

示例12: updateSizeHints

void AnimatedFrame::updateSizeHints()
{
	if(widget_) {
		QSize hint = widget_->minimumSizeHint();
		if(!hint.isValid())
			hint = widget_->sizeHint();

		QSizePolicy policy = widget_->sizePolicy();

		if(edge_ == kNorth || edge_ == kSouth) {
			int minimum = widget_->minimumHeight();
			int maximum = widget_->maximumHeight();

			minimumSizeHint_.setWidth(0);
			minimumSizeHint_.setHeight(qBound(minimum, hint.height(), maximum));

			setSizePolicy(policy.horizontalPolicy(), QSizePolicy::Maximum);
		}
		else {
			int minimum = widget_->minimumWidth();
			int maximum = widget_->maximumWidth();

			minimumSizeHint_.setWidth(qBound(minimum, hint.width(), maximum));
			minimumSizeHint_.setHeight(0);

			setSizePolicy(QSizePolicy::Maximum, policy.verticalPolicy());
		}

		setMinimumSize(widget_->minimumSize());
		setMaximumSize(widget_->maximumSize());
	}
	else {
		minimumSizeHint_ = QSize();
		setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
	}

	sizeHint_ = minimumSizeHint_;

	if(isUnfolded())
		updateGeometry();
}
开发者ID:phantom-code,项目名称:mindcache,代码行数:41,代码来源:animatedframe.cpp

示例13:

osg::GraphicsContext::Traits* GraphicsWindowQt::createTraits( const QGLWidget* widget )
{
    osg::GraphicsContext::Traits *traits = new osg::GraphicsContext::Traits;

    qglFormat2traits( widget->format(), traits );

    QRect r = widget->geometry();
    traits->x = r.x();
    traits->y = r.y();
    traits->width = r.width();
    traits->height = r.height();

    traits->windowName = widget->windowTitle().toLocal8Bit().data();
    Qt::WindowFlags f = widget->windowFlags();
    traits->windowDecoration = ( f & Qt::WindowTitleHint ) &&
                            ( f & Qt::WindowMinMaxButtonsHint ) &&
                            ( f & Qt::WindowSystemMenuHint );
    QSizePolicy sp = widget->sizePolicy();
    traits->supportsResize = sp.horizontalPolicy() != QSizePolicy::Fixed ||
                            sp.verticalPolicy() != QSizePolicy::Fixed;

    return traits;
}
开发者ID:aoighost,项目名称:osg,代码行数:23,代码来源:GraphicsWindowQt.cpp

示例14: QTabWidget

WBTabWidget::WBTabWidget(QWidget *parent)
    : QTabWidget(parent)
    , mRecentlyClosedTabsMenu(0)
    , mLineEditCompleter(0)
    , mLineEdits(0)
    , mTabBar(new WBTabBar(this))
{
    setObjectName("ubWebBrowserTabWidget");
    mAddTabIcon = QPixmap(":/images/toolbar/plusBlack.png");

    setElideMode(Qt::ElideRight);

    connect(mTabBar, SIGNAL(newTab()), this, SLOT(newTab()));
    connect(mTabBar, SIGNAL(closeTab(int)), this, SLOT(closeTab(int)));
    connect(mTabBar, SIGNAL(cloneTab(int)), this, SLOT(cloneTab(int)));
    connect(mTabBar, SIGNAL(closeOtherTabs(int)), this, SLOT(closeOtherTabs(int)));
    connect(mTabBar, SIGNAL(reloadTab(int)), this, SLOT(reloadTab(int)));
    connect(mTabBar, SIGNAL(reloadAllTabs()), this, SLOT(reloadAllTabs()));
    connect(mTabBar, SIGNAL(tabMoved(int, int)), this, SLOT(moveTab(int, int)));
    setTabBar(mTabBar);
    setDocumentMode(false);

    mRecentlyClosedTabsMenu = new QMenu(this);
    connect(mRecentlyClosedTabsMenu, SIGNAL(aboutToShow()), this, SLOT(aboutToShowRecentTabsMenu()));
    connect(mRecentlyClosedTabsMenu, SIGNAL(triggered(QAction *)), this, SLOT(aboutToShowRecentTriggeredAction(QAction *)));
    mRecentlyClosedTabsAction = new QAction(tr("Recently Closed Tabs"), this);
    mRecentlyClosedTabsAction->setMenu(mRecentlyClosedTabsMenu);
    mRecentlyClosedTabsAction->setEnabled(false);

    connect(this, SIGNAL(currentChanged(int)), this, SLOT(currentChanged(int)));

    mLineEdits = new QStackedWidget(this);
    mLineEdits->setMinimumWidth(200);
    QSizePolicy spolicy = mLineEdits->sizePolicy();
    mLineEdits->setSizePolicy(QSizePolicy::Maximum, spolicy.verticalPolicy());
}
开发者ID:OpenBoard-org,项目名称:OpenBoard,代码行数:36,代码来源:WBTabWidget.cpp

示例15: LineEdit

/*
    SearchLineEdit is an enhanced QLineEdit
    - A Search icon on the left with optional menu
    - When there is no text and doesn't have focus an "inactive text" is displayed
    - When there is text a clear button is displayed on the right hand side
 */
SearchLineEdit::SearchLineEdit(QWidget *parent)
    : LineEdit(parent)
    , m_searchButton(0)
{
    setUpdatesEnabled(false);
    m_searchButton = new SearchButton(this);
    updateGeometries();
    addWidget(m_searchButton, LeftSide);
    setInactiveText(tr("Search"));

    QSizePolicy policy = sizePolicy();
    setSizePolicy(QSizePolicy::Preferred, policy.verticalPolicy());

    // clear button on the right
    ClearButton *m_clearButton = new ClearButton(this);
    connect(m_clearButton, SIGNAL(clicked()),
            this, SLOT(clear()));
    connect(this, SIGNAL(textChanged(const QString&)),
            m_clearButton, SLOT(textChanged(const QString&)));
    addWidget(m_clearButton, RightSide);
    m_clearButton->hide();
    updateTextMargins();
    setUpdatesEnabled(true);
}
开发者ID:Nascent2009,项目名称:arora,代码行数:30,代码来源:searchlineedit.cpp


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