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


C++ QDesktopWidget::size方法代码示例

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


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

示例1: makeDimension

/*
 * Returns the screen size.
 */
JNIEXPORT jobject JNICALL Java_gnu_java_awt_peer_qt_QtToolkit_getScreenSize
(JNIEnv *env, jobject obj)
{
  QDesktopWidget *d = QApplication::desktop();
  QSize s = d->size();
  return makeDimension( env, &s );
}
开发者ID:0day-ci,项目名称:gcc,代码行数:10,代码来源:qttoolkit.cpp

示例2: size

MainWindow::MainWindow()
: QMainWindow(0)
, m_statusBarLabel(0)
, m_uiActions(0)
{
    setupUi(this);
    setupActions();
    setState(core::GUI_STATE_STOPPED);
    m_statusBarLabel = new QLabel;
    statusBar()->addPermanentWidget(m_statusBarLabel);

    connect(mainWidget, SIGNAL(itemCountChanged(int)),
             this, SLOT(itemCountUpdate(int)));
    connect(mainWidget, SIGNAL(romDoubleClicked(QString, unsigned int)),
             this, SLOT(romOpen(QString, unsigned int)));

    QSize size(core::config_get_number("MainWindowWidth",600),
               core::config_get_number("MainWindowHeight",400));
    QPoint position(core::config_get_number("MainWindowXPosition",0),
                    core::config_get_number("MainWindowYPosition",0));

    QDesktopWidget *d = QApplication::desktop();
    QSize desktop = d->size();

    if (position.x() > desktop.width()) {
        position.setX(0);
    }
    if (position.y() > desktop.height()) {
        position.setY(0);
    }

    if (size.width() > desktop.width()) {
        size.setWidth(600);
    }
    if (size.height() > desktop.height()) {
        size.setHeight(400);
    }

    if ((position.x() + size.width()) > desktop.width()) {
        position.setX(desktop.width() - size.width());
    }
    if ((position.y()+size.height())>desktop.height()) {
        position.setY(desktop.height() - size.height());
    }

    resize(size);
    move(position);
}
开发者ID:kholdfuzion,项目名称:vg64tools,代码行数:48,代码来源:mainwindow.cpp

示例3: loadImage

/*!
    \fn ViewerWidget::loadImage(int file_index)
    \param file_index index to QStringList files
    load files[file_index] into a texture object if it is not already cached
 */
Texture* ViewerWidget::loadImage(int file_index)
{
    int imod = file_index%CACHESIZE; //index for cache
    if (cache[imod].file_index==file_index)
    {
        //image is already cached
        kDebug() << "image " << file_index << " is already in [email protected]" << imod ;
        return cache[imod].texture;

    }
    else
    {
        // image is net yet loaded
        QString f = files[file_index];
        kDebug() << "loading image " << f << "(idx=" << file_index << ") to [email protected]" << imod ;
        cache[imod].file_index=file_index;

        //when loadImage is called the first time, the frame is not yet fullscreen
        QSize size;
        if (firstImage)
        {
            //determine screensize since its not yet known by the widget
            QDesktopWidget dw;
            QRect r = dw.screenGeometry(this);
            size    = dw.size();
            //kDebug() << "first image:size=" << size.width();
        }
        else
        {
            size = QSize(width(),height());
            //kDebug() << "next image:size=" << size.width();
        }

        // handle non-loadable images
        if (!cache[imod].texture->load(f,size,tex[0]))
        {
            cache[imod].texture->load(nullImage,size,tex[0]);
        }

        cache[imod].texture->setViewport(size.width(),size.height());
        return cache[imod].texture;
    }
}
开发者ID:UIKit0,项目名称:digikam-2012-kipi-plugins,代码行数:48,代码来源:viewerwidget.cpp

示例4: on_buttonFullscreen_clicked

void Widget::on_buttonFullscreen_clicked()
{
    static QSize oldSize;
    static QPoint oldPosition;
    static bool isFullScreen = false;
    QString str;
    QPixmap pixmap;

    if (isFullScreen == true) {
        ui->frameToolbar->show();
        ui->frameBottom->show();
        showNormal();
        ui->viewArea->resize(oldSize);
        ui->viewArea->move(oldPosition);
        str = currentImages.at(currentIndex)->getPathString();
        pixmap = QPixmap(str).scaled(oldSize, Qt::KeepAspectRatio, Qt::SmoothTransformation);
        currentImage->setPixmap(pixmap);
        isFullScreen = false;

        if (timerId != 0)
            killTimer(timerId);

    } else {
        oldSize = ui->viewArea->size();
        oldPosition = ui->viewArea->pos();

        QDesktopWidget *desktop = QApplication::desktop();
        QSize size = desktop->size();
        ui->frameToolbar->hide();
        ui->frameBottom->hide();
        showFullScreen();
        ui->viewArea->resize(size);
        ui->viewArea->move(0, 0);
        str = currentImages.at(currentIndex)->getPathString();
        pixmap = QPixmap(str).scaled(size, Qt::KeepAspectRatio, Qt::SmoothTransformation);
        currentImage->setPixmap(pixmap);
        isFullScreen = true;
    }
}
开发者ID:cakturk,项目名称:ImageViewer,代码行数:39,代码来源:widget.cpp


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