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


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

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


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

示例1: reloadSmileys

/**
 * @brief Reload smileys and size information.
 */
void UserInterfaceForm::reloadSmileys()
{
    QList<QStringList> emoticons = SmileyPack::getInstance().getEmoticons();

    // sometimes there are no emoticons available, don't crash in this case
    if (emoticons.isEmpty()) {
        qDebug() << "reloadSmilies: No emoticons found";
        return;
    }

    QStringList smileys;
    for (int i = 0; i < emoticons.size(); ++i)
        smileys.push_front(emoticons.at(i).first());

    const QSize size(18, 18);
    for (int i = 0; i < smileLabels.size(); ++i) {
        QIcon icon = SmileyPack::getInstance().getAsIcon(smileys[i]);
        smileLabels[i]->setPixmap(icon.pixmap(size));
        smileLabels[i]->setToolTip(smileys[i]);
    }

    // set maximum size of emoji
    QDesktopWidget desktop;
    // 8 is the count of row and column in emoji's in widget
    const int sideSize = 8;
    int maxSide = qMin(desktop.geometry().height() / sideSize, desktop.geometry().width() / sideSize);
    QSize maxSize(maxSide, maxSide);

    QIcon icon = SmileyPack::getInstance().getAsIcon(smileys[0]);
    QSize actualSize = icon.actualSize(maxSize);
    bodyUI->emoticonSize->setMaximum(actualSize.width());
}
开发者ID:Grokafar,项目名称:qTox,代码行数:35,代码来源:userinterfaceform.cpp

示例2: reloadSmiles

void GeneralForm::reloadSmiles()
{
    QList<QStringList> emoticons = SmileyPack::getInstance().getEmoticons();
    if (emoticons.isEmpty())
    { // sometimes there are no emoticons available, don't crash in this case
        qDebug() << "reloadSmilies: No emoticons found";
        return;
    }

    QStringList smiles;
    for (int i = 0; i < emoticons.size(); i++)
        smiles.push_front(emoticons.at(i).first());

    const QSize size(18,18);
    bodyUI->smile1->setPixmap(SmileyPack::getInstance().getAsIcon(smiles[0]).pixmap(size));
    bodyUI->smile2->setPixmap(SmileyPack::getInstance().getAsIcon(smiles[1]).pixmap(size));
    bodyUI->smile3->setPixmap(SmileyPack::getInstance().getAsIcon(smiles[2]).pixmap(size));
    bodyUI->smile4->setPixmap(SmileyPack::getInstance().getAsIcon(smiles[3]).pixmap(size));
    bodyUI->smile5->setPixmap(SmileyPack::getInstance().getAsIcon(smiles[4]).pixmap(size));

    bodyUI->smile1->setToolTip(smiles[0]);
    bodyUI->smile2->setToolTip(smiles[1]);
    bodyUI->smile3->setToolTip(smiles[2]);
    bodyUI->smile4->setToolTip(smiles[3]);
    bodyUI->smile5->setToolTip(smiles[4]);

    //set maximum size of emoji
    QDesktopWidget desktop;
    int maxSize = qMin(desktop.geometry().height()/8,
                       desktop.geometry().width()/8); // 8 is the count of row and column in emoji's in widget
    bodyUI->emoticonSize->setMaximum(SmileyPack::getInstance().getAsIcon(smiles[0]).actualSize(QSize(maxSize,maxSize)).width());
}
开发者ID:RowenStipe,项目名称:qTox,代码行数:32,代码来源:generalform.cpp

示例3: QMainWindow

MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    setWindowIcon(QIcon(":icons/icon.png"));
    setWindowTitle("quickly translate");
    QSystemTrayIcon * trayIcon = new QSystemTrayIcon(this);
    mNetManager = new QNetworkAccessManager(this);
    mLangageModel = new LanguageModel;

    trayIcon->setIcon(QIcon(":icons/icon.png"));

    trayIcon->setContextMenu(ui->menuFile);
    trayIcon->show();

    ui->dockWidget->hide();
    ui->sourceComboBox->setModel(mLangageModel);
    ui->targetComboBox->setModel(mLangageModel);

    QDesktopWidget * desktop = new QDesktopWidget;

    QPoint startPos = QPoint(desktop->geometry().bottomRight() );
    QPoint finalPos = desktop->geometry().center() - QPoint(width()/2,height()/2);

    move(finalPos);
    connect(trayIcon,SIGNAL(activated(QSystemTrayIcon::ActivationReason)),this,SLOT(trayActivated(QSystemTrayIcon::ActivationReason)));
    connect(ui->actionExit,SIGNAL(triggered()),this,SLOT(exit()));
    connect(ui->translateButton,SIGNAL(clicked()),this,SLOT(translate()));
    connect(ui->sourceTextEdit,SIGNAL(returnPressed()),this,SLOT(translate()));
    connect(ui->swapButton,SIGNAL(clicked()),this,SLOT(swapLangages()));

    connect(ui->actionCopy,SIGNAL(triggered()),this,SLOT(copy()));
    connect(ui->actionCut,SIGNAL(triggered()),this,SLOT(cut()));
    connect(ui->actionPast,SIGNAL(triggered()),this,SLOT(past()));
    connect(ui->actionPreferences,SIGNAL(triggered()),this,SLOT(showPreferences()));
    connect(ui->actionAboutQt,SIGNAL(triggered()),this,SLOT(showAboutQt()));
    connect(ui->actionAbout,SIGNAL(triggered()),this,SLOT(showAbout()));
    connect(ui->actionTTS,SIGNAL(triggered()),this,SLOT(showTextTTS()));


    connect(ui->sourceSoundButton,SIGNAL(clicked()),this,SLOT(textToSpeak()));
    connect(ui->targetSoundButton,SIGNAL(clicked()),this,SLOT(textToSpeak()));


    //    mPropertyAnimation  = new QPropertyAnimation(this, "pos");
    //    mPropertyAnimation->setDuration(800);
    //    mPropertyAnimation->setStartValue(startPos);
    //    mPropertyAnimation->setEndValue(finalPos);


    //load default langage

    QSettings settings;
    QString sourceId = settings.value("source").toString();
    QString targetId = settings.value("target").toString();
    ui->sourceComboBox->setCurrentIndex(mLangageModel->findLangageId(sourceId));
    ui->targetComboBox->setCurrentIndex(mLangageModel->findLangageId(targetId));

}
开发者ID:Wohlstand,项目名称:quicklytranslate,代码行数:60,代码来源:mainwindow.cpp

示例4: makeDefaultWindows

void App::makeDefaultWindows()
{
    QDesktopWidget desktop;

    auto v = newViewportWindow();
    v->move((desktop.geometry().width() - v->width()) / 2 - 25,
            (desktop.geometry().height() - v->height()) / 2 - 25);

    auto c = newCanvasWindow();
    c->move((desktop.geometry().width() - c->width()) / 2 + 25,
            (desktop.geometry().height() - c->height()) / 2 + 25);
}
开发者ID:hansstam,项目名称:antimony,代码行数:12,代码来源:app.cpp

示例5: createDesktopPixmap

QPixmap CScreenShotView::createDesktopPixmap()
{
#ifdef Q_OS_MAC
    QPixmap pixmap = getScreenPixmap(m_desktopScreen);
#else
    QDesktopWidget *pDesktoWidget = QApplication::desktop();
    QPixmap pixmap = m_desktopScreen->grabWindow(pDesktoWidget->winId(),pDesktoWidget->geometry().x()
                                        ,pDesktoWidget->geometry().y(),pDesktoWidget->geometry().width(),pDesktoWidget->geometry().height());

#endif
    return pixmap;
}
开发者ID:weinkym,项目名称:src_miao,代码行数:12,代码来源:cscreenshotview.cpp

示例6: if

destroyer::destroyer(int id,int firstx,int firsty,QGraphicsPixmapItem *parent) : QObject(),QGraphicsPixmapItem(parent)
{
    QDesktopWidget desktop;
       height=desktop.geometry().height();
       width=desktop.geometry().width();

    img_id=id;
    if(img_id==1){

        x=firstx;
        y=firsty;
        x0=x;
        y0=y;
        mydestroyer=new QPixmap("://image/d9.png");
        *mydestroyer=mydestroyer->scaled(width/20,height/17);
         setPixmap(*mydestroyer);
         this->setPos(x,y);



    }
    else if(img_id==2){
        x=firstx;
        y=firsty;
        x0=x;
        y0=y;
        mydestroyer=new QPixmap("://image/d9.png");
        *mydestroyer=mydestroyer->scaled(width/20,height/17);
         setPixmap(*mydestroyer);
         this->setPos(x,y);




    }
    else if(img_id==3){

        x=firstx;
        y=firsty;
        x0=x;
        y0=y;
        mydestroyer=new QPixmap("://image/d9.png");
        *mydestroyer=mydestroyer->scaled(width/20,height/17);
         setPixmap(*mydestroyer);
         this->setPos(x,y);

    }


}
开发者ID:iutfinalproject,项目名称:finalproject.pakman,代码行数:50,代码来源:destroyer.cpp

示例7: QObject

human::human(QGraphicsPixmapItem *parent2):creature(parent2)/*,  QObject(),QGraphicsPixmapItem(parent2)*/{

     QDesktopWidget desktop;
     y=desktop.geometry().height()/7;
    x=(desktop.geometry().width()/2.3);
    int h=desktop.geometry().height()/14;
    int w=(desktop.geometry().width()/14);
    creature_img=new QPixmap("://image/down1.png");
       * creature_img= creature_img->scaled(w,h);
      setPixmap(*creature_img);
         this->setPos(x,y);


}
开发者ID:iutfinalproject,项目名称:finalproject.pakman,代码行数:14,代码来源:human.cpp

示例8: QMainWindow

MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    ui->actionStop_mouse_listening->setEnabled(false);
    try
    {
        QDesktopWidget desktop;
        QSize screenSize = desktop.geometry().size();
        Singleton::Instance().GetFacade()->GetMouseListener()->SetScreenSize(screenSize);
        Singleton::Instance().GetFacade()->GetMouseListener()->SetTCPPortNumber(TCPPortNumber);
        Singleton::Instance().GetFacade()->GetMouseListener()->SetUDPPortNumber(UDPPortNumber);
        Singleton::Instance().GetFacade()->GetMouseListener()->SetBroadCastPortNumber(broadCastPortNumber);

        connect(Singleton::Instance().GetFacade(),
                SIGNAL(ServerStartedSignal()), this, SLOT(ServerStarted()));
        connect(Singleton::Instance().GetFacade(),
                SIGNAL(ServerStoppedSignal()), this, SLOT(ServerStopped()));
        connect(Singleton::Instance().GetFacade(),
                SIGNAL(ErrorSendCommandToDeviceSignal()), this, SLOT(ErrorSendCommandToDevice()));
        connect(Singleton::Instance().GetFacade(),
                SIGNAL(ClientConnectedSignal(QString,int)), this, SLOT(ClientConnected(QString,int)));
        connect(Singleton::Instance().GetFacade(),
                SIGNAL(ClientDisconnectedSignal(QString,int)), this, SLOT(ClientDisconnected(QString,int)));
        connect(Singleton::Instance().GetFacade(),
                SIGNAL(ClientBroadCastSignal(QString,int)), this, SLOT(ClientBroadCast(QString,int)));
    }
    catch (Exception& exception)
    {}
}
开发者ID:ValeriyaSyomina,项目名称:MouseListener,代码行数:31,代码来源:mainwindow.cpp

示例9: SetupLayout

void BoatAnalysisDlg::SetupLayout()
{
	QDesktopWidget desktop;
	QRect r = desktop.geometry();
	setMinimumHeight(r.height()/2);
	setMinimumWidth(r.width()/2);

	m_pctrlTextOutput = new QTextEdit;
	m_pctrlTextOutput->setReadOnly(true);
	m_pctrlTextOutput->setLineWrapMode(QTextEdit::NoWrap);
	m_pctrlTextOutput->setWordWrapMode(QTextOption::NoWrap);
	m_pctrlTextOutput->setFontFamily("Courier");

	m_pctrlProgress = new QProgressBar;
	m_pctrlProgress->setOrientation(Qt::Horizontal);
	m_pctrlProgress->setMinimum(0);
	m_pctrlProgress->setMaximum(100);
	m_pctrlProgress->setValue(0);

	m_pctrlCancel = new QPushButton(tr("Cancel"));
	connect(m_pctrlCancel, SIGNAL(clicked()), this, SLOT(OnCancelAnalysis()));

	QHBoxLayout *ButtonLayout = new QHBoxLayout;
	ButtonLayout->addStretch(1);
	ButtonLayout->addWidget(m_pctrlCancel);
	ButtonLayout->addStretch(1);

	QVBoxLayout *mainLayout = new QVBoxLayout;
	mainLayout->addWidget(m_pctrlTextOutput);
	mainLayout->addWidget(m_pctrlProgress);
	mainLayout->addLayout(ButtonLayout);
	setLayout(mainLayout);
}
开发者ID:kolzar,项目名称:sail7,代码行数:33,代码来源:BoatAnalysisDlg.cpp

示例10: QDialog

PackageDialog::PackageDialog(QWidget *parent) : QDialog(parent)
{
	setFixedSize(PACKAGE_DIALOG_WIDTH, PACKAGE_DIALOG_HEIGHT);
	setWindowFlags(Qt::FramelessWindowHint);
	setAttribute(Qt::WA_TranslucentBackground);

	tabWidget = new QTabWidget;
	cbScrollArea = new QScrollArea;
	dbScrollArea = new QScrollArea;
	cbWidget = new QWidget;
	dbWidget = new QWidget;
	cbGridLayout = new QGridLayout;
	dbGridLayout = new QGridLayout;
	cbCount = dbCount = 0;

	TraverseFilesInDirectory("Resources/texture/block/constructive", constructiveImgPaths, true);
	TraverseFilesInDirectory("Resources/texture/block/decorative", decorativeImgPaths, true);

	for (int i=0; i<constructiveImgPaths.size(); i++)
	{
		AddCB(constructiveImgPaths[i]);
	}
	for (int i=0; i<decorativeImgPaths.size(); i++)
	{
		AddDB(decorativeImgPaths[i]);
	}

	cbWidget->setLayout(cbGridLayout);
	dbWidget->setLayout(dbGridLayout);

	cbScrollArea->setWidget(cbWidget);
	dbScrollArea->setWidget(dbWidget);

	tabWidget->addTab(cbScrollArea, "Constructive Blocks");
	tabWidget->addTab(dbScrollArea, "Decorative Blocks");

	vLayout = new QVBoxLayout;
	vLayout->addWidget(tabWidget);

	setLayout(vLayout);

	QDesktopWidget desktop;
	int desktopHeight = desktop.geometry().height();
	int desktopWidth = desktop.geometry().width();
	move((desktopWidth - PACKAGE_DIALOG_WIDTH) / 2, (desktopHeight - PACKAGE_DIALOG_HEIGHT) / 2);
}
开发者ID:Code-Guy,项目名称:Paradise,代码行数:46,代码来源:packagedialog.cpp

示例11: showFullScreen

void Frame::showFullScreen()
{
    QDesktopWidget * desktop = qApp->desktop();
    setFixedSize(desktop->geometry().size());
    show();
    grabKeyboard();
    grabMouse();
}
开发者ID:oberon2007,项目名称:deepin-session-ui-manjaro,代码行数:8,代码来源:frame.cpp

示例12: on_pushButton_clicked

void MainWindow::on_pushButton_clicked()
{
    if ( count != 0 )
    {
        for ( int i = 0; i < count; ++i)
        {
            button[i]->hide();
            delete button[i];
        }
        delete button;
    }

    bool ok;
    int n = ui->lineEdit->text().toInt(&ok, 10);
    if ( !ok ) return ;

    //ui->centralWidget->setGeometry(0, 0, 845, 100 + 40*(n/20 + 1));

    QDesktopWidget recDesc;

    QRect rec = recDesc.geometry();

    int h = 50 + 40*int(n/20);

    if ( n % 20 ) h += 40;

    if ( h > rec.height()-70 )
    {
        ui->lineEdit->setText("ERR");
        return ;
    }

    //h = 1000 * (h / 1000);

    int w = 430;

    if ( n >= 64 ) w = 870;

    this->setFixedSize(w, h);

    ui->line->setFixedHeight(h);

    button = new QPushButton*[n];

    qsrand((uint)QTime(0,0,0).msecsTo(QTime::currentTime()));

    masss = new int[n];

    for ( int i = 0; i < n; ++i)
    {
        masss[i] = qrand()%100;
        button[i] = new QPushButton(QString::number(masss[i]), this);
        button[i]->show();
    }

    entry_animation(n);

}
开发者ID:DeniZDobynda,项目名称:timsort,代码行数:58,代码来源:mainwindow.cpp

示例13: QWidget

MasterGui::MasterGui(QWidget* parent) : QWidget(parent)
{
    this->setWindowIcon(QIcon("./src/Software_Engineer_91.411_2/2_DataAggregator/Code/kinect_app/app_node/share/se_logo.xpm") );
    this->setWindowTitle("Software Engineering I");
    
    AppStyles::loadStyle(this, AppStyles::CLASSIC);
    //AppStyles::loadStyle<int>(5);
    
    QDesktopWidget desktop;
    int desktopHeight = desktop.geometry().height();
    int desktopWidth = desktop.geometry().width();
    cout << "Desktop is: " << desktopHeight << " high and " << desktopWidth << " wide.";
    //this->resize(desktopWidth, desktopHeight);
    
    initCore();
    
    this->setLayout(outerLayout);
}
开发者ID:neelTripathi,项目名称:Software_Engineer_91.411_2,代码行数:18,代码来源:MasterGui.cpp

示例14: on_selectedSample_currentIndexChanged

void BasicQtApp::on_selectedSample_currentIndexChanged(const QString &text)
{
    delete mCurrent;
    mCurrent = nullptr;

    if (text == "Styles") mCurrent = new WidgetGallery;
    else if (text == "Tree") mCurrent = new tree;

    if (mCurrent)
    {
        mCurrent->show();
        QDesktopWidget desktop;

        QRect geometry = mCurrent->frameGeometry();
        QPoint pos(desktop.geometry().width() - geometry.width(), desktop.geometry().height() - geometry.height()) ;
        mCurrent->move(pos);
    }
}
开发者ID:Kvalme,项目名称:qglgui,代码行数:18,代码来源:basicqtapp.cpp

示例15: pix

CDlgScreenShot::CDlgScreenShot(QWidget *parent)
    :QDialog(parent,
             Qt::FramelessWindowHint
             | Qt::X11BypassWindowManagerHint  //这个标志是在x11下有用,查看帮助QWidget::showFullScreen()  
             | Qt::Tool
             | Qt::WindowStaysOnTopHint
             | Qt::CustomizeWindowHint
             ),
    m_x(0),
    m_y(0),
    m_width(0),
    m_height(0),
    m_Editor(this)
{
    this->setFixedSize(qApp->desktop()->size());
    resize(qApp->desktop()->size());
    setAttribute(Qt::WA_TranslucentBackground,true);
    setCursor(Qt::CrossCursor);

#ifdef ANDROID
    QDesktopWidget *pScreen = qApp->desktop();
    QPixmap pix(pScreen->geometry().size());
    pScreen->render(&pix);
    m_imgDesktop = pix.toImage();
#else
    WId id = qApp->desktop()->winId();
    QScreen *pScreen = QGuiApplication::primaryScreen();
    m_imgDesktop = pScreen->grabWindow(id,
                                       0,
                                       0, 
                                       pScreen->geometry().width(),//pScreen->availableGeometry().width(),
                                       pScreen->geometry().height()//pScreen->availableGeometry().height()
                                       ).toImage();
#endif
    initSelectParam();

    m_Editor.hide();
    connect(&m_Editor,SIGNAL(sigReset()),this,SLOT(onSigReset()));
    connect(&m_Editor,SIGNAL(sigSelectImg(QPixmap)),this,SLOT(onSigSelectedImg(QPixmap)));
    connect(&m_Editor,SIGNAL(sigCancel()),this,SLOT(onSigCancel()));
}
开发者ID:KangLin,项目名称:rabbitim,代码行数:41,代码来源:DlgScreenShot.cpp


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