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


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

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


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

示例1: main

int main(int argc, char *argv[])
{

    KAboutData aboutData("photolayoutseditor",
                         0,
                         ki18n("Photo Layouts Editor"),
                         QString("").toUtf8(),
                         ki18n(""),
                         KAboutData::License_GPL,
                         ki18n(""),
                         ki18n(""),
                         QString("").toUtf8());

    KCmdLineArgs::init(argc,argv,&aboutData);

    KApplication a;

    PhotoLayoutsEditor * w = PhotoLayoutsEditor::instance(0);
    w->setAttribute(Qt::WA_DeleteOnClose, true);
    int height = QApplication::desktop()->height()-500;
    w->resize(round(height*16.0/9.0),height);
    QDesktopWidget * d = a.desktop();
    w->move(d->rect().center()-w->frameGeometry().center());
    w->show();

    int result = a.exec();

    return result;
}
开发者ID:coder89,项目名称:PhotoLayoutsEditor,代码行数:29,代码来源:main.cpp

示例2: QObject

App::App(QObject *parent) :
    QObject(parent)
{

    /* Changes application language on runtime */
    _languageSelector = new LanguageSelector();

    QDesktopWidget *desktop = QApplication::desktop();

    /* Widget that contains OpenGL view and info view */
    _screenWidget = new ScreenWidget();
    _screenWidget->setGeometry(desktop->rect());
    _viewportWidget = new ViewportWidget(_screenWidget);
    _infoWidget = new InfoWidget(_screenWidget);

    /* Main menu */
    _mw = new MainWindow(desktop, _screenWidget, _infoWidget,
                                    desktop->width(), desktop->height());

    /* Set up controller */
    _imageReader = new ImageReader();
    _controller = new Controller(_mw, _imageReader, _languageSelector);

    /* Metadata for debugging */
    _screenWidget->setObjectName(QString("ScreenWidget"));
    _viewportWidget->setObjectName(QString("ViewportWidget"));
    _infoWidget->setObjectName(QString("InfoWidget"));
    _mw->setObjectName(QString("MainWindow"));

}
开发者ID:diorahman,项目名称:arteacher,代码行数:30,代码来源:app.cpp

示例3: KXmlGuiWindow

PhotoLayoutsEditor::PhotoLayoutsEditor(QWidget * parent) :
    KXmlGuiWindow(parent),
    m_canvas(0),
    m_interface(0),
    d(new PhotoLayoutsEditorPriv)
{
    m_instance = this;
    componentData().setAboutData( PLEAboutData() );

    initIconsResource();
    setXMLFile("photolayoutseditorui.rc");
    setCaption("Photo Layouts Editor");

    loadEffects();
    loadBorders();
    setupActions();
    createWidgets();
    refreshActions();

    setAcceptDrops(true);
    int height = QApplication::desktop()->height()*0.8;
    resize(qRound(height*16.0/9.0),height);
    QDesktopWidget* d = KApplication::kApplication()->desktop();
    move(d->rect().center() - this->frameGeometry().center());
}
开发者ID:tejastank,项目名称:kipi-plugins,代码行数:25,代码来源:photolayoutseditor.cpp

示例4: popupPosition

/*!
    \overload
    \internal
    Calculates the position at which the ScrollDial will
    be shown.
*/
QPoint QtScrollDial::popupPosition()
{
    // Get information about the users screen size
    QDesktopWidget desktop;
    QRect desktopRect = (desktop.rect());

    const int w = m_popup->sizeHint().width();
    const int h = m_popup->sizeHint().height();

    // 15 pixel is the popup's m_closeButton.height() / 2
    QPoint popupPosition(rect().right(), -15);

    QPoint globalPos = mapToGlobal(popupPosition);

    // if it does not fit on the right, move to the left
    if (globalPos.x() + w > desktopRect.right()) {
        globalPos.setX(globalPos.x() - width() - w);
    }

    if (globalPos.x() + w > desktopRect.right()) {
        globalPos.setX(desktopRect.right() - w);
    }
    if (globalPos.x() < desktopRect.left()) {
        globalPos.setX(desktopRect.left());
    }
    if (globalPos.y() < desktopRect.top()) {
        globalPos.setY(desktopRect.top());
    }
    if (globalPos.y() + h > desktopRect.bottom()) {
        globalPos.setY(desktopRect.bottom() - h);
    }

    return globalPos;
}
开发者ID:Linux-enCaja,项目名称:SIE,代码行数:40,代码来源:qtscrolldial.cpp

示例5: availableGeometry

const QRect XfitMan::availableGeometry(int screen) const
{
    QDesktopWidget *d = QApplication::desktop();

    if (screen < 0 || screen >= d->screenCount())
        screen = d->primaryScreen();

    QRect available = d->screenGeometry(screen);

    // Iterate over all the client windows and subtract from the available
    // area the space they reserved on the edges (struts).
    // Note: _NET_WORKAREA is not reliable as it exposes only one
    // rectangular area spanning all screens.
    Display *display = QX11Info::display();
    int x11Screen = d->isVirtualDesktop() ? DefaultScreen(display) : screen;

    Atom ret;
    int format, status;
    uchar* data = 0;
    ulong nitems, after;

    status = XGetWindowProperty(display, QX11Info::appRootWindow(x11Screen),
                                atom("_NET_CLIENT_LIST"), 0L, ~0L, False, XA_WINDOW,
                                &ret, &format, &nitems, &after, &data);

    if (status == Success && ret == XA_WINDOW && format == 32 && nitems)
    {
        const QRect desktopGeometry = d->rect();

        Window* xids = (Window*) data;
        for (quint32 i = 0; i < nitems; ++i)
        {
            ulong nitems2;
            uchar* data2 = 0;
            status = XGetWindowProperty(display, xids[i],
                                        atom("_NET_WM_STRUT_PARTIAL"), 0, 12, False, XA_CARDINAL,
                                        &ret, &format, &nitems2, &after, &data2);

            if (status == Success && ret == XA_CARDINAL && format == 32 && nitems2 == 12)
            {
                ulong* struts = (ulong*) data2;

                QRect left(desktopGeometry.x(),
                           desktopGeometry.y() + struts[4],
                           struts[0],
                           struts[5] - struts[4]);
                if (available.intersects(left))
                    available.setX(left.width());

                QRect right(desktopGeometry.x() + desktopGeometry.width() - struts[1],
                            desktopGeometry.y() + struts[6],
                            struts[1],
                            struts[7] - struts[6]);
                if (available.intersects(right))
                    available.setWidth(right.x() - available.x());

                QRect top(desktopGeometry.x() + struts[8],
                          desktopGeometry.y(),
                          struts[9] - struts[8],
                          struts[2]);
                if (available.intersects(top))
                    available.setY(top.height());

                QRect bottom(desktopGeometry.x() + struts[10],
                             desktopGeometry.y() + desktopGeometry.height() - struts[3],
                             struts[11] - struts[10],
                             struts[3]);
                if (available.intersects(bottom))
                    available.setHeight(bottom.y() - available.y());
            }
            if (data2)
                XFree(data2);
        }
    }
    if (data)
        XFree(data);

    return available;
}
开发者ID:Devoter,项目名称:razor-qt,代码行数:79,代码来源:xfitman.cpp


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