/** * Adds a new child surface for the state to take care of, * giving it the game's display palette. Once associated, * the state handles all of the surface's behaviour * and management automatically. * @param surface Child surface. * @note Since visible elements can overlap one another, * they have to be added in ascending Z-Order to be blitted * correctly onto the screen. */ void State::add(Surface *surface) { // Set palette surface->setPalette(_game->getScreen()->getPalette()); // Set default fonts Text *t = dynamic_cast<Text*>(surface); TextButton *tb = dynamic_cast<TextButton*>(surface); TextEdit *te = dynamic_cast<TextEdit*>(surface); TextList *tl = dynamic_cast<TextList*>(surface); if (t) { t->setFonts(_game->getResourcePack()->getFont("BIGLETS.DAT"), _game->getResourcePack()->getFont("SMALLSET.DAT")); } else if (tb) { tb->setFonts(_game->getResourcePack()->getFont("BIGLETS.DAT"), _game->getResourcePack()->getFont("SMALLSET.DAT")); } else if (te) { te->setFonts(_game->getResourcePack()->getFont("BIGLETS.DAT"), _game->getResourcePack()->getFont("SMALLSET.DAT")); } else if (tl) { tl->setFonts(_game->getResourcePack()->getFont("BIGLETS.DAT"), _game->getResourcePack()->getFont("SMALLSET.DAT")); } _surfaces.push_back(surface); }
void Test2Test::testCase10() { TextEdit txt; bool p; p=txt.textItalic(); QCOMPARE(true,p); }
void ValueEdit::resizeEditor() { if ( edit ) { QSize sz = size(); switch ( typ ) { case NifValue::tSizedString: case NifValue::tText: { TextEdit * te = (TextEdit *)edit; te->move( QPoint( 0, 0 ) ); resize( size() ); te->CalcSize(); } break; default: { edit->move( QPoint( 0, 0 ) ); edit->resize( sz ); resize( sz ); } break; } } }
void Test2Test::testCase7() { TextEdit txt; bool result; result=txt.fileOpen("G:/Lab1_tests/textedit/1.docx"); QCOMPARE(result,true); }
void FrostEdit::pointToIssue(QListWidgetItem* item) { IssueItem* issue = static_cast<IssueItem*>(item); TabWidgetFrame* curTabFrameWidget = toTabWidgetFrame(mCurrentTabWidget->parentWidget()); TextEdit* edit = nullptr; QString path; QString open; QFileInfo file(mCompiledFile); if(file.exists() && file.isFile()) { path = file.absolutePath(); QFileInfo finfo(path+"/"+issue->getFile()); if(finfo.isFile()) open = finfo.absolutePath(); else open = issue->getFile(); } else { open = mCompiledFile; } addEditor(curTabFrameWidget, open); edit = toTextEdit(mCurrentTabWidget->currentWidget()); edit->setCursorPosition(issue->getRow()-1, issue->getColumn()-1); edit->ensureCursorVisible(); edit->setFocus(); }
void FrostEdit::widgetChanged(QWidget* old, QWidget* now) { if(old == now) return; //Let's test was the last clicked widget A) TextEdit B) TabWidget C) TabBar TextEdit* wid = toTextEdit(now); TabWidget* tabwid = qobject_cast<TabWidget*>(now); QTabBar* bar = qobject_cast<QTabBar*>(now) ; //Was TabBar if(bar != nullptr && tabwid == nullptr && wid == nullptr) { tabwid = qobject_cast<TabWidget*>(bar->parentWidget()); updateTabWidget(tabwid); } else if(wid != nullptr && tabwid == nullptr && bar == nullptr) { tabwid = qobject_cast<TabWidget*>(wid->getParentWidget()); updateTabWidget(tabwid); } else if(tabwid != nullptr && bar == nullptr) { updateTabWidget(tabwid); } if(mCurrentTabWidget != nullptr) { if(mCurrentTabWidget->count() != 0 && mCurrentTabWidget != nullptr && mCurrentTabWidget->currentWidget() != nullptr) { QTextDocument* doc = toTextEdit(mCurrentTabWidget->currentWidget())->document(); emit documentChanged(toDocument(doc)); } } }
void Test2Test::testCase5() { TextEdit txt; bool p; p=txt.textBold(); QCOMPARE(true,p); }
void Test2Test::testCase9() { bool success; TextEdit txt; QString str="5555"; success=txt.ForSaveWord(str); QCOMPARE(success,true); }
void onAdministrator(Event& ev) { bool enabled = !m_administrator.isSelected(); m_usernameLabel.setEnabled(enabled); m_usernameEdit.setEnabled(enabled); if (!enabled) m_usernameEdit.setText(L"root"); }
int main(int argc, char * argv[]) { QApplication app(argc, argv); TextEdit *textEdit = new TextEdit; textEdit->show(); return app.exec(); }
void Test2Test::testCase2() { TextEdit txt; QString result =txt.textSize("12"); bool success; if (result=="12") success=true; else success=false; QCOMPARE(true,success); }
int main( int argc, char ** argv ) { QApplication a( argc, argv ); TextEdit * mw = new TextEdit(); mw->setCaption( "Richtext Editor" ); mw->resize( 640, 800 ); mw->show(); a.connect( &a, SIGNAL( lastWindowClosed() ), &a, SLOT( quit() ) ); return a.exec(); }
void MainWindow::NewFileSlot() { TextEdit* child = CreateTextEdit(); child->NewFile(); //child->show(); tabWidget->addTab(child, child->GetCurrentFileName()); int index = tabWidget->count(); //tabWidget->addTab(child, child->GetCurrentFileName()); tabWidget->setTabToolTip(index, child->GetCurrentFile()); }
void Test2Test::testCase6() { TextEdit txt; bool success; int result =txt.textStyle(0); if (result==0) success=true; else success=false; QCOMPARE(true,success); }
int main( int argc, char ** argv ) { Q_INIT_RESOURCE(textedit); QApplication a( argc, argv ); TextEdit mw; mw.resize( 700, 800 ); mw.show(); return a.exec(); }
int main(int argc, char *argv[]) { GWindow::initX(); TextEdit *editor = new TextEdit(); if (argc > 1) { editor->loadFile(argv[1]); } editor->createWindow(); XSetIOErrorHandler(&IOErrorHandler); GWindow::messageLoop(); GWindow::closeX(); delete editor; }
void create() { if ( created ) return; created = TRUE; TextEdit *te = new TextEdit( stack ); te->load( "textdrawing/example.html" ); stack->addWidget( te, categoryOffset() + 0 ); QString home = QDir( "../../doc/html/index.html" ).absPath(); HelpWindow *w = new HelpWindow( home, ".", stack, "helpviewer" ); stack->addWidget( w, categoryOffset() + 1 ); }
int FrostEdit::tabWidgetContains(TabWidget* wid, Document* doc) { for(int i = 0; i < wid->count(); i++) { TextEdit* edit = toTextEdit(wid->widget(i)); if(edit == nullptr) continue; if(toDocument(edit->document()) == doc) { return i; } } return -1; }
void OpenFolderAction::doExeute(ActionTabWidget* tablWidget) { TextEdit* textEdit = static_cast<TextEdit*>( tablWidget->currentWidget()); if (textEdit) { QString textPath = textEdit->getPath(); int stuffIndex = textPath.lastIndexOf("/"); textPath = textPath.left(stuffIndex); QDesktopServices::openUrl(QUrl(textPath)); } }
void ScriptTextEditor::reload(bool p_soft) { TextEdit *te = code_editor->get_text_edit(); Ref<Script> scr = get_edited_script(); if (scr.is_null()) return; scr->set_source_code(te->get_text()); bool soft = p_soft || scr->get_instance_base_type()=="EditorPlugin"; //always soft-reload editor plugins scr->get_language()->reload_tool_script(scr,soft); }
void FrostEdit::updateTabHeader(Document* doc, bool b) { for(TabWidgetFrame* tab: mTabWidgetFrames) { for(int i = 0; i < tab->tabWidget()->count(); i++) { TextEdit* edit = toTextEdit(tab->tabWidget()->widget(i)); if(edit != nullptr && edit->document() == doc) { tab->tabWidget()->setTabText(i, doc->getDynamicName()); changeTitle(tab->tabWidget(), i); } } } }
int main(int argc, char **argv) { Q_INIT_RESOURCE(textedit); QApplication a(argc, argv); a.setStyle(new MyProxyStyle); TextEdit mw; mw.resize(700, 800); mw.show(); //... }
int FrostEdit::openEditors(Document* doc) { int open = 0; for(TabWidgetFrame* tab: mTabWidgetFrames) { for(int i = 0; i < tab->tabWidget()->count(); i++) { TextEdit* edit = toTextEdit(tab->tabWidget()->widget(i)); if(edit != NULL && edit->document() == doc) open++; } } return open; }
int main( int argc, char ** argv ) { Q_INIT_RESOURCE(textedit); QApplication a( argc, argv ); //QApplication::setStyle(QStyleFactory::create("cleanlooks")); //QApplication::setPalette(QApplication::style()->standardPalette()); TextEdit mw; mw.resize( 700, 800 ); mw.show(); return a.exec(); }
void configure_editor(TextEdit &edit, Font &normalFont, Font &hotFont, int preferredWidth) { edit.FocusEnter.connect(Bind(&Widget::setFont, &edit, hotFont)); edit.FocusLeave.connect(Bind(&Widget::setFont, &edit, normalFont)); edit.MouseEnter.connect(Bind(&Widget::setBgColor, &edit, Color(255, 255, 190))); edit.MouseLeave.connect(Bind(&Widget::setBgColor, &edit, Color::White)); edit.MouseEnter.connect(Bind(&Widget::invalidate, &edit, true)); edit.MouseLeave.connect(Bind(&Widget::invalidate, &edit, true)); edit.setFont(normalFont); edit.setPreferredSize(Size(preferredWidth, edit.getPreferredSize().h)); }
int testmain() { char c; TextEdit t; char* buf; while ((c = getchar()) != '.') { if (c == EOF) return(0); t.handle(c); printf("\n== %s ==\n", buf = t.GetPrintText()); delete buf; } return(0); }
/** * switch all the colours to something a little more battlescape appropriate. */ void State::applyBattlescapeTheme() { for (std::vector<Surface*>::iterator i = _surfaces.begin(); i != _surfaces.end(); ++i) { Window* window = dynamic_cast<Window*>(*i); if (window) { window->setColor(Palette::blockOffset(0)-1); window->setHighContrast(true); window->setBackground(_game->getResourcePack()->getSurface("TAC00.SCR")); } Text* text = dynamic_cast<Text*>(*i); if (text) { text->setColor(Palette::blockOffset(0)-1); text->setHighContrast(true); } TextButton* button = dynamic_cast<TextButton*>(*i); if (button) { button->setColor(Palette::blockOffset(0)-1); button->setHighContrast(true); } TextEdit* edit = dynamic_cast<TextEdit*>(*i); if (edit) { edit->setColor(Palette::blockOffset(0)-1); edit->setHighContrast(true); } TextList* list = dynamic_cast<TextList*>(*i); if (list) { list->setColor(Palette::blockOffset(0)-1); list->setArrowColor(Palette::blockOffset(0)); list->setHighContrast(true); } ArrowButton *arrow = dynamic_cast<ArrowButton*>(*i); if (arrow) { arrow->setColor(Palette::blockOffset(0)); } Slider *slider = dynamic_cast<Slider*>(*i); if (slider) { slider->setColor(Palette::blockOffset(0)-1); slider->setHighContrast(true); } } }
void FrostEdit::on_actionSave_triggered() { TextEdit* e = toTextEdit(mCurrentTabWidget->currentWidget()); Document* doc = toDocument(e->document()); if(doc->getFileInfo().isFile()) { mDocumentWatcher->removePath(doc->getFullPath()); doc->save(); mDocumentWatcher->addPath(doc->getFullPath()); } else { QString prevPath = doc->getFullPath(); on_actionSave_As_triggered(); if(mCompiledFile == prevPath) mCompiledFile = doc->getFullPath(); } updateTabHeader(doc, doc->isModified()); }
void onChangeRate() { int rate = m_rate.getValue(); m_rateEdit.setText(convert_to<String>(rate)); m_webcam.setPreviewRate(rate); }
int main( int argc, char ** argv ) { QApplication a( argc, argv ); a.setOrganizationName("Oasis Test Reader"); a.setOrganizationDomain("QTuser"); a.setApplicationName("Mini Office"); #if QT_VERSION >= 0x040500 qDebug() << "### QT_VERSION main -> " << QT_VERSION; qDebug() << "### QT_VERSION_STR main -> " << QT_VERSION_STR; #endif TextEdit mw; mw.resize( 700, 450 ); mw.show(); QObject::connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit())); return a.exec(); }