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


C++ QSize::isEmpty方法代码示例

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


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

示例1: QSize

QQuickItemGrabResult *QQuickItemGrabResultPrivate::create(QQuickItem *item, const QSize &targetSize)
{
    QSize size = targetSize;
    if (size.isEmpty())
        size = QSize(item->width(), item->height());

    if (size.width() < 1 || size.height() < 1) {
        qWarning("Item::grabToImage: item has invalid dimensions");
        return 0;
    }

    if (!item->window()) {
        qWarning("Item::grabToImage: item is not attached to a window");
        return 0;
    }

    if (!item->window()->isVisible()) {
        qWarning("Item::grabToImage: item's window is not visible");
        return 0;
    }

    QQuickItemGrabResult *result = new QQuickItemGrabResult();
    QQuickItemGrabResultPrivate *d = result->d_func();
    d->item = item;
    d->window = item->window();
    d->textureSize = size;

    QQuickItemPrivate::get(item)->refFromEffectItem(false);

    // trigger sync & render
    item->window()->update();

    return result;
}
开发者ID:venkatarajasekhar,项目名称:Qt,代码行数:34,代码来源:qquickitemgrabresult.cpp

示例2: viewportAttributesForSize

QWKPage::ViewportAttributes QWKPage::viewportAttributesForSize(const QSize& availableSize) const
{
    static int desktopWidth = 980;
    static int deviceDPI = 160;

    ViewportAttributes result;

    if (availableSize.isEmpty())
        return result; // Returns an invalid instance.

    // FIXME: Add a way to get these data via the platform plugin and fall back
    // to the size of the view.
    int deviceWidth = 480;
    int deviceHeight = 864;

    WebCore::ViewportAttributes conf = WebCore::computeViewportAttributes(d->viewportArguments, desktopWidth, deviceWidth, deviceHeight, deviceDPI, availableSize);

    result.m_isValid = true;
    result.m_size = conf.layoutSize;
    result.m_initialScaleFactor = conf.initialScale;
    result.m_minimumScaleFactor = conf.minimumScale;
    result.m_maximumScaleFactor = conf.maximumScale;
    result.m_devicePixelRatio = conf.devicePixelRatio;
    result.m_isUserScalable = static_cast<bool>(conf.userScalable);

    return result;
}
开发者ID:redanium,项目名称:qt,代码行数:27,代码来源:qwkpage.cpp

示例3: createFrames

//virtual
void PixmapFilmstripObject::createFrames(const QSize& frameSize,quint32 numFrames,FrameDirection::Enum direction,const QPoint& startOffset)
{
	if ((numFrames == 0) || (direction == FrameDirection::INVALID) || frameSize.isEmpty() || (!frameSize.isValid()))
	{
		return;
	}
	QPoint adder;
	switch (direction)
	{
	case FrameDirection::North:
		adder = QPoint(0,-frameSize.height());
		break;
	case FrameDirection::South:
		adder = QPoint(0,frameSize.height());
		break;
	case FrameDirection::East:
		adder = QPoint(-frameSize.width(),0);
		break;
	case FrameDirection::West:
		adder = QPoint(frameSize.width(),0);
	default:
		break;
	}
	QPoint currentOrigin = startOffset;
	QList<QRect> frameCoordinates;
	for (quint32 i = 0;i<numFrames;++i,currentOrigin+=adder)
	{
		frameCoordinates << QRect(currentOrigin,frameSize);
	}
	createFrames(frameCoordinates);
}
开发者ID:22350,项目名称:luna-sysmgr,代码行数:32,代码来源:pixmapfilmstripobject.cpp

示例4: main

int main(int argc, char **argv)
{
    LXQt::SingleApplication app(argc, argv);
    app.setOrganizationName(QStringLiteral("lxqt"));
    app.setApplicationName(QStringLiteral("lxqt-config"));
    app.setAttribute(Qt::AA_UseHighDpiPixmaps, true);

    QCommandLineParser parser;
    parser.setApplicationDescription(QStringLiteral("LXQt Config"));
    const QString VERINFO = QStringLiteral(LXQT_CONFIG_VERSION
                                           "\nliblxqt   " LXQT_VERSION
                                           "\nQt        " QT_VERSION_STR);
    app.setApplicationVersion(VERINFO);
    parser.addVersionOption();
    parser.addHelpOption();
    parser.process(app);

    // ensure that we use lxqt-config.menu file.
    qputenv("XDG_MENU_PREFIX", "lxqt-");

    LXQtConfig::MainWindow w;
    app.setActivationWindow(&w);
    QSize s = QSettings{}.value("size").toSize();
    if (!s.isEmpty())
        w.resize(s);
    w.show();

    int ret = app.exec();

    QSettings{}.setValue("size", w.size());

    return ret;
}
开发者ID:rbuj,项目名称:lxqt-config,代码行数:33,代码来源:main.cpp

示例5: minimumSizeHint

/******************************************************************************
* Return the minimum size for the tab, adjusted if necessary to a height that
* fits the screen.
* In order to make the QStackedWidget containing the tabs take the correct
* size, the value returned is actually the minimum size of the largest tab.
* Otherwise, only the currently visible tab would be taken into account with
* the result that the dialog would initially be displayed too small.
*/
QSize StackedScrollGroup::minimumSizeHint() const
{
    QSize s = maxMinimumSizeHint();
    if (!s.isEmpty()  &&  mMinHeight > 0  &&  mMinHeight < s.height())
        return QSize(s.width() + mWidgets[0]->style()->pixelMetric(QStyle::PM_ScrollBarExtent), mMinHeight);
    return s;
}
开发者ID:chusopr,项目名称:kdepim-ktimetracker-akonadi,代码行数:15,代码来源:stackedwidgets.cpp

示例6: getSetting

/** Restores the last size and location of the window. */
void
VidaliaWindow::restoreWindowState()
{
#if QT_VERSION >= 0x040200
  QByteArray geometry = getSetting("Geometry", QByteArray()).toByteArray();
  if (geometry.isEmpty())
    adjustSize();
  else
    restoreGeometry(geometry);
#else
  QRect screen = QDesktopWidget().availableGeometry();

  /* Restore the window size. */
  QSize size = getSetting("Size", QSize()).toSize();
  if (!size.isEmpty()) {
    size = size.boundedTo(screen.size());
    resize(size);
  }

  /* Restore the window position. */
  QPoint pos = getSetting("Position", QPoint()).toPoint();
  if (!pos.isNull() && screen.contains(pos)) {
    move(pos);
  }
#endif
}
开发者ID:IRET0x00,项目名称:vidalia,代码行数:27,代码来源:VidaliaWindow.cpp

示例7: render

bool WebPage::render(const QString &fileName, const QSize &minimumSize) {
  QFileInfo fileInfo(fileName);
  QDir dir;
  dir.mkpath(fileInfo.absolutePath());

  QSize viewportSize = this->viewportSize();
  this->setViewportSize(minimumSize);
  QSize pageSize = this->mainFrame()->contentsSize();
  if (pageSize.isEmpty()) {
    return false;
  }

  QImage buffer(pageSize, QImage::Format_ARGB32);
  buffer.fill(qRgba(255, 255, 255, 0));

  QPainter p(&buffer);
  p.setRenderHint( QPainter::Antialiasing,          true);
  p.setRenderHint( QPainter::TextAntialiasing,      true);
  p.setRenderHint( QPainter::SmoothPixmapTransform, true);

  this->setViewportSize(pageSize);
  this->mainFrame()->render(&p);

  QImage pointer = QImage(":/pointer.png");
  p.drawImage(m_mousePosition, pointer);

  p.end();
  this->setViewportSize(viewportSize);

  return buffer.save(fileName);
}
开发者ID:betelgeuse,项目名称:capybara-webkit,代码行数:31,代码来源:WebPage.cpp

示例8: load

QImageLoadThreadPool::PATH_STATUS QImageLoadThreadPool::load(QString path, int &bytesLoaded) {
    PATH_STATUS status = PATH_NULL;
    controlInternal.lock();
    if (workers.length() < 3) {
        bool gtg = true;
        for (LoadThread &lt : workers) {
            if (lt.first == path) gtg = false;
        }
        if (gtg) {
            QImageReader imgTest(path);
            QSize tSize = imgTest.size();
            if (tSize.isEmpty()) {
                status = PATH_FAILURE;
            } else {
                int bytesToLoad = tSize.width() * tSize.height() * 4;
                if (bytesLoaded + bytesToLoad > maxBytes) {
                    status = PATH_INSUFFICIENT_MEMORY;
                } else {
                    bytesLoaded += bytesToLoad;
                    workers.append(LoadThread(path, new std::thread(std::bind(&QImageLoadThreadPool::internalThreadRun, this, path))));
                    status = PATH_SUCCESS;
                }
            }
        } else {
            status = PATH_ALREADY_LOADING;
        }
    } else {
        status = PATH_MAX_WORKERS;
    }
    controlInternal.unlock();
    return status;
}
开发者ID:cagelight,项目名称:Flamingo,代码行数:32,代码来源:qo_hotloadimage.cpp

示例9: sizeHint

QSize QtDNDTabBar::sizeHint() const {
	QSize hint = QTabBar::sizeHint();
	if (hint.isEmpty()) {
		hint = QSize(parentWidget()->width(), defaultTabHeight);
	}
	return hint;
}
开发者ID:scopeInfinity,项目名称:swift,代码行数:7,代码来源:QtDNDTabBar.cpp

示例10: updateFileSizeLabel

void DkCompressDialog::updateFileSizeLabel(float bufferSize, QSize bufferImgSize, float factor) {

	if (bufferImgSize.isEmpty())
		bufferImgSize = mNewImg.size();

	if (mImg.isNull() || bufferSize == -1 || bufferImgSize.isNull()) {
		mPreviewSizeLabel->setText(tr("File Size: --"));
		mPreviewSizeLabel->setEnabled(false);
		return;
	}
	mPreviewSizeLabel->setEnabled(true);

	if (factor == -1.0f)
		factor = 1.0f;

	float depth = (mDialogMode == jpg_dialog || mDialogMode == j2k_dialog || (mDialogMode == web_dialog && mHasAlpha)) ? 24.0f : (float)mImg.depth();	// jpg uses always 24 bit
	
	float rawBufferSize = bufferImgSize.width()*bufferImgSize.height()*depth/8.0f;
	float rawImgSize = factor*(mImg.width()*mImg.height()*depth/8.0f);

	//qDebug() << "I need: " << rawImgSize*bufferSize/rawBufferSize << " bytes because buffer size: " << bufferSize;
	//qDebug() << "new image: " << newImg.size() << " full image: " << img->size() << " depth: " << depth;

	mPreviewSizeLabel->setText(tr("File Size: ~%1").arg(DkUtils::readableByte(rawImgSize*bufferSize/rawBufferSize)));
}
开发者ID:007durgesh219,项目名称:nomacs,代码行数:25,代码来源:DkSaveDialog.cpp

示例11: CreateBrowser

bool QCefWebView::CreateBrowser(const QSize& size) {
    //qDebug() << __FUNCTION__ << __LINE__;
    if (browser_state_ != kNone || size.isEmpty()) {
        return false;
    }
    mutex_.lock();
    if (browser_state_ != kNone) {
        mutex_.unlock();
        return false;
    }
    //qDebug() << __FUNCTION__ << __LINE__;
    RECT rect;
    rect.left = 0;
    rect.top = 0;
    rect.right = size.width();
    rect.bottom = size.height();
    CefWindowInfo info;
    CefBrowserSettings settings;
    info.SetAsChild((HWND) this->winId(), rect);
    qcef_client_handler->set_listener(this);
    QString url = url_.isEmpty() ? kUrlBlank : url_.toString();
    CefBrowserHost::CreateBrowser(info,
                                  qcef_client_handler.get(),
                                  CefString(url.toStdWString()),
                                  settings,
                                  NULL);

    browser_state_ = kCreating;
    mutex_.unlock();
    return true;
}
开发者ID:Ali-I,项目名称:CsoundQt,代码行数:31,代码来源:qcefwebview.cpp

示例12: setGeometry

void QWSSharedMemSurface::setGeometry(const QRect &rect)
{
    const QSize size = rect.size();
    if (img.size() != size) {
        if (size.isEmpty()) {
            mem.detach();
            img = QImage();
        } else {
            mem.detach();

            QWidget *win = window();
            const QImage::Format format = preferredImageFormat(win);
            const int bpl = nextMulOf4(bytesPerPixel(format) * size.width());
#ifdef QT_QWS_CLIENTBLIT
            const int imagesize = bpl * size.height() + sizeof(uint);
#else
            const int imagesize = bpl * size.height();
#endif
            if (!mem.create(imagesize)) {
                perror("QWSSharedMemSurface::setGeometry allocating shared memory");
                qFatal("Error creating shared memory of size %d", imagesize);
            }
#ifdef QT_QWS_CLIENTBLIT
            *((uint *)mem.address()) = 0;
            uchar *base = static_cast<uchar*>(mem.address()) + sizeof(uint);
#else
            uchar *base = static_cast<uchar*>(mem.address());
#endif
            img = QImage(base, size.width(), size.height(), bpl, format);
            setImageMetrics(img, win);
        }
    }

    QWSWindowSurface::setGeometry(rect);
}
开发者ID:Marforius,项目名称:qt,代码行数:35,代码来源:qwindowsurface_qws.cpp

示例13: fromFile

bool QGLPixmapData::fromFile(const QString &filename, const char *format,
                             Qt::ImageConversionFlags flags)
{
    if (pixelType() == QPixmapData::BitmapType)
        return QPixmapData::fromFile(filename, format, flags);
    QFile file(filename);
    if (!file.open(QIODevice::ReadOnly))
        return false;
    QByteArray data = file.peek(64);
    bool alpha;
    if (m_texture.canBindCompressedTexture
            (data.constData(), data.size(), format, &alpha)) {
        resize(0, 0);
        data = file.readAll();
        file.close();
        QGLShareContextScope ctx(qt_gl_share_widget()->context());
        QSize size = m_texture.bindCompressedTexture
            (data.constData(), data.size(), format);
        if (!size.isEmpty()) {
            w = size.width();
            h = size.height();
            is_null = false;
            d = 32;
            m_hasAlpha = alpha;
            m_source = QImage();
            m_dirty = isValid();
            return true;
        }
        return false;
    }
    fromImage(QImageReader(&file, format).read(), flags);
    return !isNull();
}
开发者ID:Nacto1,项目名称:qt-everywhere-opensource-src-4.6.2,代码行数:33,代码来源:qpixmapdata_gl.cpp

示例14: r

static inline void qwtDrawPixmapSymbols( QPainter *painter,
    const QPointF *points, int numPoints, const QwtSymbol &symbol )
{
    QSize size = symbol.size();
    if ( size.isEmpty() )
        size = symbol.pixmap().size();

    const QTransform transform = painter->transform();
    if ( transform.isScaling() )
    {
        const QRect r( 0, 0, size.width(), size.height() );
        size = transform.mapRect( r ).size();
    }

    QPixmap pm = symbol.pixmap();
    if ( pm.size() != size )
        pm = pm.scaled( size );
    
    QPointF pinPoint( 0.5 * size.width(), 0.5 * size.height() );
    if ( symbol.isPinPointEnabled() )
        pinPoint = symbol.pinPoint();

    painter->resetTransform();

    for ( int i = 0; i < numPoints; i++ )
    {
        const QPointF pos = transform.map( points[i] ) - pinPoint;

        QwtPainter::drawPixmap( painter, 
            QRect( pos.toPoint(), pm.size() ), pm );
    }
}
开发者ID:CaptainFalco,项目名称:OpenPilot,代码行数:32,代码来源:qwt_symbol.cpp

示例15: resizeToVideo

void MainWindow::resizeToVideo(MediaWidget::ResizeFactor resizeFactor)
{
	if (!isFullScreen() && !mediaWidget->sizeHint().isEmpty()) {
		if (isMaximized()) {
			setWindowState(windowState() & ~Qt::WindowMaximized);
		}

		QSize videoSize;

		switch (resizeFactor) {
		case MediaWidget::ResizeOff:
			break;
		case MediaWidget::OriginalSize:
			videoSize = mediaWidget->sizeHint();
			break;
		case MediaWidget::DoubleSize:
			videoSize = (2 * mediaWidget->sizeHint());
			break;
		}

		if (!videoSize.isEmpty()) {
			resize(size() - centralWidget()->size() + videoSize);
		}
	}
}
开发者ID:KDE,项目名称:kaffeine,代码行数:25,代码来源:mainwindow.cpp


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