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


C++ ensurePolished函数代码示例

本文整理汇总了C++中ensurePolished函数的典型用法代码示例。如果您正苦于以下问题:C++ ensurePolished函数的具体用法?C++ ensurePolished怎么用?C++ ensurePolished使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: Q_D

/*!
  \reimp
*/
QSize QLabel::minimumSizeHint() const
{
    Q_D(const QLabel);
    if (d->valid_hints) {
        if (d->sizePolicy == sizePolicy())
            return d->msh;
    }

    ensurePolished();
    d->valid_hints = true;
    d->sh = d->sizeForWidth(-1); // wrap ? golden ratio : min doc size
    QSize msh(-1, -1);

    if (!d->isTextLabel) {
        msh = d->sh;
    } else {
        msh.rheight() = d->sizeForWidth(QWIDGETSIZE_MAX).height(); // height for one line
        msh.rwidth() = d->sizeForWidth(0).width(); // wrap ? size of biggest word : min doc size
        if (d->sh.height() < msh.height())
            msh.rheight() = d->sh.height();
    }
    d->msh = msh;
    d->sizePolicy = sizePolicy();
    return msh;
}
开发者ID:Fale,项目名称:qtmoko,代码行数:28,代码来源:qlabel.cpp

示例2: QFrame

QmitkStringPropertyOnDemandEdit::QmitkStringPropertyOnDemandEdit(mitk::StringProperty *property, QWidget *parent)
  : QFrame(parent), PropertyEditor(property), m_StringProperty(property)
{
  setFrameStyle(QFrame::NoFrame);
  setLineWidth(0);

  // create HBoxLayout with two buttons
  m_layout = new QHBoxLayout(this);
  m_layout->setMargin(0);

  m_label = new QLabel(this);
  m_layout->addWidget(m_label);

  m_toolbutton = new QClickableLabel2(this);
  m_toolbutton->setText("...");
  m_layout->addWidget(m_toolbutton);

  m_layout->addStretch(10);

  connect(m_toolbutton, SIGNAL(clicked()), this, SLOT(onToolButtonClicked()));

  ensurePolished();
  adjustSize();

  PropertyChanged();
}
开发者ID:Cdebus,项目名称:MITK,代码行数:26,代码来源:QmitkStringPropertyOnDemandEdit.cpp

示例3: minimumSizeHint

    QSize minimumSizeHint() const
    {
        if(cachedMinimumSizeHint.isEmpty())
        {
            ensurePolished();

            const QFontMetrics fm(fontMetrics());
            int h = lineEdit()->minimumSizeHint().height();
            int w = fm.width(DrivercoinUnits::format(DrivercoinUnits::DVR, DrivercoinUnits::maxMoney(), false, DrivercoinUnits::separatorAlways));
            w += 2; // cursor blinking space

            QStyleOptionSpinBox opt;
            initStyleOption(&opt);
            QSize hint(w, h);
            QSize extra(35, 6);
            opt.rect.setSize(hint + extra);
            extra += hint - style()->subControlRect(QStyle::CC_SpinBox, &opt,
                                                    QStyle::SC_SpinBoxEditField, this).size();
            // get closer to final result by repeating the calculation
            opt.rect.setSize(hint + extra);
            extra += hint - style()->subControlRect(QStyle::CC_SpinBox, &opt,
                                                    QStyle::SC_SpinBoxEditField, this).size();
            hint += extra;
            hint.setHeight(h);

            opt.rect = rect();

            cachedMinimumSizeHint = style()->sizeFromContents(QStyle::CT_SpinBox, &opt, hint, this)
                                    .expandedTo(QApplication::globalStrut());
        }
        return cachedMinimumSizeHint;
    }
开发者ID:drivercoin,项目名称:drivercoin,代码行数:32,代码来源:bitcoinamountfield.cpp

示例4: ensurePolished

QSize CloseButton::sizeHint() const
{
    ensurePolished();
    int width = style()->pixelMetric(QStyle::PM_TabCloseIndicatorWidth, 0, this);
    int height = style()->pixelMetric(QStyle::PM_TabCloseIndicatorHeight, 0, this);
    return QSize(width, height);
}
开发者ID:Akira586,项目名称:Cockatrice,代码行数:7,代码来源:tab_supervisor.cpp

示例5: QLabel

DCursorTracker::DCursorTracker(const QString& txt, QWidget* const parent, Qt::Alignment align)
    : QLabel(txt, parent, Qt::ToolTip | Qt::BypassGraphicsProxyWidget), 
      d(new Private)
{
    setForegroundRole(QPalette::ToolTipText);
    setBackgroundRole(QPalette::ToolTipBase);
    setPalette(QToolTip::palette());
    ensurePolished();
    const int fwidth = 1 + style()->pixelMetric(QStyle::PM_ToolTipLabelFrameWidth, 0, this);
    setContentsMargins(fwidth, fwidth, fwidth, fwidth);
    setFrameStyle(QFrame::NoFrame);
    setAlignment(Qt::AlignLeft | Qt::AlignTop);
    setIndent(1);
    setWindowOpacity(style()->styleHint(QStyle::SH_ToolTipLabel_Opacity, 0, this) / 255.0);

    d->alignment = align;
    d->parent    = parent;
    d->parent->setMouseTracking(true);
    d->parent->installEventFilter(this);

    d->autoHideTimer = new QTimer(this);
    d->autoHideTimer->setSingleShot(true);

    connect(d->autoHideTimer, SIGNAL(timeout()),
            this, SLOT(slotAutoHide()));
}
开发者ID:Match-Yang,项目名称:digikam,代码行数:26,代码来源:dcursortracker.cpp

示例6: ensurePolished

QSize K3b::MsfEdit::sizeHint() const
{
    if (d->cachedSizeHint.isEmpty()) {
        ensurePolished();

        const QFontMetrics fm(fontMetrics());
        int h = lineEdit()->sizeHint().height();
        int w = fm.width( lineEdit()->inputMask() );
        w += 2; // cursor blinking space

        QStyleOptionSpinBox opt;
        initStyleOption(&opt);
        QSize hint(w, h);
        QSize extra(35, 6);
        opt.rect.setSize(hint + extra);
        extra += hint - style()->subControlRect(QStyle::CC_SpinBox, &opt,
                                                QStyle::SC_SpinBoxEditField, this).size();
        // get closer to final result by repeating the calculation
        opt.rect.setSize(hint + extra);
        extra += hint - style()->subControlRect(QStyle::CC_SpinBox, &opt,
                                                QStyle::SC_SpinBoxEditField, this).size();
        hint += extra;

        opt.rect = rect();
        d->cachedSizeHint = style()->sizeFromContents(QStyle::CT_SpinBox, &opt, hint, this)
                            .expandedTo(QApplication::globalStrut());
    }
    return d->cachedSizeHint;
}
开发者ID:KDE,项目名称:k3b,代码行数:29,代码来源:k3bmsfedit.cpp

示例7: ensurePolished

QSize TabButton::sizeHint() const {
    ensurePolished();

    int h = normalHeight();
    int w = normalWidth();

    return QSize(w, h);
}
开发者ID:Acidburn0zzz,项目名称:eiskaltdcpp,代码行数:8,代码来源:TabButton.cpp

示例8: ensurePolished

QSize Q3TitleBar::sizeHint() const
{
    ensurePolished();
    QStyleOptionTitleBar opt = d_func()->getStyleOption();
    QRect menur = style()->subControlRect(QStyle::CC_TitleBar, &opt,
                                          QStyle::SC_TitleBarSysMenu, this);
    return QSize(menur.width(), style()->pixelMetric(QStyle::PM_TitleBarHeight, &opt, this));
}
开发者ID:husninazer,项目名称:qt,代码行数:8,代码来源:q3titlebar.cpp

示例9: ensurePolished

QSize Editor::sizeHint() const
{
    ensurePolished();
    const QFontMetrics metrics = fontMetrics();
    const int width = metrics.width('x') * 10;
    const int height = metrics.lineSpacing() + 6;
    return QSize(width, height);
}
开发者ID:0pq76r,项目名称:SpeedCrunch,代码行数:8,代码来源:editor.cpp

示例10: ensurePolished

/*!
    \reimp
*/
QSize Q3ProgressBar::sizeHint() const
{
    ensurePolished();
    QFontMetrics fm = fontMetrics();
    QStyleOptionProgressBar opt = getStyleOption(this);
    int cw = style()->pixelMetric(QStyle::PM_ProgressBarChunkWidth, &opt, this);
    return style()->sizeFromContents(QStyle::CT_ProgressBar, &opt,
                                    QSize(cw * 7 + fm.width(QLatin1Char('0')) * 4, fm.height() + 8), this);
}
开发者ID:Fale,项目名称:qtmoko,代码行数:12,代码来源:q3progressbar.cpp

示例11: QLineEdit

// --------- FancyLineEdit
FancyLineEdit::FancyLineEdit(QWidget *parent) :
    QLineEdit(parent),
    d(new FancyLineEditPrivate(this)) {
    ensurePolished();
    updateMargins();

    connect(this, SIGNAL(textChanged(QString)), this, SLOT(checkButtons(QString)));
    connect(d->m_iconbutton[Left], SIGNAL(clicked()), this, SLOT(iconClicked()));
    connect(d->m_iconbutton[Right], SIGNAL(clicked()), this, SLOT(iconClicked()));
}
开发者ID:AlexLevkovich,项目名称:FileFinder,代码行数:11,代码来源:fancylineedit.cpp

示例12: ensurePolished

QSize EvButton::sizeHint() const
{
    ensurePolished();
    QSize s = fontMetrics().size(Qt::TextSingleLine, text());
    s *= 1.1;

    s.rheight() += 4;
    s.rwidth() += s.height();
    return s.expandedTo(QApplication::globalStrut());
}
开发者ID:kaabimg,项目名称:EvLibrary,代码行数:10,代码来源:EvButton.cpp

示例13: ensurePolished

QSize QWellArray::sizeHint() const
{
    int w = (cellw+margin+1)*nrows;
    int h = (cellh+margin+1)*ncols;

    int wh = std::max(w, h);

    ensurePolished();
    return gridSize().boundedTo(QSize(wh, wh));
}
开发者ID:qeedquan,项目名称:palette_viewer,代码行数:10,代码来源:wellarray.cpp

示例14: ensurePolished

QSize TabCloseButton::sizeHint() const
{
    // make sure the widget is polished
    ensurePolished();

    // read the metrics from the style
    const int w = style()->pixelMetric(QStyle::PM_TabCloseIndicatorWidth, 0, this);
    const int h = style()->pixelMetric(QStyle::PM_TabCloseIndicatorHeight, 0, this);
    return QSize(w, h);
}
开发者ID:cmacq2,项目名称:kate,代码行数:10,代码来源:katetabbutton.cpp

示例15: CompletingLineEdit

// --------- FancyLineEdit
FancyLineEdit::FancyLineEdit(QWidget *parent) :
    CompletingLineEdit(parent),
    d(new FancyLineEditPrivate(this))
{
    ensurePolished();
    updateMargins();

    connect(d->m_iconbutton[Left], &QAbstractButton::clicked, this, &FancyLineEdit::iconClicked);
    connect(d->m_iconbutton[Right], &QAbstractButton::clicked, this, &FancyLineEdit::iconClicked);
    connect(this, &QLineEdit::textChanged, this, &FancyLineEdit::onTextChanged);
}
开发者ID:johnlangworthy,项目名称:qt-creator,代码行数:12,代码来源:fancylineedit.cpp


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