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


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

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


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

示例1: QDialog

SystemWindow::SystemWindow() : QDialog(), ui(new Ui::SystemWindow){
  ui->setupUi(this); //load the designer file
  //Setup the window flags
  this->setWindowFlags( Qt::Tool | Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint);
  //Setup the icons based on the current theme
  ui->tool_logout->setIcon( LXDG::findIcon("system-log-out","") );
  ui->tool_restart->setIcon( LXDG::findIcon("system-reboot","") );
  ui->tool_shutdown->setIcon( LXDG::findIcon("system-shutdown","") );
  ui->push_cancel->setIcon( LXDG::findIcon("dialog-cancel","") );
  ui->push_lock->setIcon( LXDG::findIcon("system-lock-screen","") );
  //Connect the signals/slots
  connect(ui->tool_logout, SIGNAL(clicked()), this, SLOT(sysLogout()) );
  connect(ui->tool_restart, SIGNAL(clicked()), this, SLOT(sysRestart()) );
  connect(ui->tool_shutdown, SIGNAL(clicked()), this, SLOT(sysShutdown()) );
  connect(ui->push_cancel, SIGNAL(clicked()), this, SLOT(sysCancel()) );
  connect(ui->push_lock, SIGNAL(clicked()), this, SLOT(sysLock()) );
  //Disable the shutdown/restart buttons if necessary
  if( !LOS::userHasShutdownAccess() ){
    ui->tool_restart->setEnabled(false);
    ui->tool_shutdown->setEnabled(false);
  }
  //Center this window on the screen
  QDesktopWidget desktop;
  this->move(desktop.screenGeometry().width()/2 - this->width()/2, desktop.screenGeometry().height()/2 - this->height()/2);
  this->show();
}
开发者ID:KhuramAli,项目名称:lumina,代码行数:26,代码来源:SystemWindow.cpp

示例2: fillScreens

void PCDMgui::fillScreens(){
    //Set a background image on any other available screens
    QDesktopWidget *DE = QApplication::desktop();
    screens.clear();
    //Generate the background style sheet
    //QString tmpIcon = currentTheme->itemIcon("background");
    //if( tmpIcon.isEmpty() || !QFile::exists(tmpIcon) ){ tmpIcon = ":/images/backgroundimage.jpg"; }
    //QString bgstyle = "QWidget#BGSCREEN{border-image: url(BGIMAGE) stretch;}"; 
      //bgstyle.replace("BGIMAGE", tmpIcon);
    //this->setStyleSheet(bgstyle);
    //Now apply the background to all the other screens   
    // - Keep track of the total width/height of all screens combined (need to set the QMainWindow to this size)
    int wid, high;
    wid = high = 0;
    for(int i=0; i<DE->screenCount(); i++){
      //if(i != DE->screenNumber(this)){
        //Just show a generic QWidget with the proper background image on every screen
	QWidget *screen = new QWidget(this->centralWidget());
	screen->setObjectName("BGSCREEN");
	QRect rec = DE->screenGeometry(i);
	screen->setGeometry( rec );
	if(rec.height() > high){ high = rec.height(); }
	wid += rec.width();
	//screen->setStyleSheet(bgstyle);
	screen->show();
	screens << screen;
      /*}else{
        //Now move the mouse cursor over this window (fix for multi-monitor setups)
        QCursor::setPos( DE->screenGeometry(i).center() );	      
      }*/
    }
    this->setGeometry(0,0,wid,high);
    this->activateWindow();
    QCursor::setPos( DE->screenGeometry(0).center() );	  
}
开发者ID:cthunter01,项目名称:pcbsd,代码行数:35,代码来源:pcdm-gui.cpp

示例3: on_btnDC_clicked

/*************ClientP: Delete Acc******************/
void MainWindow::on_btnDC_clicked()
{
    QMessageBox message(QMessageBox::Warning,"Are you sure?","Once it did, it can not be undo!",QMessageBox::Yes|QMessageBox::No,NULL);
    if (message.exec()==QMessageBox::Yes)
    {
       showme("yes!");
       Msg msg=sendAndGet(userName_,userPassword_,"dc","","","","","","");
       bool flag=msg.opResult;
       if(!flag){
           showme("Error in delete User");
       }
       ui->stackedWidget->setCurrentIndex(0);
       ui->widgetWelcome->show();
       ui->widgetLog->hide();
       QDesktopWidget* desktopWidget = QApplication::desktop();
       int winWidth=desktopWidget->screenGeometry().width();
       int winHeight=desktopWidget->screenGeometry().height();
       QRect winRect((winWidth-400)/2,(winHeight-300)/2,400,300);
       this->setGeometry(winRect);
       this->setFixedSize(400,300);
       userName_="";
       userPassword_="";
    }
    else
    {
        showme("no!");
    }
}
开发者ID:hellokenlee,项目名称:AgendaAdvanced,代码行数:29,代码来源:mainwindow.cpp

示例4: init

void RegionGrab::init()
{
  m_pixmap = m_grabber->grabFullScreen();

  QDesktopWidget *desktop = QApplication::desktop();
  QRect rect;

  if (desktop->screenCount() > 1) {
    for (int i = 0; i < desktop->screenCount(); ++i) {
      if (rect.isNull())
        rect = desktop->screenGeometry(i);
      else
        rect = rect.united(desktop->screenGeometry(i));
    }
  }
  else
    rect = QRect(QPoint(0, 0), m_pixmap.size());

  resize(rect.size());
  move(rect.topLeft());
  setCursor(Qt::CrossCursor);

# ifdef Q_OS_MAC
  showFullScreen();
# else
  show();
# endif

  raise();
  activateWindow();
  setFocus();
}
开发者ID:impomezia,项目名称:screenpic,代码行数:32,代码来源:RegionGrab.cpp

示例5: movePointOntoDesktop

QPoint InviwoApplicationQt::movePointOntoDesktop(const QPoint& point, const QSize& size,
                                                 bool decorationOffset) {
    QPoint pos(point);
    if (movePointsOn_) {
        QDesktopWidget* desktop = QApplication::desktop();
        int primaryScreenIndex = desktop->primaryScreen();
        QRect wholeScreen = desktop->screenGeometry(primaryScreenIndex);

        for (int i = 0; i < desktop->screenCount(); i++) {
            if (i != primaryScreenIndex) wholeScreen = wholeScreen.united(desktop->screenGeometry(i));
        }

        wholeScreen.setRect(wholeScreen.x() - 10, wholeScreen.y() - 10, wholeScreen.width() + 20,
            wholeScreen.height() + 20);
        QPoint bottomRight = QPoint(point.x() + size.width(), point.y() + size.height());
        QPoint appPos = getMainWindow()->pos();

#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
        if (decorationOffset) {
            QPoint offset = getWindowDecorationOffset();
            pos -= offset;
        }
#endif

        if (!wholeScreen.contains(pos) || !wholeScreen.contains(bottomRight)) {
            // If the widget is outside visible screen
            pos = appPos;
            pos += offsetWidget();
        }
    }
    return pos;
}
开发者ID:sarbi127,项目名称:inviwo,代码行数:32,代码来源:inviwoapplicationqt.cpp

示例6: mouseMoveEvent

void DianVoteControl::mouseMoveEvent(QMouseEvent *event)
{
    QDesktopWidget* desktopWidget = QApplication::desktop();
    //获取设备屏幕大小
    int screenWidth = desktopWidget->screenGeometry().width();
    int screenHeight = desktopWidget->screenGeometry().height();

    if (event->buttons() & Qt::LeftButton) {
        QPoint pos = event->globalPos() - dragPosition;
        if((pos.x() <= DEFAULT_DOCK_SPACE))
        {
            pos.setX(0);
        }
        else if((pos.x() + this->width() + DEFAULT_DOCK_SPACE) \
                 >= screenWidth)
        {
            pos.setX(screenWidth - this->width() - 2);
        }

        if((pos.y() <= DEFAULT_DOCK_SPACE))
        {
            pos.setY(0);
        }
        else if((pos.y() + this->height() + DEFAULT_DOCK_SPACE) \
                >= screenHeight)
        {
            pos.setY(screenHeight - this->height() - 2);
        }

        move(pos);
        event->accept();
    }
}
开发者ID:FrankieChan885,项目名称:dian-zigbee-vote,代码行数:33,代码来源:dianvotecontrol.cpp

示例7: QWidget

SpriteSceneConverter::SpriteSceneConverter(QWidget *parent)
    : QWidget(parent)
{
    ui.setupUi(this);

    QDesktopWidget desktop;
    int width = desktop.screenGeometry(0).width();
    int height = desktop.screenGeometry(0).height();

    QRect q = this->geometry();
    this->setGeometry(width/2-q.width()/2,height/2-q.height()/2,q.width(),q.height());

    mScene = new QGraphicsScene(this);
    ui.elementoPreview->setScene(mScene);
    mScene->addPixmap(mMap);

    mModelo = new QStandardItemModel();
    ui.elementosTabla->setModel(mModelo);

    ui.elementosTabla->horizontalHeader()->setResizeMode(0, QHeaderView::ResizeToContents);
    ui.elementosTabla->horizontalHeader()->setResizeMode(3, QHeaderView::ResizeToContents);

    PointDelegate* pointDelegate = new PointDelegate();
    TexturasDelegate* texturasDelegate = new TexturasDelegate();

    ui.elementosTabla->setItemDelegateForColumn(1,pointDelegate);
    ui.elementosTabla->setItemDelegateForColumn(2,pointDelegate);
    ui.elementosTabla->setItemDelegateForColumn(3,texturasDelegate);

    connect(
        ui.elementosTabla->selectionModel(),
        SIGNAL(selectionChanged(const QItemSelection &, const QItemSelection &)),
        SLOT(selectionChanged(const QItemSelection &, const QItemSelection &))
    );
}
开发者ID:toglia3d,项目名称:SpriteSceneConverter,代码行数:35,代码来源:SpriteSceneConverter.cpp

示例8: newGame

void scene::newGame() {
    gfxitems.clear();
    QDesktopWidget desktop;
    game = new pong(desktop.screenGeometry().width()-30, desktop.screenGeometry().height()-40);
    //game = new pong(desktop.width(), desktop.height());
    std::ifstream level(gametype.toStdString().c_str());
    qDebug()<<"reading file "<<gametype;
    std::string type;
    float x;
    float speed_mult;
    short pos;
    float wrong_ai;
    std::string bonus_name_string;
    while (level.good()) {
        level>>type;
        if (type=="new:bar") {
            level>>x;
            level>>speed_mult;
            level>>pos;
            new bar(game,
                    x,
                    (game->getHeight()-settings->value("bar/height").toFloat())/2,
                    settings->value("bar/width").toFloat(),
                    settings->value("bar/height").toFloat(),
                    speed_mult,
                    element::directions(pos),
                    settings->value("bar/touch_dx_comeback").toFloat(),
                    settings->value("bar/touch_straight").toFloat());
        } else if (type=="new:bar_ai") {
开发者ID:kopiro,项目名称:kopoong,代码行数:29,代码来源:scene.cpp

示例9: GetSupportedVideoGrabResolutions

GrabResolutions MediaSourceDesktop::GetSupportedVideoGrabResolutions()
{
    VideoFormatDescriptor tFormat;

    mSupportedVideoFormats.clear();

    tFormat.Name="CIF";        //      352 × 288
    tFormat.ResX = 352;
    tFormat.ResY = 288;
    mSupportedVideoFormats.push_back(tFormat);

    tFormat.Name="VGA";       //      640 * 480
    tFormat.ResX = 640;
    tFormat.ResY = 480;
    mSupportedVideoFormats.push_back(tFormat);

    tFormat.Name="DVD";        //      720 × 576
    tFormat.ResX = 720;
    tFormat.ResY = 576;
    mSupportedVideoFormats.push_back(tFormat);

    tFormat.Name="CIF9";       //     1056 × 864
    tFormat.ResX = 1056;
    tFormat.ResY = 864;
    mSupportedVideoFormats.push_back(tFormat);

    tFormat.Name="SXGA";       //     1280 × 1024
    tFormat.ResX = 1280;
    tFormat.ResY = 1024;
    mSupportedVideoFormats.push_back(tFormat);

    tFormat.Name="WXGA+";      //     1440 × 900
    tFormat.ResX = 1440;
    tFormat.ResY = 900;
    mSupportedVideoFormats.push_back(tFormat);

    tFormat.Name="SXGA+";       //     1440 × 1050
    tFormat.ResX = 1440;
    tFormat.ResY = 1050;
    mSupportedVideoFormats.push_back(tFormat);

    tFormat.Name="WUXGA";       //     1920 * 1200
    tFormat.ResX = 1920;
    tFormat.ResY = 1200;
    mSupportedVideoFormats.push_back(tFormat);

    QDesktopWidget *tDesktop = QApplication::desktop();
    tFormat.Name="Desktop";
    tFormat.ResX = tDesktop->screenGeometry(tDesktop->primaryScreen()).width();
    tFormat.ResY = tDesktop->screenGeometry(tDesktop->primaryScreen()).height();
    mSupportedVideoFormats.push_back(tFormat);

    tFormat.Name="Segment";
    tFormat.ResX = mSourceResX;
    tFormat.ResY = mSourceResY;
    mSupportedVideoFormats.push_back(tFormat);

    return mSupportedVideoFormats;
}
开发者ID:nolines,项目名称:Homer-Conferencing,代码行数:59,代码来源:MediaSourceDesktop.cpp

示例10: getMaxLength

int ConfigPanelWidget::getMaxLength()
{
    QDesktopWidget* dw = QApplication::desktop();

    if (mPosition == ILxQtPanel::PositionTop ||
        mPosition == ILxQtPanel::PositionBottom)
        return dw->screenGeometry(mScreenNum).width();
    else
        return dw->screenGeometry(mScreenNum).height();
}
开发者ID:dbluelle,项目名称:lxqt-panel,代码行数:10,代码来源:configpaneldialog.cpp

示例11: pixmap

RazorDeskManager::RazorDeskManager(const QString & configId, RazorSettings * config)
    : DesktopPlugin(configId, config)
{
    m_launchMode = DesktopPlugin::launchModeFromString(config->value("icon-launch-mode").toString());

    config->beginGroup(configId);
    bool makeIcons = config->value("icons", false).toBool();
    //now we got the desktop we need to determine if the user wants a defined picture there
    QString finalPixmap = config->value("wallpaper", "").toString();
    config->endGroup();

    if (finalPixmap.isEmpty() || !QFile::exists(finalPixmap))
    {
        //now we want to use the system default - we still need to find that one out though
        finalPixmap = razorTheme.desktopBackground();
        qDebug() << "trying to get system-defaults" << finalPixmap;
    }

    if (! finalPixmap.isEmpty())
    {
        qDebug() << "Creating wallpaper";
        int width,height;
        QDesktopWidget * dw = QApplication::desktop();
        if (dw->screenCount() == 1)
        {
            width=dw->width();
            height = dw->height();
        }
        else
        {
            width=dw->screenGeometry(-1).width();
            height=dw->screenGeometry(-1).height();
        }

        QPixmap pixmap(finalPixmap);
        pixmap = pixmap.scaled(width,height);
        Pixmap p = pixmap.handle();
        XGrabServer(QX11Info::display());
        XChangeProperty(QX11Info::display(), QX11Info::appRootWindow(), XfitMan::atom("_XROOTPMAP_ID"), XA_PIXMAP, 32, PropModeReplace, (unsigned char *) &p, 1);
        XChangeProperty(QX11Info::display(), QX11Info::appRootWindow(), XfitMan::atom("ESETROOT_PMAP_ID"), XA_PIXMAP, 32, PropModeReplace, (unsigned char *) &p, 1);
        XSetCloseDownMode(QX11Info::display(), RetainPermanent);
        XSetWindowBackgroundPixmap(QX11Info::display(), QX11Info::appRootWindow(), p);
        XClearWindow(QX11Info::display(), QX11Info::appRootWindow());
        XUngrabServer(QX11Info::display());
        XFlush(QX11Info::display());
    }
    
    if (makeIcons)
    {
        deskicons = new RazorSettings("deskicons", this);    
        m_fsw = new QFileSystemWatcher(QStringList() << QDesktopServices::storageLocation(QDesktopServices::DesktopLocation), this);
        connect(m_fsw, SIGNAL(directoryChanged(const QString&)), this, SLOT(updateIconList()));
        updateIconList();
    }
}
开发者ID:B-Rich,项目名称:razor-qt,代码行数:55,代码来源:razordeskman.cpp

示例12: main

int main(int argc, char *argv[])
{
    QApplication::setAttribute(Qt::AA_UseOpenGLES,true);
    QApplication a(argc, argv);

    // MODEL
    SubteState * m_subte = new SubteState();
    // CONTROLLER DISPATCHER
    EventHandler *m_eventHandler = new EventHandler();

    // VIEWS
    BoardCenter * m_c = new BoardCenter(0);
    BoardAtp *m_a = new BoardAtp(0);
    BoardMac *m_m = new BoardMac(0,m_subte,m_eventHandler);
    BoardBottom *m_b = new BoardBottom(0);
    BoardHardware *m_h = new BoardHardware(0,m_subte,m_eventHandler);

    QTabWidget *m_tabs = new QTabWidget(0);
    m_tabs->addTab(m_h,QObject::tr("HARDWARE"));
    m_tabs->addTab(m_b,QObject::tr("BOTTOM"));
    m_tabs->setMinimumWidth(1024);
    m_tabs->setMinimumHeight(768);

    QDesktopWidget *desktop = a.desktop();
    if(desktop->screenCount() == 4){
        QRect s0 = desktop->screenGeometry(0);
        QRect s1 = desktop->screenGeometry(1);
        QRect s2 = desktop->screenGeometry(2);
        QRect s3 = desktop->screenGeometry(3);

        m_c->showFullScreen();
        m_a->showFullScreen();
        m_m->showFullScreen();
        m_tabs->showFullScreen();

        m_c->move(s0.topLeft());
        m_a->move(s2.topLeft());
        m_m->move(s3.topLeft());
        m_tabs->move(s1.topLeft());

    }else{
        m_c->showNormal();
        m_a->showNormal();
        m_m->showNormal();
        m_tabs->showNormal();
    }

    m_eventHandler->setModel(m_subte);
    m_subte->setHandler(m_eventHandler);
    m_eventHandler->initConnection(qApp->applicationDirPath());

    QObject::connect(m_eventHandler,SIGNAL(closeApp()),qApp,SLOT(quit()));
    return a.exec();
}
开发者ID:xiaomailong,项目名称:proyecto_subtes,代码行数:54,代码来源:main.cpp

示例13: screenGeometry

EXPORT QRect screenGeometry(unsigned nScreen)
{
    QDesktopWidget *desktop = QApplication::desktop();
    if(nScreen == ~0U) {
        QRect rc;
        for (int i = 0; i < desktop->numScreens(); i++){
            rc |= desktop->screenGeometry(i);
        }
        return rc;
    }
    return desktop->screenGeometry(nScreen);
}
开发者ID:BackupTheBerlios,项目名称:sim-im,代码行数:12,代码来源:misc.cpp

示例14: penDialog

void TupCanvas::penDialog()
{
    QDesktopWidget desktop;
    TupPenDialog *dialog = new TupPenDialog(k->brushManager, this);
    connect(dialog, SIGNAL(updatePen(int)), this, SLOT(updateThickness(int)));

    QApplication::restoreOverrideCursor();

    dialog->show();
    dialog->move((int) (desktop.screenGeometry().width() - dialog->width())/2 ,
                        (int) (desktop.screenGeometry().height() - dialog->height())/2);
}
开发者ID:hpsaturn,项目名称:tupi,代码行数:12,代码来源:tupcanvas.pc.cpp

示例15: exposureDialog

void TupCanvas::exposureDialog()
{
    QDesktopWidget desktop;
    TupExposureDialog *dialog = new TupExposureDialog(k->project, k->scene->currentSceneIndex(), 
                                                      k->scene->currentLayerIndex(), k->scene->currentFrameIndex(), this);
    // connect(dialog, SIGNAL(updatePen(int)), this, SLOT(updateThickness(int)));

    QApplication::restoreOverrideCursor();

    dialog->show();
    dialog->move((int) (desktop.screenGeometry().width() - dialog->width())/2 ,
                        (int) (desktop.screenGeometry().height() - dialog->height())/2);
}
开发者ID:nanox,项目名称:tupi,代码行数:13,代码来源:tupcanvas.tablet.cpp


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