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


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

本文整理汇总了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);
}
开发者ID:vogel,项目名称:kadu,代码行数:25,代码来源:chat-window.cpp

示例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();
}
开发者ID:jeffrimko,项目名称:QuickWin,代码行数:58,代码来源:mainwindow.cpp

示例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);
}
开发者ID:puzzleSEQ,项目名称:client,代码行数:17,代码来源:main.cpp

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

}
开发者ID:algogr,项目名称:Elina_Labels_odbc,代码行数:50,代码来源:login.cpp

示例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);
}
开发者ID:cnhacktnt,项目名称:rstockanalyst,代码行数:7,代码来源:SplashDlg.cpp

示例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 );


}
开发者ID:atavacron,项目名称:PayTERM,代码行数:29,代码来源:mainwindow.cpp

示例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 );
}
开发者ID:Glyca,项目名称:RunicOrbs,代码行数:26,代码来源:Home.cpp

示例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");
}
开发者ID:andysim,项目名称:chemvp,代码行数:60,代码来源:mainwindow.cpp

示例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);
}
开发者ID:JoeyPinilla,项目名称:xVideoServiceThief,代码行数:27,代码来源:loadingimpl.cpp

示例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);
}
开发者ID:kernel-coder,项目名称:TinyPNGQtClient,代码行数:7,代码来源:QtAppDataSettings.cpp

示例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);
}
开发者ID:LLIAKAJL,项目名称:WineWizard,代码行数:26,代码来源:setupwizard.cpp

示例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);
    }

}
开发者ID:ice200117,项目名称:oceanrs,代码行数:29,代码来源:forecast.cpp

示例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();
}
开发者ID:ice200117,项目名称:oceanrs,代码行数:25,代码来源:forecast.cpp

示例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();
}
开发者ID:jdb175,项目名称:SPHINX,代码行数:37,代码来源:GUI.cpp

示例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;
    }
}
开发者ID:caoyanjie,项目名称:Sprite,代码行数:31,代码来源:videoplayer.cpp


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