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


C++ QSize类代码示例

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


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

示例1: fix_alignment

/// Correct for underalignment
static QSize fix_alignment(QSize raw)
{
    return QSize((raw.width() + 15) & (~0xf), (raw.height() + 15) & (~0xf));
}
开发者ID:Saner2oo2,项目名称:mythtv,代码行数:5,代码来源:videooutwindow.cpp

示例2: QWidget

SearchWidget::SearchWidget(MainWindow *mainWindow)
    : QWidget(mainWindow)
    , m_ui(new Ui::SearchWidget())
    , m_tabStatusChangedMapper(new QSignalMapper(this))
    , m_mainWindow(mainWindow)
    , m_isNewQueryString(false)
{
    m_ui->setupUi(this);

    QString searchPatternHint;
    QTextStream stream(&searchPatternHint, QIODevice::WriteOnly);
    stream << "<html><head/><body><p>"
           << tr("A phrase to search for.") << "<br>"
           << tr("Spaces in a search term may be protected by double quotes.")
           << "</p><p>"
           << tr("Example:", "Search phrase example")
           << "<br>"
           << tr("<b>foo bar</b>: search for <b>foo</b> and <b>bar</b>",
                 "Search phrase example, illustrates quotes usage, a pair of "
                 "space delimited words, individal words are highlighted")
           << "<br>"
           << tr("<b>&quot;foo bar&quot;</b>: search for <b>foo bar</b>",
                 "Search phrase example, illustrates quotes usage, double quoted"
                 "pair of space delimited words, the whole pair is highlighted")
           << "</p></body></html>" << flush;
    m_ui->m_searchPattern->setToolTip(searchPatternHint);

#ifndef Q_OS_MAC
    // Icons
    m_ui->searchButton->setIcon(GuiIconProvider::instance()->getIcon("edit-find"));
    m_ui->downloadButton->setIcon(GuiIconProvider::instance()->getIcon("download"));
    m_ui->goToDescBtn->setIcon(GuiIconProvider::instance()->getIcon("application-x-mswinurl"));
    m_ui->pluginsButton->setIcon(GuiIconProvider::instance()->getIcon("preferences-system-network"));
    m_ui->copyURLBtn->setIcon(GuiIconProvider::instance()->getIcon("edit-copy"));
#else
    // On macOS the icons overlap the text otherwise
    QSize iconSize = m_ui->tabWidget->iconSize();
    iconSize.setWidth(iconSize.width() + 16);
    m_ui->tabWidget->setIconSize(iconSize);
#endif
    connect(m_ui->tabWidget, &QTabWidget::tabCloseRequested, this, &SearchWidget::closeTab);
    connect(m_ui->tabWidget, &QTabWidget::currentChanged, this, &SearchWidget::tabChanged);

    connect(m_tabStatusChangedMapper, static_cast<void (QSignalMapper::*)(QWidget *)>(&QSignalMapper::mapped)
            , this, &SearchWidget::tabStatusChanged);

    // NOTE: Although SearchManager is Application-wide component now, we still create it the legacy way.
    auto *searchManager = new SearchPluginManager;
    const auto onPluginChanged = [this]()
    {
        fillPluginComboBox();
        fillCatCombobox();
        selectActivePage();
    };
    connect(searchManager, &SearchPluginManager::pluginInstalled, this, onPluginChanged);
    connect(searchManager, &SearchPluginManager::pluginUninstalled, this, onPluginChanged);
    connect(searchManager, &SearchPluginManager::pluginUpdated, this, onPluginChanged);
    connect(searchManager, &SearchPluginManager::pluginEnabled, this, onPluginChanged);

    // Fill in category combobox
    onPluginChanged();

    connect(m_ui->m_searchPattern, &LineEdit::returnPressed, m_ui->searchButton, &QPushButton::click);
    connect(m_ui->m_searchPattern, &LineEdit::textEdited, this, &SearchWidget::searchTextEdited);
    connect(m_ui->selectPlugin, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged)
            , this, &SearchWidget::selectMultipleBox);
    connect(m_ui->selectPlugin, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged)
            , this, &SearchWidget::fillCatCombobox);
}
开发者ID:zywo,项目名称:qBittorrent,代码行数:69,代码来源:searchwidget.cpp

示例3: calculateVectorscope

QImage VectorscopeGenerator::calculateVectorscope(const QSize &vectorscopeSize, const QImage &image, const float &gain,
                                                  const VectorscopeGenerator::PaintMode &paintMode,
                                                  const VectorscopeGenerator::ColorSpace &colorSpace,
                                                  const bool &, const uint &accelFactor) const
{
    if (vectorscopeSize.width() <= 0 || vectorscopeSize.height() <= 0 || image.width() <= 0 || image.height() <= 0) {
        // Invalid size
        return QImage();
    }

    // Prepare the vectorscope data
    const int cw = (vectorscopeSize.width() < vectorscopeSize.height()) ? vectorscopeSize.width() : vectorscopeSize.height();
    QImage scope = QImage(cw, cw, QImage::Format_ARGB32);
    scope.fill(qRgba(0,0,0,0));

    const uchar *bits = image.bits();

    int r,g,b;
    double dy, dr, dg, db, dmax;
    double /*y,*/ u, v;
    QPoint pt;
    QRgb px;

    const int stepsize = 4 * accelFactor;

    // Just an average for the number of image pixels per scope pixel.
    // NOTE: byteCount() has to be replaced by (img.bytesPerLine()*img.height()) for Qt 4.5 to compile, see: http://doc.trolltech.org/4.6/qimage.html#bytesPerLine
    double avgPxPerPx = (double) 4*(image.bytesPerLine()*image.height())/scope.size().width()/scope.size().height()/accelFactor;

    for (int i = 0; i < (image.bytesPerLine()*image.height()); i+= stepsize) {
        QRgb *col = (QRgb *) bits;

        r = qRed(*col);
        g = qGreen(*col);
        b = qBlue(*col);

        switch (colorSpace) {
        case VectorscopeGenerator::ColorSpace_YUV:
//             y = (double)  0.001173 * r +0.002302 * g +0.0004471* b;
            u = (double) -0.0005781* r -0.001135 * g +0.001713 * b;
            v = (double)  0.002411 * r -0.002019 * g -0.0003921* b;
            break;
        case VectorscopeGenerator::ColorSpace_YPbPr:
        default:
//             y = (double)  0.001173 * r +0.002302 * g +0.0004471* b;
            u = (double) -0.0006671* r -0.001299 * g +0.0019608* b;
            v = (double)  0.001961 * r -0.001642 * g -0.0003189* b;
            break;
        }


        pt = mapToCircle(vectorscopeSize, QPointF(SCALING*gain*u, SCALING*gain*v));

        if (pt.x() >= scope.width() || pt.x() < 0
            || pt.y() >= scope.height() || pt.y() < 0) {
            // Point lies outside (because of scaling), don't plot it

        } else {

            // Draw the pixel using the chosen draw mode.
            switch (paintMode) {
            case PaintMode_YUV:
                // see yuvColorWheel
                dy = 128; // Default Y value. Lower = darker.

                // Calculate the RGB values from YUV/YPbPr
                switch (colorSpace) {
                case VectorscopeGenerator::ColorSpace_YUV:
                    dr = dy + 290.8*v;
                    dg = dy - 100.6*u - 148*v;
                    db = dy + 517.2*u;
                    break;
                case VectorscopeGenerator::ColorSpace_YPbPr:
                default:
                    dr = dy + 357.5*v;
                    dg = dy - 87.75*u - 182*v;
                    db = dy + 451.9*u;
                    break;
                }


                if (dr < 0) dr = 0;
                if (dg < 0) dg = 0;
                if (db < 0) db = 0;
                if (dr > 255) dr = 255;
                if (dg > 255) dg = 255;
                if (db > 255) db = 255;

                scope.setPixel(pt, qRgba(dr, dg, db, 255));
                break;

            case PaintMode_Chroma:
                dy = 200; // Default Y value. Lower = darker.

                // Calculate the RGB values from YUV/YPbPr
                switch (colorSpace) {
                case VectorscopeGenerator::ColorSpace_YUV:
                    dr = dy + 290.8*v;
                    dg = dy - 100.6*u - 148*v;
                    db = dy + 517.2*u;
//.........这里部分代码省略.........
开发者ID:eddrog,项目名称:kdenlive,代码行数:101,代码来源:vectorscopegenerator.cpp

示例4: ScaleData

QSize QwtPlotLayout::minimumSizeHint(const QwtPlot *plot) const
{
    class ScaleData
    {
    public:
        ScaleData()
        {
            w = h = minLeft = minRight = tickOffset = 0;
        }

        int w;
        int h;
        int minLeft;
        int minRight;
        int tickOffset;
    } scaleData[QwtPlot::axisCnt];

    int canvasBorder[QwtPlot::axisCnt];

    int axis;
    for ( axis = 0; axis < QwtPlot::axisCnt; axis++ )
    {
        if ( plot->axisEnabled(axis) )
        {
            const QwtScaleWidget *scl = plot->axisWidget(axis);
            ScaleData &sd = scaleData[axis];

            const QSize hint = scl->minimumSizeHint();
            sd.w = hint.width(); 
            sd.h = hint.height(); 
            scl->getBorderDistHint(sd.minLeft, sd.minRight);
            sd.tickOffset = scl->margin();
            if ( scl->scaleDraw()->hasComponent(QwtAbstractScaleDraw::Ticks) )
                sd.tickOffset += scl->scaleDraw()->majTickLength();
        }

        canvasBorder[axis] = plot->canvas()->frameWidth() +
            d_data->canvasMargin[axis] + 1;
            
    }


    for ( axis = 0; axis < QwtPlot::axisCnt; axis++ )
    {
        ScaleData &sd = scaleData[axis];
        if ( sd.w && (axis == QwtPlot::xBottom || axis == QwtPlot::xTop) )
        {
            if ( (sd.minLeft > canvasBorder[QwtPlot::yLeft]) 
                && scaleData[QwtPlot::yLeft].w )
            {
                int shiftLeft = sd.minLeft - canvasBorder[QwtPlot::yLeft];
                if ( shiftLeft > scaleData[QwtPlot::yLeft].w )
                    shiftLeft = scaleData[QwtPlot::yLeft].w;

                sd.w -= shiftLeft;
            }
            if ( (sd.minRight > canvasBorder[QwtPlot::yRight]) 
                && scaleData[QwtPlot::yRight].w )
            {
                int shiftRight = sd.minRight - canvasBorder[QwtPlot::yRight];
                if ( shiftRight > scaleData[QwtPlot::yRight].w )
                    shiftRight = scaleData[QwtPlot::yRight].w;

                sd.w -= shiftRight;
            }
        }

        if ( sd.h && (axis == QwtPlot::yLeft || axis == QwtPlot::yRight) )
        {
            if ( (sd.minLeft > canvasBorder[QwtPlot::xBottom]) &&
                scaleData[QwtPlot::xBottom].h )
            {
                int shiftBottom = sd.minLeft - canvasBorder[QwtPlot::xBottom];
                if ( shiftBottom > scaleData[QwtPlot::xBottom].tickOffset )
                    shiftBottom = scaleData[QwtPlot::xBottom].tickOffset;

                sd.h -= shiftBottom;
            }
            if ( (sd.minLeft > canvasBorder[QwtPlot::xTop]) &&
                scaleData[QwtPlot::xTop].h )
            {
                int shiftTop = sd.minRight - canvasBorder[QwtPlot::xTop];
                if ( shiftTop > scaleData[QwtPlot::xTop].tickOffset )
                    shiftTop = scaleData[QwtPlot::xTop].tickOffset;

                sd.h -= shiftTop;
            }
        }
    }

    const QwtPlotCanvas *canvas = plot->canvas();
    const QSize minCanvasSize = canvas->minimumSize();

    int w = scaleData[QwtPlot::yLeft].w + scaleData[QwtPlot::yRight].w;
    int cw = qwtMax(scaleData[QwtPlot::xBottom].w, scaleData[QwtPlot::xTop].w)
        + 2 * (canvas->frameWidth() + 1);
    w += qwtMax(cw, minCanvasSize.width());

    int h = scaleData[QwtPlot::xBottom].h + scaleData[QwtPlot::xTop].h;
    int ch = qwtMax(scaleData[QwtPlot::yLeft].h, scaleData[QwtPlot::yRight].h)
//.........这里部分代码省略.........
开发者ID:chaoqing,项目名称:qtiplot,代码行数:101,代码来源:qwt_plot_layout.cpp

示例5: setSymbol

/*!
  Draw symbols

  \param painter Painter
  \param symbol Curve symbol
  \param xMap x map
  \param yMap y map
  \param canvasRect Contents rect of the canvas
  \param from Index of the first point to be painted
  \param to Index of the last point to be painted

  \sa setSymbol(), drawSeries(), drawCurve()
*/
void QwtPlotCurve::drawSymbols( QPainter *painter, const QwtSymbol &symbol,
    const QwtScaleMap &xMap, const QwtScaleMap &yMap,
    const QRectF &canvasRect, int from, int to ) const
{
    const bool doAlign = QwtPainter::roundingAlignment( painter );

    bool usePixmap = testPaintAttribute( CacheSymbols );
    if ( usePixmap && !doAlign )
    {
        // Don't use the pixmap, when the paint device
        // could generate scalable vectors

        usePixmap = false;
    }

    if ( usePixmap )
    {
        const QSize sz = ( 2 * symbol.boundingSize() + QSize( 1, 1 ) ) / 2;
        const int w2 = sz.width() / 2;
        const int h2 = sz.height() / 2;

        QPixmap pm( sz );
        pm.fill( Qt::transparent );

        QPainter p( &pm );
        p.setRenderHints( painter->renderHints() );
        symbol.drawSymbol( &p, QPointF( w2, h2 ) );
        p.end();

        for ( int i = from; i <= to; i++ )
        {
            const QPointF sample = d_series->sample( i );

            const double xi = xMap.transform( sample.x() );
            const double yi = yMap.transform( sample.y() );

            if ( canvasRect.contains( xi, yi ) )
            {
                const int left = qRound( xi ) - w2;
                const int top = qRound( yi ) - h2;

                painter->drawPixmap( left, top, pm );
            }
        }
    }
    else
    {
        const int chunkSize = 500;

        for ( int i = from; i <= to; i += chunkSize )
        {
            const int n = qMin( chunkSize, to - i + 1 );

            QPolygonF points;
            for ( int j = 0; j < n; j++ )
            {
                const QPointF sample = d_series->sample( i + j );

                const double xi = xMap.transform( sample.x() );
                const double yi = yMap.transform( sample.y() );

                if ( canvasRect.contains( xi, yi ) )
                    points += QPointF( xi, yi );
            }

            if ( points.size() > 0 )
                symbol.drawSymbols( painter, points );
        }
    }
}
开发者ID:Aconex,项目名称:pcp,代码行数:83,代码来源:qwt_plot_curve.cpp

示例6: GetThumbnail

STDMETHODIMP CThumbnailProvider::GetThumbnail(UINT cx, 
                                              HBITMAP *phbmp, 
                                              WTS_ALPHATYPE *pdwAlpha)
{
	*phbmp = NULL; 
    *pdwAlpha = WTSAT_ARGB;

    int width, height;
    QSize size = renderer.defaultSize();

    if(size.width() == size.height()){
        width = cx;
        height = cx;
    } else if (size.width() > size.height()){
        width = cx;
        height = size.height() * ((double)cx / (double)size.width());
    } else {
        width = size.width() * ((double)cx / (double)size.height());
        height = cx;
    }

    QFile * f = new QFile("C:\\dev\\svg.log");
    f->open(QFile::Append);
    f->write(QString("Size: %1 \n.").arg(cx).toAscii());
    f->flush();
    f->close();

    QImage * device = new QImage(width, height, QImage::Format_ARGB32);
    device->fill(Qt::transparent);
    QPainter * painter = new QPainter();
    QFont font;
    QColor color_font = QColor(255, 0, 0);

    painter->begin(device);
    painter->setRenderHints(QPainter::Antialiasing |
                            QPainter::SmoothPixmapTransform |
                            QPainter::TextAntialiasing);
    assert(device->paintingActive() && painter->isActive());
    if(loaded){
        renderer.render(painter);
    } else {
        int font_size = cx / 10;

        font.setStyleHint(QFont::Monospace);
        font.setPixelSize(font_size);

        painter->setPen(color_font);
        painter->setFont(font);
        painter->drawText(font_size, (cx - font_size) / 2, "Invalid SVG file.");
    }
    painter->end();

    assert(!device->isNull());
#ifndef NDEBUG
    device->save(QString("C:\\dev\\%1.png").arg(QDateTime::currentMSecsSinceEpoch()), "PNG");
#endif
    *phbmp = QPixmap::fromImage(*device).toWinHBITMAP(QPixmap::Alpha);
    assert(*phbmp != NULL);

    delete painter;
    delete device;

	if( *phbmp != NULL )
		return NOERROR;
	return E_NOTIMPL;

}
开发者ID:dewingkids,项目名称:svg-explorer-extension,代码行数:67,代码来源:ThumbnailProvider.cpp

示例7: maxSize

static QSize maxSize(const QSize &a,
                     const QSize &b)
{
    return QSize(qMax(a.width(), b.width()),
                 qMax(a.height(), b.height()));
}
开发者ID:alphaonex86,项目名称:CatchChallenger,代码行数:6,代码来源:tiled_tilelayer.cpp

示例8: switch

//! \internal
void XmlPreferencesPrivate::writeSection(XmlWriter& out, const QString& name, const Section& section)
{
	QHash<QString,QString> attrs;

	attrs.insert("name", name);
	out.writeOpenTag("section", attrs);
	attrs.clear();

	for (Section::ConstIterator sectionIterator = section.constBegin();
		sectionIterator != section.constEnd(); ++sectionIterator)
	{
		const EncVariant& v = sectionIterator.value();

		attrs.insert("name", sectionIterator.key());

		switch (v.data.type())
		{
		case QVariant::String :
			attrs.insert("type", "string");
			out.writeTaggedString("setting", v.data.toString(), attrs);
			break;
		case QVariant::StringList :
			{
				attrs.insert("type", "stringlist");
				out.writeOpenTag("setting", attrs);
				attrs.clear();
				QStringList list = v.data.toStringList();
				for (int i = 0; i < list.size(); ++i)
					out.writeTaggedString("value", list.at(i), attrs);
				out.writeCloseTag("setting");
			}
			break;
		case QVariant::Bool :
			attrs.insert("type", "bool");
			out.writeTaggedString("setting", v.data.toBool() ? "true" : "false", attrs);
			break;
		case QVariant::Int :
			attrs.insert("type", "int");
			out.writeTaggedString("setting", QString::number(v.data.toInt()), attrs);
			break;
		case QVariant::LongLong :
			attrs.insert("type", "int64");
			out.writeTaggedString("setting", QString::number(v.data.toLongLong()), attrs);
			break;
		case QVariant::Rect :
			{
				attrs.insert("type", "rect");
				QRect rect = v.data.toRect();
				QString s = QString("%1;%2;%3;%4").arg(rect.x()).arg(rect.y()).arg(rect.width()).arg(rect.height());
				out.writeTaggedString("setting", s, attrs);
			}
			break;
		case QVariant::Point :
			{
				attrs.insert("type", "point");
				QPoint point = v.data.toPoint();
				QString s = QString("%1;%2").arg(point.x()).arg(point.y());
				out.writeTaggedString("setting", s, attrs);
			}
			break;
		case QVariant::Size :
			{
				attrs.insert("type", "size");
				QSize size = v.data.toSize();
				QString s = QString("%1;%2").arg(size.width()).arg(size.height());
				out.writeTaggedString("setting", s, attrs);
			}
			break;
		case QVariant::ByteArray :
			{
				attrs.insert("type", "bytearray");
				const QByteArray ba = v.data.toByteArray();
				switch (v.encoding)
				{
				case XmlPreferences::Base64:
					attrs.insert("encoding", "base64");
					out.writeTaggedString("setting", Base64::encode(ba), attrs);
					break;
				default:
					attrs.insert("encoding", "csv");
					QString s;
					for (uint i = 0; i < (uint) ba.size(); ++i)
						(i != 0) ? s += "," + QString::number((uint)ba.at(i), 16) : s += QString::number((uint)ba.at(i), 16);
					out.writeTaggedString("setting", s, attrs);
				}
				attrs.clear();
			}
			break;
		case QVariant::BitArray :
			{
				attrs.insert("type", "bitarray");
				const QBitArray ba = v.data.toBitArray();
				attrs.insert("size", QString::number(ba.size()));
				switch (v.encoding)
				{
				case XmlPreferences::Base64:
					attrs.insert("encoding", "base64");
					out.writeTaggedString("setting", Base64::encode(ba), attrs);
					break;
//.........这里部分代码省略.........
开发者ID:hippydream,项目名称:osdab,代码行数:101,代码来源:xmlpreferences.cpp

示例9: setWinGLSize

void GLC_Viewport::setWinGLSize(const QSize &size, bool updateOpenGL)
{
    setWinGLSize(size.width(), size.height(), updateOpenGL);
}
开发者ID:JasonWinston,项目名称:GLC_lib,代码行数:4,代码来源:glc_viewport.cpp

示例10: adjustSize

    QSize adjustSize(PrintOptionsPage* optionsPage, Document::Ptr doc, int printerResolution, const QSize & viewportSize)
    {
        QSize size = doc->size();
        PrintOptionsPage::ScaleMode scaleMode = optionsPage->scaleMode();
        if (scaleMode == PrintOptionsPage::ScaleToPage) {
            bool imageBiggerThanPaper =
                size.width() > viewportSize.width()
                || size.height() > viewportSize.height();

            if (imageBiggerThanPaper || optionsPage->enlargeSmallerImages()) {
                size.scale(viewportSize, Qt::KeepAspectRatio);
            }

        } else if (scaleMode == PrintOptionsPage::ScaleToCustomSize) {
            double wImg = optionsPage->scaleWidth();
            double hImg = optionsPage->scaleHeight();
            size.setWidth(int(wImg * printerResolution));
            size.setHeight(int(hImg * printerResolution));

        } else {
            // No scale
            const double INCHES_PER_METER = 100. / 2.54;
            int dpmX = doc->image().dotsPerMeterX();
            int dpmY = doc->image().dotsPerMeterY();
            if (dpmX > 0 && dpmY > 0) {
                double wImg = double(size.width()) / double(dpmX) * INCHES_PER_METER;
                double hImg = double(size.height()) / double(dpmY) * INCHES_PER_METER;
                size.setWidth(int(wImg * printerResolution));
                size.setHeight(int(hImg * printerResolution));
            }
        }
        return size;
    }
开发者ID:KDE,项目名称:gwenview,代码行数:33,代码来源:printhelper.cpp

示例11: tickLabelPosition

QSize TickSlider::sizeHint() const
{
    QSize size = QSlider::sizeHint();
    bool using_labels = tickLabelPosition() != NoTicks;
    QSize label = using_labels ? biggestLabel() : QSize();
    bool using_ticks = tickPosition() != NoTicks;
    int n_potential_labels = (maximum() - minimum()) / tickInterval();
    if (orientation() == Qt::Horizontal) {
        // Horizontal
        if (using_labels) {
            size.rheight() += 2 * label.height();
            size = size.expandedTo(QSize(
                                       n_potential_labels * label.width() +
                                       (n_potential_labels - 1) * m_min_interlabel_gap,
                                       0));
        }
        if (using_ticks) {
            size.rheight() += 2 * m_tick_length;
        }
        if (using_labels && using_ticks) {
            size.rheight() += 2 * m_tick_label_gap;
        }
        if (using_labels || using_ticks) {
            size.rheight() += 2 * m_gap_to_slider;
        }
    } else {
        // Vertical
        if (using_labels) {
            size.rwidth() += 2 * label.width();
            size = size.expandedTo(QSize(
                                       0,
                                       n_potential_labels * label.height() +
                                       (n_potential_labels - 1) * m_min_interlabel_gap));
        }
        if (using_ticks) {
            size.rwidth() += 2 * m_tick_length;
        }
        if (using_labels && using_ticks) {
            size.rwidth() += 2 * m_tick_label_gap;
        }
        if (using_labels || using_ticks) {
            size.rwidth() += 2 * m_gap_to_slider;
        }
    }
    return size;
}
开发者ID:RudolfCardinal,项目名称:camcops,代码行数:46,代码来源:tickslider.cpp

示例12: minimumSize

QSize QToolBarAreaLayout::minimumSize(const QSize &centerMin) const
{
    if (!visible)
        return centerMin;

    QSize result = centerMin;

    QSize left_min = docks[QInternal::LeftDock].minimumSize();
    QSize right_min = docks[QInternal::RightDock].minimumSize();
    QSize top_min = docks[QInternal::TopDock].minimumSize();
    QSize bottom_min = docks[QInternal::BottomDock].minimumSize();

    result.setWidth(qMax(top_min.width(), result.width()));
    result.setWidth(qMax(bottom_min.width(), result.width()));
    result.setHeight(qMax(left_min.height(), result.height()));
    result.setHeight(qMax(right_min.height(), result.height()));

    result.rwidth() += left_min.width() + right_min.width();
    result.rheight() += top_min.height() + bottom_min.height();

    return result;
}
开发者ID:MarianMMX,项目名称:MarianMMX,代码行数:22,代码来源:qtoolbararealayout.cpp

示例13: layout

QSize PropertyListFrame::minimumSizeHint() const {
    QSize size = layout()->minimumSize();
    size.setWidth(parentWidget()->width());
    return size;
}
开发者ID:sarbi127,项目名称:inviwo,代码行数:5,代码来源:propertylistwidget.cpp

示例14: sizeHint

QSize QToolBarAreaLayout::sizeHint(const QSize &centerHint) const
{
    if (!visible)
        return centerHint;

    QSize result = centerHint;

    QSize left_hint = docks[QInternal::LeftDock].sizeHint();
    QSize right_hint = docks[QInternal::RightDock].sizeHint();
    QSize top_hint = docks[QInternal::TopDock].sizeHint();
    QSize bottom_hint = docks[QInternal::BottomDock].sizeHint();

    result.setWidth(qMax(top_hint.width(), result.width()));
    result.setWidth(qMax(bottom_hint.width(), result.width()));
    result.setHeight(qMax(left_hint.height(), result.height()));
    result.setHeight(qMax(right_hint.height(), result.height()));

    result.rwidth() += left_hint.width() + right_hint.width();
    result.rheight() += top_hint.height() + bottom_hint.height();

    return result;
}
开发者ID:MarianMMX,项目名称:MarianMMX,代码行数:22,代码来源:qtoolbararealayout.cpp

示例15: QDialog

Preferences::Preferences(QupZilla* mainClass, QWidget* parent)
    : QDialog(parent)
    , ui(new Ui::Preferences)
    , p_QupZilla(mainClass)
    , m_autoFillManager(0)
    , m_pluginsList(0)
    , m_autoFillEnabled(false)
{
    setAttribute(Qt::WA_DeleteOnClose);
    ui->setupUi(this);
    ui->languages->setLayoutDirection(Qt::LeftToRight);

    m_themesManager = new ThemeManager(ui->themesWidget, this);
    m_pluginsList = new PluginsManager(this);
    ui->pluginsFrame->addWidget(m_pluginsList);

    if (QIcon::themeName().toLower() == QLatin1String("oxygen")) {
        ui->listWidget->item(0)->setIcon(QIcon::fromTheme("preferences-desktop", QIcon(":/icons/preferences/preferences-desktop.png")));
        ui->listWidget->item(1)->setIcon(QIcon::fromTheme("format-stroke-color", QIcon(":/icons/preferences/application-x-theme.png")));
        ui->listWidget->item(2)->setIcon(QIcon::fromTheme("tab-new-background", QIcon(":/icons/preferences/applications-internet.png")));
        ui->listWidget->item(3)->setIcon(QIcon::fromTheme("preferences-system-network", QIcon(":/icons/preferences/applications-webbrowsers.png")));
        ui->listWidget->item(4)->setIcon(QIcon::fromTheme("preferences-desktop-font", QIcon(":/icons/preferences/applications-fonts.png")));
        ui->listWidget->item(5)->setIcon(QIcon::fromTheme("configure-shortcuts", QIcon(":/icons/preferences/preferences-desktop-keyboard-shortcuts.png")));
        ui->listWidget->item(6)->setIcon(QIcon::fromTheme("download", QIcon(":/icons/preferences/mail-inbox.png")));
        ui->listWidget->item(7)->setIcon(QIcon::fromTheme("user-identity", QIcon(":/icons/preferences/dialog-password.png")));
        ui->listWidget->item(8)->setIcon(QIcon::fromTheme("preferences-system-firewall", QIcon(":/icons/preferences/preferences-system-firewall.png")));
        ui->listWidget->item(9)->setIcon(QIcon::fromTheme("preferences-desktop-notification", QIcon(":/icons/preferences/dialog-question.png")));
        ui->listWidget->item(10)->setIcon(QIcon::fromTheme("preferences-plugin", QIcon(":/icons/preferences/extension.png")));
        ui->listWidget->item(11)->setIcon(QIcon::fromTheme("applications-system", QIcon(":/icons/preferences/applications-system.png")));
    }
    else {
        ui->listWidget->item(0)->setIcon(QIcon::fromTheme("preferences-desktop", QIcon(":/icons/preferences/preferences-desktop.png")));
        ui->listWidget->item(1)->setIcon(QIcon::fromTheme("application-x-theme", QIcon(":/icons/preferences/application-x-theme.png")));
        ui->listWidget->item(2)->setIcon(QIcon::fromTheme("applications-internet", QIcon(":/icons/preferences/applications-internet.png")));
        ui->listWidget->item(3)->setIcon(QIcon::fromTheme("applications-webbrowsers", QIcon(":/icons/preferences/applications-webbrowsers.png")));
        ui->listWidget->item(4)->setIcon(QIcon::fromTheme("applications-fonts", QIcon(":/icons/preferences/applications-fonts.png")));
        ui->listWidget->item(5)->setIcon(QIcon::fromTheme("preferences-desktop-keyboard-shortcuts", QIcon(":/icons/preferences/preferences-desktop-keyboard-shortcuts.png")));
        ui->listWidget->item(6)->setIcon(QIcon::fromTheme("mail-inbox", QIcon(":/icons/preferences/mail-inbox.png")));
        ui->listWidget->item(7)->setIcon(QIcon::fromTheme("dialog-password", QIcon(":/icons/preferences/dialog-password.png")));
        ui->listWidget->item(8)->setIcon(QIcon::fromTheme("preferences-system-firewall", QIcon(":/icons/preferences/preferences-system-firewall.png")));
        ui->listWidget->item(9)->setIcon(QIcon::fromTheme("dialog-question", QIcon(":/icons/preferences/dialog-question.png")));
        ui->listWidget->item(10)->setIcon(QIcon::fromTheme("extension", QIcon(":/icons/preferences/extension.png")));
        ui->listWidget->item(11)->setIcon(QIcon::fromTheme("applications-system", QIcon(":/icons/preferences/applications-system.png")));
    }

    Settings settings;
    //GENERAL URLs
    settings.beginGroup("Web-URL-Settings");
    m_homepage = settings.value("homepage", "qupzilla:start").toString();
    m_newTabUrl = settings.value("newTabUrl", "qupzilla:speeddial").toString();
    ui->homepage->setText(m_homepage);
    ui->newTabUrl->setText(m_newTabUrl);
    int afterLaunch = settings.value("afterLaunch", 1).toInt();
    settings.endGroup();
    ui->afterLaunch->setCurrentIndex(afterLaunch);
    ui->checkUpdates->setChecked(settings.value("Web-Browser-Settings/CheckUpdates", DEFAULT_CHECK_UPDATES).toBool());
    ui->dontLoadTabsUntilSelected->setChecked(settings.value("Web-Browser-Settings/LoadTabsOnActivation", false).toBool());

#if defined(Q_OS_WIN) && !defined(Q_OS_OS2)
    ui->checkDefaultBrowser->setChecked(settings.value("Web-Browser-Settings/CheckDefaultBrowser", DEFAULT_CHECK_DEFAULTBROWSER).toBool());
    if (mApp->associationManager()->isDefaultForAllCapabilities()) {
        ui->checkNowDefaultBrowser->setText(tr("Default"));
        ui->checkNowDefaultBrowser->setEnabled(false);
    }
    else {
        ui->checkNowDefaultBrowser->setText(tr("Set as default"));
        ui->checkNowDefaultBrowser->setEnabled(true);
        connect(ui->checkNowDefaultBrowser, SIGNAL(clicked()), this, SLOT(makeQupZillaDefault()));
    }
#else // No Default Browser settings on non-Windows platform
    ui->hSpacerDefaultBrowser->changeSize(0, 0, QSizePolicy::Fixed, QSizePolicy::Fixed);
    ui->hLayoutDefaultBrowser->invalidate();
    delete ui->hLayoutDefaultBrowser;
    delete ui->checkDefaultBrowser;
    delete ui->checkNowDefaultBrowser;
#endif

    ui->newTabFrame->setVisible(false);
    if (m_newTabUrl.isEmpty()) {
        ui->newTab->setCurrentIndex(0);
    }
    else if (m_newTabUrl == m_homepage) {
        ui->newTab->setCurrentIndex(1);
    }
    else if (m_newTabUrl == QLatin1String("qupzilla:speeddial")) {
        ui->newTab->setCurrentIndex(2);
    }
    else {
        ui->newTab->setCurrentIndex(3);
        ui->newTabFrame->setVisible(true);
    }

    afterLaunchChanged(ui->afterLaunch->currentIndex());
    connect(ui->afterLaunch, SIGNAL(currentIndexChanged(int)), this, SLOT(afterLaunchChanged(int)));
    connect(ui->newTab, SIGNAL(currentIndexChanged(int)), this, SLOT(newTabChanged(int)));
    if (p_QupZilla) {
        connect(ui->useCurrentBut, SIGNAL(clicked()), this, SLOT(useActualHomepage()));
        connect(ui->newTabUseCurrent, SIGNAL(clicked()), this, SLOT(useActualNewTab()));
    }
    else {
//.........这里部分代码省略.........
开发者ID:echostorm,项目名称:qupzilla,代码行数:101,代码来源:preferences.cpp


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