void Emulator_Control_Window::Apply_Full_Size( int w, int h ) { if( ! ui.actionDisplay_Scaling->isChecked() ) { setMaximumSize( w, h + menuWidget()->height() ); QDesktopWidget desktop; if( desktop.screenGeometry(desktop.primaryScreen()).width() > w ) resize( w, h + menuWidget()->height() ); } else { setMaximumSize( 4096, 2048 ); } }
KMilion::KMilion() : KXmlGuiWindow(), editorWidget(new QuizEdit(this)) { // accept dnd setAcceptDrops(true); // tell the KXmlGuiWindow that this is indeed the main widget setCentralWidget(editorWidget); // then, setup our actions setupActions(); // add a status bar statusBar()->show(); //scieżka do pliku z pytaniami QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8")); QTextCodec::setCodecForTr(QTextCodec::codecForName("UTF-8")); //editorWidget = new QuizEdit(this); editorWidget->setGeometry(6,30,800,500); showWidget = new QuizShow(this); showWidget->setGeometry(0,5,744,600); showWidget->hide(); isGame = false; // a call to KXmlGuiWindow::setupGUI() populates the GUI // with actions, using KXMLGUI. // It also applies the saved mainwindow settings, if any, and ask the // mainwindow to automatically save settings if changed: window size, // toolbar position, icon size, etc. setupGUI(); menuWidget()->show(); toolBar()->show(); smallSize.setCoords(30,30,840,600); setGeometry(smallSize); }
///@override virtual wyjście z quizu i powrót do edycji void KMilion::keyPressEvent(QKeyEvent* kevent) { if (isGame) { if (kevent->key() == Qt::Key_E && kevent->modifiers() == Qt::ControlModifier) { //qDebug() << "Wciśnięto Ctrl + E"; showWidget->hide(); showNormal(); setStyleSheet(QString::fromUtf8("background-color: none;")); setGeometry(smallSize); editorWidget->show(); menuWidget()->show(); toolBar()->show(); statusBar()->show(); isGame = false; } } kevent->accept(); }
//slot uruchamiający grę void KMilion::runGame() { QString path = editorWidget->getPath(); if (path.isEmpty()) { KMessageBox::error(this,i18n("Choose file with quiz before"),i18n("File error")); return; } isGame = true; editorWidget->hide(); menuWidget()->hide(); toolBar()->hide(); statusBar()->hide(); qDebug() << "Ścieżka do pliku xml " + path; showFullScreen(); setStyleSheet(QString::fromUtf8("background-color: rgb(70, 82, 255);")); showWidget->setGeometry((screenWidth_ - 744)/2,(screenHeight_ -600)/2,744,600); showWidget->show(); showWidget->refreshData(editorWidget->getPath()); }