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); }
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(); }
/** * @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); }
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; }
void CSplashDlg::showEvent(QShowEvent* event) { QDesktopWidget* desktop = QApplication::desktop(); move((desktop->width() - this->width())/2, (desktop->height() - this->height())/2); return QWidget::showEvent(event); }
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 ); }
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 ); }
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"); }
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); }
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); }
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); }
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); } }
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(); }
/** * @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(); }
//播放状态改变 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; } }
void SmartWindow::setWindowMode (const WindowMode& mode) { hide(); m_windowMode = mode; /* Enable window borders and resize to minimum size */ if (mode == kNormal) { QDesktopWidget w; int dx = w.width() / 9; int dy = w.height() / 2; move (Settings::get ("x", dx).toInt(), Settings::get ("y", dy).toInt()); resize (minimumSizeHint()); setFixedSize (minimumSizeHint()); setWindowFlags (Qt::WindowTitleHint | Qt::WindowCloseButtonHint | Qt::WindowMinimizeButtonHint); } /* Disable window borders */ else if (mode == kDocked) setWindowFlags (Qt::FramelessWindowHint); show(); resizeToFit(); }
CFrmGroupChat::CFrmGroupChat(QWidget *parent) : QFrame(parent), ui(new Ui::CFrmGroupChat) { ui->setupUi(this); ui->txtInput->setFocus();//设置焦点 //设置过滤器,用于过滤发送消息快捷键,在 eventFilter 中处理 ui->txtInput->installEventFilter(this); #ifdef MOBILE ui->lstMembers->setVisible(false); ui->pbMember->setVisible(true); #else ui->lstMembers->setVisible(true); ui->pbMember->setVisible(false); ui->pbSend->setMenu(&m_MessageSendMenu); ui->pbSend->setPopupMode(QToolButton::MenuButtonPopup); #endif m_pRoom = NULL; m_pItem = NULL; m_MessageCount = 0; ui->lstMembers->setEditTriggers(QAbstractItemView::NoEditTriggers); m_pModelMembers = new QStandardItemModel(this); if(m_pModelMembers) { ui->lstMembers->setModel(m_pModelMembers); } QDesktopWidget *pDesk = QApplication::desktop(); move((pDesk->width() - width()) / 2, (pDesk->height() - height()) / 2); }
QPlayer::QPlayer(QTimer *timer1, QTimer *timer2, QFile *file1) { playTimer = timer1; refreshTimer = timer2; file = file1; QDesktopWidget *desktop = new QDesktopWidget; setWindowTitle("QPlayer"); setGeometry(desktop->width()-100, desktop->height()-60, 220, 25); xSize = 130; ySize = 30; busy = false; slider = new QSlider(Qt::Horizontal,this); QPushButton *playButton = new QPushButton(QIcon(":/icons/amarok_play.png"),""); QPushButton *pauseButton = new QPushButton(QIcon(":/icons/amarok_pause.png"),""); playButton->setFlat(true); pauseButton->setFlat(true); QHBoxLayout *layout = new QHBoxLayout; layout->addWidget(playButton); layout->addWidget(pauseButton); layout->addWidget(slider); connect(playButton, SIGNAL(released()), this, SLOT(play() ) ); connect(pauseButton,SIGNAL(released()), this, SLOT(pause()) ); connect(slider,SIGNAL(sliderReleased()), this, SLOT(seekFile()) ); connect(slider,SIGNAL(sliderPressed()), this, SLOT(sliderPress()) ); setLayout(layout); show(); }
int main(int argc, char *argv[]) { int screenWidth, screenHeight; int w, h; int x, y; QApplication a(argc, argv); XupaNet window; QDesktopWidget *desktop = QApplication::desktop(); screenHeight = desktop->height(); screenWidth = desktop->width(); // qDebug() <<"dimensoes: altura: " << screenHeight << "largura: " << screenWidth; // Para nao ficar uma janela grande e tosca w = 1000; h = 700; y = (screenHeight - h)/2; x = (screenWidth - w) /2; window.resize(w, h); window.move(x, y); window.show(); return a.exec(); }
FrmMainWindow::FrmMainWindow(QWidget *parent) : QMainWindow(parent) { setupUi(this); //center to desktop QDesktopWidget *desktop = QApplication::desktop(); int screenWidth, width; int screenHeight, height; int x, y; QSize windowSize; screenWidth=desktop->width(); screenHeight=desktop->height(); windowSize=this->size(); width=windowSize.width(); height=windowSize.height(); x=(screenWidth-width)/2; y=(screenHeight-height)/2; this->move(x,y); m_FrmAbout=new FrmAbout(this); m_FrmSettings=new FrmSettings(this); }
// ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- void DevHelper::setupGui() { // Allow internal widgets to update the status bar connect(filterMaker, SIGNAL(updateStatusBar(QString)), this, SLOT(updateStatusMessage(QString))); connect(pluginMaker, SIGNAL(updateStatusBar(QString)), this, SLOT(updateStatusMessage(QString))); //Set window to open at the center of the screen 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 application window width = windowSize.width(); height = windowSize.height(); x = (screenWidth - width) / 2; y = (screenHeight - height) / 2; y -= 50; // move window to desired coordinates move(x, y); }
void TimerWind::modalMsgBox(QString tagline, QString text, bool critical) { QDesktopWidget *desktop = QApplication::desktop(); QMessageBox *msg = new QMessageBox(desktop); msg->setWindowTitle(tr("SimpleTimer")); msg->setInformativeText(text); msg->setText("<big><b>" + tagline + "</b></big>"); msg->setWindowFlags(msg->windowFlags() | Qt::WindowStaysOnTopHint | Qt::X11BypassWindowManagerHint); if(critical) { msg->setIcon(QMessageBox::Critical); } else { msg->setIcon(QMessageBox::Information); } #ifdef Q_WS_X11 /* Center window in current screen. * From http://www.qtcentre.org/threads/14772-how-to-show-window-in-the-center-of-the-screen * Unnecessary for Windows because it automatically centers the window. */ int screenWidth, width; int screenHeight, height; int x, y; QSize windowSize; screenWidth = desktop->width(); screenHeight = desktop->height(); windowSize = msg->size(); width = windowSize.width(); height = windowSize.height(); x = (screenWidth - width) / 2; y = (screenHeight - height) / 2; msg->setGeometry(x, y, msg->geometry().width(),msg->geometry().height()); #endif msg->show(); }
void Forecast::on_pushButton_hyf_clicked() { // QString path; // QDir dir; // path=dir.currentPath(); // QDir::setCurrent(path+"\\yubao\\hyfm"); // QProcess::startDetached("frontdetect_example.exe"); // QDir::setCurrent(path); // Show file select Dialog. if(select_window!=NULL) { delete select_window; } select_window = new SelectFile(); select_window->init(HYFM); 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(); }
//Main int main(int argc, char *argv[]) { QApplication app(argc, argv); //variables int posx, posy; int screenW; int screenH; int WIDTH = 500;//monitor size width int HEIGHT = 500;//monitor size height QDesktopWidget *desktop = QApplication::desktop(); //get size of monitor screenW = desktop->width(); screenH = desktop->height(); posx = (screenW - WIDTH) / 2; posy = (screenH - HEIGHT) / 2; collision window; window.setGeometry(posx, posy, WIDTH, HEIGHT); window.setFixedSize(WIDTH, HEIGHT); window.setWindowTitle("HUNT"); // window.setStyleSheet("background-image:Image/background.png"); window.show(); return app.exec(); }
void Forecast::on_pushButton_clicked() { QString path; QDir dir; path=dir.currentPath(); //Show file select Dialog. if(select_window!=NULL) { delete select_window; } select_window = new SelectFile(); select_window->init(SWWYL); 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(); // MPlayer 播放视频 // QProcess::execute("C:\\MPlayer_Windows\\mplayer\\MPlayer.exe "+path+"\\yubao\\wenyanliu\\nwp_3dvar.mp4"); // QProcess::execute("C:\\wmplayer\\wmplayer.exe "+path+"\\yubao\\wenyanliu\\nwp_3dvar.mp4"); }
// Set the window that is going to be the whole desktop void On::setWindow() { /*if(getenv("QT_GRAPHICSSYSTEM") == 0) { QApplication::setGraphicsSystem("raster"); }*/ QDesktopWidget* desktop = QApplication::desktop(); const QRect screen = desktop->screenGeometry(this); static Atom atom = XInternAtom(QX11Info::display(), "_NET_WM_DESKTOP", False); ulong data[1]; data[0] = 0xFFFFFFFF; XChangeProperty(QX11Info::display(), winId(), atom, atom, 32, PropModeReplace, (unsigned char *) data, 1); //setWindowFlags(Qt::WindowStaysOnBottomHint); setAttribute(Qt::WA_X11NetWmWindowTypeDesktop); //showMaximized(); setGeometry(0, 24, desktop->width(), desktop->height()); /*if (QX11Info::isCompositingManagerRunning()) { setAttribute(Qt::WA_TranslucentBackground); } else { setAutoFillBackground(true); }*/ setContextMenuPolicy(Qt::NoContextMenu); setFocus(); }
void kWarningWindow::kShow(int type){ //加载警告种类 //0 ok //1 error if (type == 0){ kMusicData::successSound(); windowImage.load("Resources\\image\\warning"); } else if (type == 1){ kMusicData::errorSound(); windowImage.load("Resources\\image\\warning2"); } //透明度 setWindowOpacity(1.0); //动画 timeid = startTimer(40); update(); //移动到中间 QDesktopWidget* desktop = QApplication::desktop(); move((desktop->width() - 580) / 2, (desktop->height() - 270) / 2); show(); }
void regionselection::moveBottomMiddle( QMouseEvent *event ) { // Globale Mauskoordinaten int mouseGlobalY = event->globalY(); // Alte Widget Koordinaten int widgetX = geometry().x(); int widgetY = geometry().y(); int widgetWidth = geometry().width(); int widgetHeight = geometry().height(); // Minimale Größe des Widget begrenzen if ( mouseGlobalY <= widgetY + 200 - currentMouseRightLocalY ) mouseGlobalY = widgetY + 200 - currentMouseRightLocalY; // Maximale größe begrenzen QDesktopWidget *desk = QApplication::desktop(); //if ( mouseGlobalY + currentMouseRightLocalY > desk->screenGeometry().height() ) if ( mouseGlobalY + currentMouseRightLocalY > desk->height() ) mouseGlobalY = widgetY + widgetHeight - currentMouseRightLocalY; this->setGeometry( widgetX, widgetY, widgetWidth, currentWidgetHeight + ( mouseGlobalY - ( widgetY + currentMouseLocalY ) ) ); }
/*! * \brief EnlargedFrameWindow::displayFrame displays a frame with the given filename in a pop up window. * * \param fileName the name of the file (as a precondition the file must be located in the tmp directory). */ void EnlargedFrameWindow::displayFrame(QString fileName) { _scene = new QGraphicsScene(); #ifdef WIN32 pix->load("tmp\\" + fileName); if(pix->isNull()) { pix->load("tmp/" + fileName); } #else pix->load("tmp/" + fileName); #endif // Set up the image _scene->addPixmap(*pix); _scene->setSceneRect( pix->rect() ); ui->frameView->setScene(_scene); ui->frameView->setGeometry(0,0, _scene->width(), _scene->height()); this->setGeometry( this->x(), this->y(), ui->frameView->width(), ui->frameView->height()); // Move the frame to the center of the screen. QDesktopWidget *desktop = QApplication::desktop(); int x, y; x = (desktop->width() - this->width()) / 2; y = (desktop->height() - this->height()) / 2; y -= 50; this->move(x, y); // Display the frame. ui->frameView->show(); }
void BreakpointDialog::ShowBreakpoint() { /* Set data */ ui_->chkDisplayAfterParsing->setChecked(m_breakpoint->brkAfterParsing); ui_->chkDisplayAfterBinding->setChecked(m_breakpoint->brkAfterBinding); ui_->chkDisplayAfterTransformation-> setChecked(m_breakpoint->brkAfterTransform); ui_->chkDisplayAfterNormalization-> setChecked(m_breakpoint->brkAfterNormalize); ui_->chkDisplayAfterSemanticQueryOpt-> setChecked(m_breakpoint->brkAfterSemanticQueryOptimization); ui_->chkDisplayAfterAnalysis->setChecked(m_breakpoint->brkAfterAnalyze); ui_->chkDisplayAfterOptimization1->setChecked(m_breakpoint->brkAfterOpt1); ui_->chkDisplayAfterOptimization2->setChecked(m_breakpoint->brkAfterOpt2); ui_->chkDisplayAfterPrecodegen->setChecked(m_breakpoint->brkAfterPreCodegen); ui_->chkDisplayAfterCodegen->setChecked(m_breakpoint->brkAfterCodegen); ui_->chkDisplayAfterTdbGeneration->setChecked(m_breakpoint->brkAfterTDBgen); //ui_->chkDisplayExecution->setChecked(m_breakpoint->brkDuringExecution); // Set center screen QDesktopWidget * desktop = QApplication::desktop(); move((desktop->width() - this->width()) / 2, (desktop->height() - this->height()) / 2); this->exec(); }