本文整理汇总了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);
}
示例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);
}
示例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);
}
示例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();
}
示例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);
}
示例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);
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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());
}
示例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();
}