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


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

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


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

示例1: getFullscreenGeometry

// Return geometry of user's screen selection
bool screenSelectDialog::getFullscreenGeometry( QWidget* target, QRect& geom )
{
    // Determine number of screens
    QDesktopWidget* desktop = QApplication::desktop();
    int numScreens = desktop->screenCount();

    // If more than one screen, ask the user where to go fullscreen
    if( numScreens > 1 )
    {
        // construct the dialog
        screenSelectDialog* screenSelect = new screenSelectDialog( numScreens, target );

        // Get user's choice of screen
        if( screenSelect->exec() == QDialog::Rejected )
        {
            return false;
        }

        // Determine the geometry of the user's choice
        int screenId = screenSelect->getScreenNum();
        switch( screenId )
        {
            case screenSelectDialog::PRIMARY_SCREEN:
                geom = desktop->screenGeometry( desktop->primaryScreen() );
                break;

            case screenSelectDialog::THIS_SCREEN:
                geom = desktop->screenGeometry( target );
                break;

            case screenSelectDialog::ALL_SCREENS:
                geom = desktop->geometry();
                break;

            default:
                geom = desktop->screenGeometry( screenId );
                break;
        }
    }

    // If only one screen, just get it's geometry
    else
    {
        geom = desktop->screenGeometry( desktop->primaryScreen() );
    }

    // All done
    return true;
}
开发者ID:mvancompernolle,项目名称:ai_project,代码行数:50,代码来源:screenSelectDialog.cpp

示例2: KDialog

SCConfigurePresenterViewDialog::SCConfigurePresenterViewDialog(SCDocument *document, QWidget *parent)
    : KDialog(parent)
    , m_document(document)
{
    QWidget *widget = new QWidget(this);

    ui.setupUi(widget);

    QDesktopWidget desktop;
    int numScreens = desktop.numScreens();
    int primaryScreen = desktop.primaryScreen();
    for (int i = 0; i < numScreens; i++) {
        if (i == primaryScreen) {
            ui.monitorComboBox->addItem(i18n("Monitor %1 (primary)", i + 1));
        }
        else {
            ui.monitorComboBox->addItem(i18n("Monitor %1", i + 1));
        }
    }

    if (numScreens <= 1)
        ui.presenterViewCheckBox->setEnabled(false);

    setMainWidget(widget);

    setCaption(i18n("Configure Presenter View"));

    ui.monitorComboBox->setCurrentIndex(document->presentationMonitor());
    ui.presenterViewCheckBox->setChecked(
            document->isPresenterViewEnabled() ? Qt::Checked : Qt::Unchecked);
}
开发者ID:KDE,项目名称:koffice,代码行数:31,代码来源:SCConfigurePresenterViewDialog.cpp

示例3: setImage

bool Worker::setImage(QString &path)
{
    QImage source(path), dest;
    if (source.isNull())
        return false;

    QDesktopWidget *desktop = QApplication::desktop();
    QRect geo = desktop->screenGeometry(desktop->primaryScreen());
    int lw = geo.width();
    int lh = geo.height();
    float iw = source.width();
    float ih = source.height();

    if ((iw <= lw) && (ih <= lh))
        dest = source;
    else
        if ((iw / lw) > (ih / lh))
            dest = source.scaledToWidth(lw, Qt::SmoothTransformation);
        else
            dest = source.scaledToHeight(lh, Qt::SmoothTransformation);

    setPixmap(QPixmap::fromImage(dest));

    return true;
}
开发者ID:gpocentek,项目名称:qslsaver,代码行数:25,代码来源:worker.cpp

示例4: createWidgets

void QModernProgressDialog::createWidgets() {
    setWindowTitle(tr("Progress"));
    setWindowIcon(QIcon());
    m_wasCancel=false;
    label=new QLabel(this);
    longmessage=new QTextEdit(this);
    longmessage->setVisible(false);
    progress=new QModernProgressWidget(this);
    progress->setMinimumSize(QSize(48,48));
    cancel=new QPushButton(tr("Cancel"), this);
    connect(cancel, SIGNAL(clicked()), this, SLOT(cancelClicked()));

    QVBoxLayout* vbl=new QVBoxLayout;
    setLayout(vbl);
    QHBoxLayout* hbl=new QHBoxLayout;
    hbl->addWidget(progress);
    hbl->addWidget(label);
    hbl->addStretch();
    vbl->addLayout(hbl);
    vbl->addWidget(longmessage);
    hbl=new QHBoxLayout;
    hbl->addStretch();
    hbl->addWidget(cancel);
    vbl->addLayout(hbl);
    connect(&timerDelay, SIGNAL(timeout()), this, SLOT(open()));

    QDesktopWidget desktopWidget;
    QRect desktopRect(desktopWidget.availableGeometry(desktopWidget.primaryScreen()));
    QRect widgetRect=rect();
    move(desktopRect.center() - widgetRect.center());
}
开发者ID:jkriege2,项目名称:LitSoz3,代码行数:31,代码来源:qmodernprogresswidget.cpp

示例5: GetPrimaryScreenNumber

int QtWidgetsTweakletImpl::GetPrimaryScreenNumber()
{
  QDesktopWidget *desktop = QApplication::desktop();
  // get the primary screen
  int primaryScreenNr = desktop->primaryScreen();
  return primaryScreenNr;
}
开发者ID:davidvarisano,项目名称:MITK,代码行数:7,代码来源:berryQtWidgetsTweakletImpl.cpp

示例6: QDialog

DBoxFE_ProfileWizard::DBoxFE_ProfileWizard( QDialog *parent, Qt::WFlags flags )
    : QDialog( parent, flags ) {

  // setup grafical user interface (gui)
  setupUi( this );

  page = 0;

  // for download game database file
  m_http = new QHttp( this );
  connect( m_http, SIGNAL( requestFinished( int, bool ) ), this, SLOT( httpRequestFinished( int, bool ) ) );
  connect( m_http, SIGNAL( responseHeaderReceived( const QHttpResponseHeader & ) ), this, SLOT( readResponseHeader( const QHttpResponseHeader & ) ) );

  // connection
  connect( btnBack, SIGNAL( clicked() ), this, SLOT( slotBack() ) );
  connect( btnNext, SIGNAL( clicked() ), this, SLOT( slotNext() ) );
  connect( btnNext, SIGNAL( clicked() ), this, SLOT( slotFinish() ) );

  connect( btnHelp, SIGNAL( clicked() ), this, SLOT( slotHelp() ) );
  connect( btnAbort, SIGNAL( clicked() ), this, SLOT( slotAbort() ) );
  connect( btnSelectDir, SIGNAL( clicked() ), this, SLOT( slotSelectDir() ) );
  connect( btnSearch, SIGNAL( clicked() ), this, SLOT( slotSearch() ) );

  // enable button
  btnNext->setEnabled( true );

  // center the wiget on desktop screen
  QDesktopWidget *desktop = qApp->desktop();
  const QRect rect = desktop->availableGeometry( desktop->primaryScreen() );
  int left = ( rect.width() - width() ) / 2;
  int top = ( rect.height() - height() ) / 2;
  setGeometry( left, top, width(), height() );

  downloadFile();
}
开发者ID:BackupTheBerlios,项目名称:dboxfe-svn,代码行数:35,代码来源:dboxfe_profilewizard.cpp

示例7: 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

示例8: xmlPreferences

GameDosBoxDialog::GameDosBoxDialog( QDialog *parent, Qt::WFlags flags ) : QDialog( parent, flags )
{
	setupUi( this );

	gd_sql = new GameDatabaseSql( this );

	XMLPreferences xmlPreferences( "DBoxFE - GDB", "Alexander Saal" );
	xmlPreferences.load( QDir::homePath() + "/.dboxfe-gdb/dboxfegdb.xml" );

	database = xmlPreferences.getString( "Database", "DatabaseFile" );	

	gd_sql->createConnection( database );

	connect( btnAccept, SIGNAL ( clicked() ), this, SLOT ( select() ) );
	connect( btnCancel, SIGNAL ( clicked() ), this, SLOT ( cancel() ) );

	connect( lineEditSearch, SIGNAL( textChanged( const QString & ) ), this, SLOT( lineEditSearchTextChanged( const QString & ) ) );
	connect( comboBoxDosboxVersion, SIGNAL ( currentIndexChanged( const QString & ) ), this, SLOT ( comboBoxDosboxVersionCurrentIndexChanged( const QString & ) ) );
	connect( treeWidgetDosboxGames, SIGNAL ( itemClicked( QTreeWidgetItem *, int ) ), this, SLOT ( treeWidgetDosboxGamesItemClicked( QTreeWidgetItem *, int ) ) );

	QDesktopWidget *desktop = qApp->desktop();
	const QRect rect = desktop->availableGeometry ( desktop->primaryScreen() );
	int left = ( rect.width() - width() ) / 2;
	int top = ( rect.height() - height() ) / 2;
	setGeometry ( left, top, width(), height() );

	getDosboxVersion();
}
开发者ID:BackupTheBerlios,项目名称:dboxfe-svn,代码行数:28,代码来源:dboxfegdb_dosbox.cpp

示例9: consumeEntities

void BubbleManager::consumeEntities()
{
    if (!m_currentNotify.isNull()) {
        m_currentNotify->deleteLater();
        m_currentNotify = nullptr;
    }

    if (m_entities.isEmpty()) {
        m_currentNotify = nullptr;
        return;
    }

    m_currentNotify = m_entities.dequeue();

    QDesktopWidget *desktop = QApplication::desktop();
    int pointerScreen = desktop->screenNumber(QCursor::pos());
    int primaryScreen = desktop->primaryScreen();
    QWidget *pScreenWidget = desktop->screen(primaryScreen);

    if (checkDockExistence()) {
        m_dockGeometry = m_dbusdockinterface->geometry();
    }

    if (checkControlCenterExistence())
        m_ccGeometry = m_dbusControlCenter->rect();

    if (checkControlCenterExistence() && pointerScreen == primaryScreen)
        bindControlCenterX();

    if (pointerScreen != primaryScreen)
        pScreenWidget = desktop->screen(pointerScreen);

    m_bubble->setBasePosition(getX(), getY(), pScreenWidget->geometry());
    m_bubble->setEntity(m_currentNotify);
}
开发者ID:linuxdeepin,项目名称:deepin-notifications,代码行数:35,代码来源:bubblemanager.cpp

示例10: ViewStack

MainWindow::MainWindow(const std::string& title) : _viewStack(0),
	_updatePending(false)
{
	setContentsMargins(4,4,4,4) ;

	_viewStack = new ViewStack(this);

	//limit the MainWindow size to approximatly the size of the desktop
	QDesktopWidget* desktop = QApplication::desktop() ;
	QRect rect = desktop->availableGeometry(desktop->primaryScreen()) ;
	_viewStack->setMaximumSize(rect.size()- QSize(40,60)) ;

	this->setCentralWidget(_viewStack);
	this->setWindowTitle("ArgosDisplay : " + QString::fromStdString(title));
	QLabel* dimBar = new QLabel(this) ;
	dimBar->setText("0 x 0 x 0 x 0 x 0 | 100%") ;
	this->statusBar()->addPermanentWidget(dimBar, 0 ) ;
	QObject::connect(
			_viewStack, SIGNAL(exportStatusMessage(QString)),
			this->statusBar(),SLOT(showMessage(QString)));
	QObject::connect(
			_viewStack, SIGNAL(exportDimensionsMessage(QString)),
			dimBar, SLOT(setText(QString))) ;
	QObject::connect(this, SIGNAL(dockWidgetAdded()), this, SLOT(_addDockWidgets()), Qt::QueuedConnection) ;
	QObject::connect(this, SIGNAL(overlayWidgetAdded()), this, SLOT(_addOverlayWidgets()), Qt::QueuedConnection) ;

	_createMenus() ;
}
开发者ID:flowexpert,项目名称:charon,代码行数:28,代码来源:MainWindow.cpp

示例11: 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

示例12: QWidget

/*
 * Constructor
 */
Config::Config(QSettings *settings,GetConfig* getConfig,QWidget *parent)
    : QWidget(parent,Qt::WindowCloseButtonHint)
{
    QDesktopWidget *dw = QApplication::desktop();
    QSize s = dw->screen(dw->primaryScreen())->size();
    setupUi(this);

    this->getConfig = getConfig;
    this->settings = settings;

    move(s.width() / 2 - 235, s.height()/ 2 - 241) ;
    show();

    connect(adminPasswordLE,SIGNAL(returnPressed()),this,SLOT(adminAuthentication()));
    connect(okButton,SIGNAL(clicked()),this,SLOT(saveSettings()));
    //print page
    connect(bonafideRB1,SIGNAL(clicked()),this,SLOT(decideCert1()));
    connect(conductRB1,SIGNAL(clicked()),this,SLOT(decideCert1()));
    connect(tcRB1,SIGNAL(clicked()),this,SLOT(decideCert1()));

    connect(fieldCombo,SIGNAL(currentIndexChanged(int)),this,SLOT(setXY(int)));
    connect(xSB,SIGNAL(editingFinished()),this,SLOT(setPrintPositionsFlag()));
    connect(ySB,SIGNAL(editingFinished()),this,SLOT(setPrintPositionsFlag()));

    //database page
    connect(databasenameLE,SIGNAL(editingFinished()),this,SLOT(databaseSettingsChanged()));
    connect(hostnameLE,SIGNAL(editingFinished()),this,SLOT(databaseSettingsChanged()));
    connect(portLE,SIGNAL(editingFinished()),this,SLOT(databaseSettingsChanged()));
    connect(usernameLE,SIGNAL(editingFinished()),this,SLOT(databaseSettingsChanged()));
    connect(passwordLE,SIGNAL(editingFinished()),this,SLOT(databaseSettingsChanged()));

    connect(connectButton,SIGNAL(clicked()),this,SLOT(checkConnectivity()));

    //Certificate page
    connect(bonafideRB2,SIGNAL(clicked()),this,SLOT(decideCert2()));
    connect(conductRB2,SIGNAL(clicked()),this,SLOT(decideCert2()));
    connect(tcRB2,SIGNAL(clicked()),this,SLOT(decideCert2()));

    connect(fromSB,SIGNAL(editingFinished()),this,SLOT(setAcademicYearFlag()));
    connect(toSB,SIGNAL(editingFinished()),this,SLOT(setAcademicYearFlag()));

    //General Settings
    connect(printersCombo,SIGNAL(currentIndexChanged( const QString &)),this,SLOT(setPrinterFlag( const QString&)));

    connect(databaseRB,SIGNAL(clicked()),this,SLOT(setModeFlag()));
    connect(manualRB,SIGNAL(clicked()),this,SLOT(setModeFlag()));

    connect(stackedWidget,SIGNAL(currentChanged(int)),this,SLOT(selectFunction(int)));//,Qt::UniqueConnection);

    //ensuring that all flags are reset
    for(int i = 0; i < 7; ++i )
        f[i] = false;

    for(int i = 0; i < 6; ++i)
        flag[i] = false;

    preparePrintSettings();
    adminPasswordLE->setFocus();
}
开发者ID:mskonline,项目名称:docmaqv2,代码行数:62,代码来源:config.cpp

示例13:

PresenterConfiguration::PresenterConfiguration(IEventBus * bus) {
	QDesktopWidget * desktopWidget = QApplication::desktop();
	this->mainScreen = desktopWidget->primaryScreen();
	this->auxScreen = desktopWidget->primaryScreen();

	for (int i = 0 ; i < desktopWidget->numScreens() ; i++) {
		if (i != this->mainScreen) {
			this->auxScreen = i;
			break;
		}
	}

	this->parser = NULL;
	this->document = NULL;
	this->renderer = NULL;
	this->bus = bus;
}
开发者ID:AliYousuf,项目名称:open-pdf-presenter,代码行数:17,代码来源:presenter.cpp

示例14: initializePosition

void SliderWindow::initializePosition() {
	
	QDesktopWidget desktopWidget;
	QRect availableGeometry = desktopWidget.availableGeometry(desktopWidget.primaryScreen());
	
	m_d->left = availableGeometry.width() - sliderRightOffset - sliderWidth;
	m_d->bottom = availableGeometry.height() - m_d->index * sliderHeight;
}
开发者ID:boudewijnrempt,项目名称:HyvesDesktop,代码行数:8,代码来源:SliderWindow.cpp

示例15:

DashboardWindow::DashboardWindow() {
    ui.setupUi(this);
	
	//set size to 70% of total screen size
    QDesktopWidget dw;
    QRect mainScreen = dw.availableGeometry(dw.primaryScreen());
    this->resize(mainScreen.width()*0.7, mainScreen.height()*0.7);
}
开发者ID:jhjonathanlee,项目名称:DataVis-Orange,代码行数:8,代码来源:DashboardWindow.cpp


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