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


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

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


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

示例1: resizeWindow

void MusicVideoPlayWidget::resizeWindow(bool resize)
{
    if(resize)
    {
        showFullScreen();
    }
    else
    {
        showNormal();
        setGeometry(250, 150, WINDOW_WIDTH, WINDOW_HEIGHT);
    }
    QSize s = size();
#ifdef Q_OS_UNIX
    QDesktopWidget* desktopWidget = QApplication::desktop();
    if(isFullScreen() && desktopWidget && desktopWidget->screen())
    {
        s = desktopWidget->screen()->size();
    }
    else
    {
        s = QSize(WINDOW_WIDTH, WINDOW_HEIGHT);
        showNormal();
    }
#endif
    resizeWindow(s.width() - WINDOW_WIDTH, s.height() - WINDOW_HEIGHT);
}
开发者ID:jinting6949,项目名称:TTKMusicplayer,代码行数:26,代码来源:musicvideoplaywidget.cpp

示例2: resizeWindow

void MusicVideoPlayWidget::resizeWindow(bool resize)
{
    if(resize)
    {
        showFullScreen();
    }
    else
    {
        showNormal();
        setGeometry(250, 150, 541, 460);
    }
    QSize s =  size();
#ifdef Q_OS_UNIX
    QDesktopWidget* desktopWidget = QApplication::desktop();
    if(desktopWidget && desktopWidget->screen())
    {
        s = desktopWidget->screen()->size();
    }
    else
    {
        s = QSize(541, 460);
        showNormal();
    }
#endif
    m_videoView->resizeWindow(resize, s);
    m_videoTable->resizeWindow(s.width() / 541.0);
}
开发者ID:DchunWang,项目名称:TTKMusicplayer,代码行数:27,代码来源:musicvideoplaywidget.cpp

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

示例4: background

SynthesisWindow::SynthesisWindow(QString travelTitle, QMainWindow * parentWindow, QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::SynthesisWindow)
{
    QDesktopWidget screen;
    int screen_width = screen.screen()->width();
    int screen_height = screen.screen()->height();

    ui->setupUi(this);
    this->parentWindow = parentWindow;
    this->title = travelTitle;
    this->isArchived = false;
    this->setupTabs();
    this->currentTab = GENERAL;
    this->total = 0;
    this->setMinimumSize(QSize(540, 758));
    this->setMaximumSize(QSize(540, 758));
    this->move(screen_width/2 - this->width()/2, screen_height/2 - this->height()/2);

    QPixmap background(":/synthesisImages/travel.jpg");
    background = background.scaled(this->size(), Qt::IgnoreAspectRatio);
    QPalette palette;
    palette.setBrush(QPalette::Background, background);
    this->setPalette(palette);
    //this->ui->travelTitle->setStyleSheet("background-color: rgba(0,0,0,0%)");

    QFont totalFont ("Arial", 15, QFont::Bold);
    this->ui->totalLabel->setFont(totalFont);
    this->ui->totalLabel->setText(" Total = ");
    this->ui->totalLabel->setFixedWidth(125);
    this->ui->totalLabel->setFixedHeight(50);
    this->ui->totalLabel->setAlignment(Qt::AlignLeft | Qt::AlignVCenter);
    this->ui->totalLabel->setStyleSheet("QLabel { background-color : #3257a3; border-radius : 6px;  }");
    this->ui->totalValueLabel->setFont(totalFont);
    this->ui->totalValueLabel->setFixedHeight(50);
    this->ui->totalValueLabel->setStyleSheet("QLabel { background-color : #3257a3; border-radius : 6px;  }");//{ background-color : transparent; }");
    this->ui->totalValueLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter);

    QObject::connect(this->ui->generalButton, SIGNAL(clicked()), this, SLOT(onGeneralButtonClick()));
    QObject::connect(this->ui->transportButton, SIGNAL(clicked()), this, SLOT(onTransportButtonClick()));
    QObject::connect(this->ui->housingButton, SIGNAL(clicked()), this, SLOT(onHousingButtonClick()));
    QObject::connect(this->ui->restaurantButton, SIGNAL(clicked()), this, SLOT(onRestaurantButtonClick()));
    QObject::connect(this->ui->othersButton, SIGNAL(clicked()), this, SLOT(onOthersButtonClick()));
    QObject::connect(this, SIGNAL(changeTab()), this, SLOT(updateSelectedTab()));

    QFont titleFont("Arial", 22, QFont::Black);
    this->ui->travelTitle->setFont(titleFont);
    this->ui->travelTitle->setText(this->title);
    this->setMinimumSize(parentWindow->minimumWidth(), parentWindow->minimumHeight());
    this->ui->activityList->show();

    //this->ui->generalButton->setIcon(*(this->generateIcon(GENERAL)));

    this->updateSelectedTab();
    this->updateActivityList();


}
开发者ID:araphawake,项目名称:TravelPlanner,代码行数:58,代码来源:synthesiswindow.cpp

示例5: centerWindow

// set window position at center of screen
void CMainWindow::centerWindow() {
    int width  = this->frameGeometry().width(),
        height = this->frameGeometry().height();

    QDesktopWidget wid;
    int screenWidth = wid.screen()->width(),
        screenHeight = wid.screen()->height();

    this->setGeometry((screenWidth/2) - (width/2), (screenHeight/2) - (height/2), width, height);
}
开发者ID:Nitrooos,项目名称:Projectizer,代码行数:11,代码来源:CMainWindow.cpp

示例6: centra_finestra

void Widget_Padre::centra_finestra(){
       int width = frameGeometry().width();
       int height = frameGeometry().height();

       QDesktopWidget wid;

       int screenWidth = wid.screen()->width();
       int screenHeight = wid.screen()->height();

       int x=static_cast<int>((screenWidth-width)/2);
       int y=static_cast<int>((screenHeight-height)/2);

       move(x,y);
}
开发者ID:ThomasFuser,项目名称:BibliotecaP2,代码行数:14,代码来源:widget_padre.cpp

示例7: main

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    MainWindow w;
    // ================= Setting Windows Size =================
    QDesktopWidget wid;
    int screenW = 1000;
    int screenH = 563;
    w.setGeometry(wid.screen()->width()/2 - (screenW/2) , wid.screen()->height()/2 - (screenH/2) , screenW , screenH);
    // ================= Setting Windows Title and Icon =================
    w.setWindowTitle("Taiko Drum Master");
    w.setWindowIcon(QIcon(":/image/img/icon.jpg"));
    w.setFixedSize(screenW , screenH);
    w.show();
    return a.exec();
}
开发者ID:ZaynF,项目名称:pd2-Taiko,代码行数:16,代码来源:main.cpp

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

示例9: PrintScreen

void Interface::PrintScreen()
{
QDesktopWidget *desk = qApp->desktop();
QPixmap desktopscreen = QPixmap::grabWindow(desk->screen()->winId());
desktopscreen.save( origImageFilename, extension.data() , qualvalue->value() ); 
BaseReset();
showMaximized();
}
开发者ID:martamius,项目名称:mushi,代码行数:8,代码来源:interface.cpp

示例10: QMainWindow

MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    connect(ui->actionOpen,SIGNAL(triggered()),this,SLOT(open()));
    connect(ui->actionSave_As,SIGNAL(triggered()),this,SLOT(save_as()));
    connect(ui->actionGrayscale, SIGNAL(triggered()), this, SLOT(gray_scale()));
    connect(ui->actionHistogram, SIGNAL(triggered()), this, SLOT(show_histogram()));
    connect(ui->actionBinarization, SIGNAL(triggered()), this, SLOT(show_binarization()));
    connect(ui->actionRecognition, SIGNAL(triggered()), this, SLOT(show_recognition()));

    connect(&mdiArea, SIGNAL(subWindowActivated(QMdiSubWindow*)), this, SLOT(subwindow_changed(QMdiSubWindow*)));

    //Window
    QDesktopWidget desktop;

    int width = geometry().width();
    int height = geometry().height();

    int screenWidth = desktop.screen()->width();
    int screenHeight = desktop.screen()->height();

    setGeometry((screenWidth/2)-(width/2),(screenHeight/2)-(height/2),width,height);
    setCentralWidget(&mdiArea);

    // Histogram dialog
    histogramDlg = new dlgHistogram(&mdiArea);
    mdiArea.addSubWindow(histogramDlg);

    histogramDlg->parentWidget()->hide();

    // Binarization dialog
    binarizationDlg = new dlgBinarization(&mdiArea);
    mdiArea.addSubWindow(binarizationDlg);

    binarizationDlg->parentWidget()->hide();

    // Recognition dialog
    recognitionDlg = new dlgRecognition(&mdiArea);
    mdiArea.addSubWindow(recognitionDlg);

    recognitionDlg->parentWidget()->hide();
}
开发者ID:hylhero,项目名称:Image-Analysis,代码行数:45,代码来源:mainwindow.cpp

示例11: main

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    Taiko w;

    QDesktopWidget setsize;
    int sizex = 1000;
    int sizey = 500;
    w.setGeometry(setsize.screen()->width()/2-(sizex/2),setsize.screen()->height()/2-(sizey/2),sizex,sizey);
    w.show();


    /*QPushButton *start= new QPushButton("START!") ;
    start->resize(100,50);
    start->show();*/

    return a.exec();
}
开发者ID:C14036227,项目名称:pd2-Taiko,代码行数:18,代码来源:main.cpp

示例12: main

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    MainWindow w;


    QDesktopWidget widget;
    int screenW=710;//寬
    int screenH=410;//高
    w.setGeometry(widget.screen()->width()/2-(screenW/2),widget.screen()->height()/2-(screenH/2),screenW,screenH);//x,y,W,H
    w.setWindowTitle("angrybug");
    w.setFixedSize(screenW,screenH);//限制視窗大小不可任意更改
    w.show();



    return a.exec();
}
开发者ID:yantinger,项目名称:pd2-Angrybird,代码行数:18,代码来源:main.cpp

示例13: main

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    MainWindow w;
    /***set window size***/
    QDesktopWidget window;
    int screenW = 800;
    int screenH = 600;
    w.setGeometry(window.screen()->width()/2 - (screenW/2),window.screen()->height()/2 - (screenH/2),screenW,screenH);

    /***set window title and icon***/
    w.setWindowTitle("Taiko Master");
    w.setWindowIcon(QIcon(":/image/pics/icon.png"));
    w.setFixedSize(screenW,screenH);
    w.show();

    return a.exec();
}
开发者ID:Randy1005,项目名称:pd2-Taiko,代码行数:18,代码来源:main.cpp

示例14: setupImagePosition

void Window::setupImagePosition()
{
    QPoint cursorPos = QCursor::pos();

    QDesktopWidget * desktop = QApplication::desktop();
    int screenNum = desktop->screenNumber(cursorPos);
    QWidget * screen = desktop->screen(screenNum);

    m_image->move(screen->geometry().center() - m_image->rect().center());
}
开发者ID:Kirek,项目名称:deepin-session-ui-manjaro,代码行数:10,代码来源:window.cpp

示例15: main

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    MainWindow w;
    Scene S;

    S.setBackgroundBrush(Qt::black);

    QDesktopWidget wid;
    //Set window size
    int screenW = 835;
    int screenH = 523;
    w.setGeometry(wid.screen()->width()/2 - (screenW/2) , wid.screen()->height()/2 - (screenH/2) , screenW , screenH );
//  start in the middle of the window

    w.setWindowTitle("TaikoTest");
    w.setFixedSize(screenW , screenH);
    w.show();
    return a.exec();

}
开发者ID:Redyee,项目名称:pd2-Taiko,代码行数:21,代码来源:main.cpp


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