FontButton::FontButton (QWidget *w, QFont f) : QPushButton (w) { _font = f; QObject::connect(this, SIGNAL(clicked()), this, SLOT(fontDialog())); setMaximumHeight(25); setFontButton(); setText(tr("Font")); _changed = FALSE; }
LOGFONT Font::ChangeFont(){ CFontDialog fontDialog(&logFont); if (IDOK == fontDialog.DoModal()){ fontDialog.GetCurrentFont(&logFont); int temp = fontDialog.GetSize(); m_pWnd->Invalidate(); } return this->logFont; }
QFont KNFontDialog::getFont(const QFont &defaultFont, QWidget *parent) { //Initial the font dialog. QScopedPointer<KNFontDialog> fontDialog(new KNFontDialog(parent)); //Set the font. fontDialog->setCurrentFont(defaultFont); //Launch the dialog. return (fontDialog->exec()==QDialog::Accepted)? fontDialog->currentFont():defaultFont; }
void PreferencesEditorPage::fontSelectionButtonClicked() { if (!mFontWasChanged) { mFontWasChanged = !mFontWasChanged; } mFontButtonWasPressed = true; QFontDialog fontDialog(this); fontDialog.setModal(true); QFont f; f.fromString(mFont); fontDialog.setCurrentFont(f); fontDialog.exec(); mFont = fontDialog.currentFont().toString(); }
void AppearanceDialog::on_buttonApplicationFont_clicked() { QString id = "Application"; QFontDialog fontDialog(this); fontDialog.setCurrentFont(fontMap->find(id).value()); if(fontDialog.exec() != QDialog::Accepted) return; (*fontMap)[id] = fontDialog.currentFont(); ui->labelApplicationFont->setText(fontDialog.currentFont().family()); if(isInit) return; Config()->emitFontsUpdated(); GuiUpdateAllViews(); }
QFont KNFontDialog::getFont(QWidget *parent, const QString &title, const QFont &initialFont) { //Generate a font dialog. QScopedPointer<KNFontDialog> fontDialog(new KNFontDialog(parent)); //Set the title and initial font. fontDialog->setWindowTitle(title.isEmpty()?tr("Font"):title); //Set the initial font. fontDialog->setInitialFont(initialFont); //Launch the font dialog. Return the result font if accept the tweak. if(QDialog::Accepted==fontDialog->exec()) { return fontDialog->resultFont(); } return initialFont; }
void CodeEditor::contextMenuEvent(QContextMenuEvent *event){ QMenu *menu = this->createStandardContextMenu(); menu->addAction(beautifyAction); menu->addAction(findAction); menu->addAction(findReplaceAction); QAction *editFontAction = new QAction("Edit font...",this); connect(editFontAction,SIGNAL(triggered()),this,SLOT(fontDialog())); menu->addAction(editFontAction); if(!example_.isEmpty()){ QAction *insertExampleAction = new QAction("Insert example code",this); connect(insertExampleAction,SIGNAL(triggered()),this,SLOT(insertExample())); menu->addAction(insertExampleAction); } menu->exec(event->globalPos()); }
void DialogDisplaySettings::on_pushButton_font6_clicked() { fontDialog(6); }
void MainWindow::createActions() { newAct = new QAction(QIcon(":/images/filenew.png"), tr("&New"), this); newAct->setShortcut(tr("Ctrl+N")); newAct->setStatusTip(tr("Create a new file")); connect(newAct, SIGNAL(triggered()), this, SLOT(newFile())); closeAct = new QAction(QIcon(":/images/fileclose.png"), tr("&Close"), this); #ifndef Q_WS_MAC closeAct->setShortcut(tr("Ctrl+F4")); #else closeAct->setShortcut(tr("Ctrl+W")); #endif closeAct->setStatusTip(tr("Close the current file")); connect(closeAct, SIGNAL(triggered()), this, SLOT(closeFile())); openAct = new QAction(QIcon(":/images/fileopen.png"), tr("&Open..."), this); openAct->setShortcut(tr("Ctrl+O")); openAct->setStatusTip(tr("Open an existing file")); connect(openAct, SIGNAL(triggered()), this, SLOT(open())); saveAct = new QAction(QIcon(":/images/filesave.png"), tr("&Save"), this); saveAct->setShortcut(tr("Ctrl+S")); saveAct->setStatusTip(tr("Save the document to disk")); connect(saveAct, SIGNAL(triggered()), this, SLOT(save())); saveAsAct = new QAction(QIcon(":/images/filesaveas.png"), tr("Save &As..."), this); saveAsAct->setStatusTip(tr("Save the document under a new name")); connect(saveAsAct, SIGNAL(triggered()), this, SLOT(saveAs())); exitAct = new QAction(QIcon(":/images/fileexit.png"), tr("E&xit"), this); exitAct->setShortcut(tr("Ctrl+Q")); exitAct->setStatusTip(tr("Exit QSciTE")); connect(exitAct, SIGNAL(triggered()), launcher, SLOT(quitApplication())); undoAct = new QAction(QIcon(":/images/undo.png"), tr("Undo"), this); undoAct->setShortcut(tr("Ctrl+Z")); undoAct->setStatusTip(tr("Undo the last action performed.")); connect(undoAct, SIGNAL(triggered()), this, SLOT(undo())); redoAct = new QAction(QIcon(":/images/redo.png"), tr("Redo"), this); redoAct->setShortcut(tr("Ctrl+Shift+Z")); redoAct->setStatusTip(tr("Redo an action previously undone.")); connect(redoAct, SIGNAL(triggered()), this, SLOT(redo())); cutAct = new QAction(QIcon(":/images/editcut.png"), tr("Cu&t"), this); cutAct->setShortcut(tr("Ctrl+X")); cutAct->setStatusTip(tr("Cut the current selection's contents to the " "clipboard")); connect(cutAct, SIGNAL(triggered()), this, SLOT(editCut())); copyAct = new QAction(QIcon(":/images/editcopy.png"), tr("&Copy"), this); copyAct->setShortcut(tr("Ctrl+C")); copyAct->setStatusTip(tr("Copy the current selection's contents to the " "clipboard")); connect(copyAct, SIGNAL(triggered()), this, SLOT(editCopy())); pasteAct = new QAction(QIcon(":/images/editpaste.png"), tr("&Paste"), this); pasteAct->setShortcut(tr("Ctrl+V")); pasteAct->setStatusTip(tr("Paste the clipboard's contents into the current " "selection")); connect(pasteAct, SIGNAL(triggered()), this, SLOT(editPaste())); prefsAct = new QAction(QIcon(":/images/configure.png"), tr("P&references"), this); // TODO: set shortcut, tip, etc. connect(prefsAct, SIGNAL(triggered()), this, SLOT(globalPrefs())); fontAct = new QAction(QIcon(":/images/font.png"), tr("&Font"), this); //fontAct->setShortcut(tr("")) fontAct->setStatusTip(tr("Set the display font.")); connect(fontAct, SIGNAL(triggered()), this, SLOT(fontDialog())); terminalAct = new QAction(QIcon(":/images/terminal.png"), tr("Terminal"), this); terminalAct->setStatusTip(tr("Show/hide terminal")); connect(terminalAct, SIGNAL(triggered()), this, SLOT(toggleTerminal())); textDisplayAct = new QAction(QIcon(":/images/font.png"), tr("Text &Display..."), this); connect(textDisplayAct, SIGNAL(triggered()), this, SLOT(textDisplay())); aboutAct = new QAction(tr("&About QSciTE"), this); aboutAct->setStatusTip(tr("Show QSciTE's About box")); connect(aboutAct, SIGNAL(triggered()), this, SLOT(about())); aboutQtAct = new QAction(tr("About &Qt"), this); aboutQtAct->setStatusTip(tr("Show the Qt library's About box")); connect(aboutQtAct, SIGNAL(triggered()), qApp, SLOT(aboutQt())); nextAct = new QAction(QIcon(":/images/nextTab.png"), tr("Forward"), this); nextAct->setStatusTip(tr("Change to the next open document")); nextAct->setShortcut(tr("Alt+Right")); connect(nextAct, SIGNAL(triggered()), this, SLOT(nextDoc())); prevAct = new QAction(QIcon(":/images/prevTab.png"), tr("Back"), this); prevAct->setStatusTip(tr("Change to the previous open document")); prevAct->setShortcut(tr("Alt+Left")); connect(prevAct, SIGNAL(triggered()), this, SLOT(prevDoc())); cutAct->setEnabled(false); copyAct->setEnabled(false); convertEndings = new QAction(tr("&Convert Line End Characters"), this); connect(convertEndings, SIGNAL(triggered()), this, SLOT(convertEols())); lineEndCr = new QAction(tr("&CR (old Macintosh)"), this); lineEndCr->setCheckable(true); connect(lineEndCr, SIGNAL(triggered()), this, SLOT(setEolCr())); lineEndLf = new QAction(tr("&LF (Unix)"), this); lineEndLf->setCheckable(true); connect(lineEndLf, SIGNAL(triggered()), this, SLOT(setEolLf())); lineEndCrLf = new QAction(tr("CR &+ LF (Windows)"), this); lineEndCrLf->setCheckable(true); connect(lineEndCrLf, SIGNAL(triggered()), this, SLOT(setEolCrLf())); lineEnds = new QActionGroup(this); lineEnds->addAction(lineEndCr); lineEnds->addAction(lineEndLf); lineEnds->addAction(lineEndCrLf); lineEndLf->setChecked(true); showLineEndsAct = new QAction(tr("&Show End of Line"), this); showLineEndsAct->setCheckable(true); connect(showLineEndsAct, SIGNAL(toggled(bool)), this, SLOT(setEolVisibility(bool))); convertIndentAct = new QAction(tr("Convert &Indentation..."), this); connect(convertIndentAct, SIGNAL(triggered()), this, SLOT(convertIndentation())); codeFoldingAct = new QAction(tr("Use Code Folding"), this); codeFoldingAct->setCheckable(true); connect(codeFoldingAct, SIGNAL(triggered()), this, SLOT(toggleFolding())); findTextAct = new QAction(tr("&Find..."), this); findTextAct->setShortcut(tr("Ctrl+F")); connect(findTextAct, SIGNAL(triggered()), this, SLOT(showFindDialog())); replaceTextAct = new QAction(tr("Replace..."), this); replaceTextAct->setShortcut(tr("Ctrl+H")); connect(replaceTextAct, SIGNAL(triggered()), this, SLOT(showReplaceDialog())); //ScriptConsole scriptConsoleAct = new QAction(tr("Script Console"), this); connect(scriptConsoleAct, SIGNAL(triggered()), this, SLOT(showScriptConsole())); newWindowAct = new QAction(QIcon(":/images/newwindow.png"), tr("&New Window"), this); connect(newWindowAct, SIGNAL(triggered()), this, SLOT(newWindow())); lexers = new QActionGroup(this); for (int i = 0; !supportedLexers[i].isEmpty(); ++i) { QAction * tmp = new QAction(tr(supportedLexers[i].toStdString().c_str()), this); tmp->setCheckable(true); connect(tmp, SIGNAL(triggered()), this, SLOT(lexerMenuChanged())); lexers->addAction(tmp); } }