本文整理汇总了C++中QDesktopWidget::height方法的典型用法代码示例。如果您正苦于以下问题:C++ QDesktopWidget::height方法的具体用法?C++ QDesktopWidget::height怎么用?C++ QDesktopWidget::height使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QDesktopWidget
的用法示例。
在下文中一共展示了QDesktopWidget::height方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: defaultGeometry
QRect ChatWindow::defaultGeometry() const
{
QSize size(0, 400);
int x, y;
x = pos().x();
y = pos().y();
if (m_chatWidget->chat().contacts().count() > 1)
size.setWidth(550);
else
size.setWidth(400);
QDesktopWidget *desk = qApp->desktop();
if ((size.width() + x) > desk->width())
x = desk->width() - size.width() - 50;
if ((size.height() + y) > desk->height())
y = desk->height() - size.height() - 50;
if (x < 50)
x = 50;
if (y < 50)
y = 50;
return QRect(QPoint(x, y), size);
}
示例2: QMainWindow
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow),
proxy(new QSortFilterProxyModel(parent)),
model(new QStandardItemModel(0, 3, parent))
{
// Set the window style.
Qt::WindowFlags flags = windowFlags();
setWindowFlags(flags | Qt::WindowStaysOnTopHint | Qt::ToolTip);
// Center window.
QDesktopWidget *desktop = QApplication::desktop();
int width = desktop->width() * 0.6;
int height = desktop->height() * 0.6;
setFixedSize(width, height);
move((desktop->width() - width) / 2, (desktop->height() - height) / 2);
// Set up system tray.
trayIconMenu = new QMenu(this);
aboutAction = new QAction(tr("&About"), this);
quitAction = new QAction(tr("&Quit"), this);
connect(aboutAction, SIGNAL(triggered()), this, SLOT(aboutMain()));
connect(quitAction, SIGNAL(triggered()), this, SLOT(quitMain()));
trayIconMenu->addAction(aboutAction);
trayIconMenu->addAction(quitAction);
trayIcon = new QSystemTrayIcon(this);
trayIcon->setContextMenu(trayIconMenu);
trayIcon->setToolTip(QString("QuickWin"));
trayIcon->setIcon(QIcon("icon.png"));
trayIcon->show();
// Set up UI items.
ui->setupUi(this);
proxy->setSourceModel(model);
ui->winView->setModel(proxy);
proxy->setFilterKeyColumn(1);
ui->winView->setSortingEnabled(true);
ui->winView->sortByColumn(0, Qt::AscendingOrder);
ui->winView->setEditTriggers(QAbstractItemView::NoEditTriggers);
model->setHeaderData(0, Qt::Horizontal, QObject::tr("Number"));
model->setHeaderData(1, Qt::Horizontal, QObject::tr("Title"));
model->setHeaderData(2, Qt::Horizontal, QObject::tr("Executable"));
ui->winView->header()->resizeSection(0, width * 0.08);
ui->winView->header()->resizeSection(1, width * 0.7);
connect(ui->cmdText, SIGNAL(returnPressed()),
this,SLOT(onTextEnter()));
connect(ui->cmdText, SIGNAL(textChanged(const QString &)),
this, SLOT(onTextChanged(const QString &)));
connect(ui->winView, SIGNAL(activated(QModelIndex)),
this, SLOT(onWitemActivate(QModelIndex)));
// Register system-wide hotkey.
HWND hwnd = (HWND)this->winId();
RegisterHotKey(hwnd, 100, MOD_CONTROL | MOD_ALT, VK_SPACE);
updateWinList();
}
示例3: centerWindow
/**
* @brief _centerWindow Centers the mainWindow on the screen.
* @param window The window to be centered.
*/
void centerWindow(MainWindow & window)
{
const qreal WIDTH_FRAC = 0.7;
const qreal HEIGHT_FRAC = 0.9;
QDesktopWidget dw;
int x = dw.width() * WIDTH_FRAC;
int y = dw.height() * HEIGHT_FRAC;
window.resize(x, y);
x = dw.width() * (1.0 - WIDTH_FRAC) / 2.0;
y = dw.height() * (1.0 - HEIGHT_FRAC) / 2.0;
window.move(x,y);
}
示例4: okpressed
void login::okpressed()
{
int WIDTH = 1280;
int HEIGHT = 1024;
int screenWidth;
int screenHeight;
int x, y;
if(ui.userlineEdit->text()=="admin" && ui.passlineEdit_2->text()=="789")
{
QDesktopWidget *desktop = QApplication::desktop();
screenWidth = desktop->width();
screenHeight = desktop->height();
x = (screenWidth - WIDTH) / 2;
y = (screenHeight - HEIGHT) / 2;
mainWindow *m= new mainWindow(this,0);
this->hide();
m->show();
m->move(x,y);
return;
}
if(ui.userlineEdit->text()=="user" && ui.passlineEdit_2->text()=="123")
{
QDesktopWidget *desktop = QApplication::desktop();
screenWidth = desktop->width();
screenHeight = desktop->height();
x = (screenWidth - WIDTH) / 2;
y = (screenHeight - HEIGHT) / 2;
mainWindow *m= new mainWindow(0,1);
m->show();
this->hide();
m->move(x,y);
return;
}
QMessageBox::critical(this, qApp->trUtf8("Προσοχή"), qApp->trUtf8(
"Λάθος στοιχεία χρήστη "));
//return;
}
示例5: showEvent
void CSplashDlg::showEvent(QShowEvent* event)
{
QDesktopWidget* desktop = QApplication::desktop();
move((desktop->width() - this->width())/2, (desktop->height() - this->height())/2);
return QWidget::showEvent(event);
}
示例6: QMainWindow
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
QDesktopWidget *desktop = QApplication::desktop();
int screenWidth, width;
int screenHeight, height;
int x, y;
QSize windowSize;
screenWidth = desktop->width(); // get width of screen
screenHeight = desktop->height(); // get height of screen
windowSize = size(); // size of our application window
width = windowSize.width();
height = windowSize.height();
// little computations
x = (screenWidth - width) / 2;
y = (screenHeight - height) / 2;
y -= 50;
// move window to desired coordinates
move ( x, y );
}
示例7: url
Home::Home(QWidget *parent) :
QWidget(parent), ui(new Ui::Home), b_optionDialogOpened(false), m_optionsDialog(NULL), b_serverWidgetOpened(false), m_serverWidget(NULL)
{
ui->setupUi(this);
QString url("http://www.runicorbs.net/ingame.php?syslang=" + QLocale::system().name()
+ "&version=" + QString::fromUtf8(QUrl::toPercentEncoding(TRO_VERSION)));
ui->newsWebView->setUrl(url);
QString imageName(qApp->applicationDirPath() + "/gfx/logo.png");
if(QFile(imageName).exists()) {
ui->titleLabel->setPixmap(QPixmap(imageName));
}
else {
ui->titleLabel->setText("The Runic Orbs");
}
connect(ui->soloButton, SIGNAL(clicked()), this, SLOT(soloGameLaunch()));
connect(ui->multiButton, SIGNAL(clicked()), this, SLOT(openConnectDialog()));
connect(ui->serverButton, SIGNAL(clicked()), this, SLOT(openServerWidget()));
connect(ui->optionsButton, SIGNAL(clicked()), this, SLOT(openOptions()));
connect(ui->quitButton, SIGNAL(clicked()), this, SLOT(close()));
ui->versionLabel->setText(tr("version %1").arg(TRO_VERSION));
// Center the window on the screen
QDesktopWidget* desktop = QApplication::desktop();
move( (desktop->width() - width()) / 2 , (desktop->height() - height()) / 2 - 50 );
}
示例8: QUndoStack
MainWindow::MainWindow(FileParser *parser_in):
parser(parser_in)
{
undoStack = new QUndoStack();
drawingInfo = new DrawingInfo();
canvas = new DrawingCanvas(drawingInfo, parser);
createActions();
createToolBox();
createMenus();
createToolbars();
Atom::fillLabelToVdwRadiusMap();
Atom::fillLabelToMassMap();
QSettings settings;
QMap<QString, QVariant> colorMap = settings.value("Default Atom Colors", QVariant(QMap<QString, QVariant>())).toMap();
if(colorMap.isEmpty())
Atom::fillLabelToColorMap();
else
Atom::labelToColor = colorMap;
QHBoxLayout* layout = new QHBoxLayout;
view = new DrawingDisplay(canvas, drawingInfo);
view->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
view->setGeometry(0, 0, static_cast<int>(DEFAULT_SCENE_SIZE_X), static_cast<int>(DEFAULT_SCENE_SIZE_Y));
view->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
view->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
view->setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
drawingInfo->setHeight(view->sceneRect().height());
drawingInfo->setWidth(view->sceneRect().width());
drawingInfo->determineScaleFactor();
canvas->setSceneRect(view->sceneRect());
canvas->refresh();
QDesktopWidget qdw;
int screenCenterX = qdw.width() / 2;
int screenCenterY = qdw.height() / 2;
this->setGeometry(screenCenterX - 600, screenCenterY - 350, 1200, 700);
splitter = new QSplitter(Qt::Horizontal);
splitter->addWidget(view);
splitter->addWidget(toolBox);
layout->addWidget(splitter);
QWidget *widget = new QWidget;
widget->setLayout(layout);
setCentralWidget(widget);
loadFile();
// The undo/redo framework needs to update the buttons appropriately
connect(undoStack, SIGNAL(canRedoChanged(bool)), redoAction, SLOT(setEnabled(bool)));
connect(undoStack, SIGNAL(canUndoChanged(bool)), undoAction, SLOT(setEnabled(bool)));
resetSignalsOnFileLoad();
this->setWindowIconText("cheMVP");
this->setWindowTitle("cheMVP");
}
示例9: setupUi
LoadingImpl::LoadingImpl(QWidget *parent) :
QWidget(parent)
{
setupUi(this);
QWidget::setWindowFlags(Qt::ToolTip | Qt::WindowStaysOnTopHint);
QDesktopWidget *desktop = QApplication::desktop();
int screenWidth, width;
int screenHeight, height;
int x, y;
QSize windowSize;
screenWidth = desktop->width();
screenHeight = desktop->height();
windowSize = size();
width = windowSize.width();
height = windowSize.height();
x = (screenWidth - width) / 2;
y = (screenHeight - height) / 2;
y -= 50;
move(x, y);
}
示例10: defaultWndPoint
QPoint defaultWndPoint(QWidget* w)
{
QDesktopWidget* dw = QApplication::desktop();
int x = (dw->width() - w->width())/2;
int y = (dw->height() - w->height())/2;
return QPoint(x, y);
}
示例11: s
SetupWizard::SetupWizard(const QString &exe, const QString &args,
QAbstractItemModel *model, QWidget *parent) :
QWizard(parent),
ui(new Ui::SetupWizard),
mModel(model)
{
mInstances.append(this);
ui->setupUi(this);
setWindowTitle(QFileInfo(exe).fileName());
setWindowIcon(QPixmap::fromImage(Utils::extractIcon(exe)));
setAttribute(Qt::WA_DeleteOnClose);
QSettings s("winewizard", "settings");
s.beginGroup("InstallWizard");
QDesktopWidget *dw = QApplication::desktop();
resize(s.value("Size", QSize(dw->width() * 0.7, dw->height() * 0.6)).toSize());
s.endGroup();
setPage(PageIntro, new IntroPage(exe, args, mModel, this));
setPage(PageSolution, new SolutionPage(exe, this));
setPage(PageInstall, new InstallPage(mModel, this));
setPage(PageDebug, new DebugPage(mModel, this));
setPage(PageFinal, new FinalPage(this));
setPage(PageUpdate, new UpdatePage(mModel, this));
for (int id : pageIds())
connect(page(id), &QWizardPage::completeChanged, button(QWizard::BackButton), &QAbstractButton::hide);
connect(this, &SetupWizard::currentIdChanged, button(QWizard::BackButton), &QAbstractButton::hide);
}
示例12: Display
void Forecast::on_pushButton_2_clicked()
{
// Open multi image.
QString path;
QDir dir;
path=dir.currentPath();
QStringList files = QFileDialog::getOpenFileNames(
this,
"Select one or more files to open",
path,
"Images (*.png *.png *.jpg *.bmp)");
if(files.count()>0) {
files.sort();
//displayYuBao(files);
Display *fc = new Display();
fc->init(files);
QDesktopWidget* desktop = QApplication::desktop();
int x,y;
x=(desktop->width() - fc->width())/2;
y=(desktop->height() - fc->height())/2-20;
fc->setGeometry(x,y,fc->width(),fc->height());
fc->setModal(true);
fc->show();
mw->m_display_windows_list.append(fc);
}
}
示例13: on_pushButton_yc_clicked
void Forecast::on_pushButton_yc_clicked()
{
// QString path;
// QDir dir;
// path=dir.currentPath();
// QDir::setCurrent(path+"\\yubao\\wyc");
// QProcess::execute("yueceng.exe");
// QDir::setCurrent(path);
// Show file select Dialog.
if(select_window!=NULL) {
delete select_window;
}
select_window = new SelectFile();
select_window->init(WYC);
QDesktopWidget* desktop = QApplication::desktop();
int x,y;
x=(desktop->width() - select_window->width())/2;
y=(desktop->height() - select_window->height())/2;
select_window->setGeometry(x,y,1,429);
// select_window->setModal(true);
select_window->show();
}
示例14: start
/**
* @brief GUI::start initializes the GUI application.
*/
void GUI::start()
{
centralWidget = new QWidget(this);
//Get desktop size for scaling window
QDesktopWidget *desktop = QApplication::desktop();
//build the PSpaceGraph
graphInstance = new PSpaceGraph(centralWidget, evCont, colorMappings, colorSelect);
evCont->registerListener(graphInstance);
//build layout for GUI.
line = new QFrame(centralWidget);
line->setFrameShape(QFrame::VLine);
line->setFrameShadow(QFrame::Sunken);
rulePanel = new RuleView(centralWidget, evCont, colorMappings);
evCont->registerListener(rulePanel);
evCont->setRuleMode(RuleMode(UNIQUE));
//build the main window.
this->resize(desktop->width(), desktop->height());
this->setWindowTitle("PARAS GUI");
//this->setWindowIcon(ICON_PARAS);
this->setCentralWidget(centralWidget);
this->setMenuBar(buildMenuBar());
this->setMinimumHeight(600);
this->setMinimumWidth(1000);
loadConfigInfo();
this->show();
}
示例15: playStateChanged
//播放状态改变
void VideoPlayer::playStateChanged(QMediaPlayer::State state)
{
if (state == QMediaPlayer::StoppedState)
{
QDesktopWidget desktop;
this->setGeometry((desktop.width()-WIDTH)/2, (desktop.height()-HEIGHT)/2, WIDTH, HEIGHT);
lab_background->setStyleSheet("border-image: url(:/Images/videoPlayerBg.png);");
videoWidget->hide();
videoContral->playStop();
tbn_openVideoFile->show();
//停止保持屏幕常亮
timerKeepAwake->stop();
//鼠标恢复
hideCursor = false;
}
else if (state == QMediaPlayer::PlayingState)
{
videoWidget->show();
videoWidget->setFocus();
videoContral->setVideoTitle(playlist_list.at(1)->currentMedia().canonicalUrl().fileName());
// videoContral->setVideoTitle(tr("%1").arg(playlist_list.at(1)->currentIndex()));
//设置屏幕常亮
timerKeepAwake->start(58000);
//设置鼠标隐藏
hideCursor = true;
}
}