1
0
Kandrashin Denis 13 жил өмнө
parent
commit
442c687f52
2 өөрчлөгдсөн 22 нэмэгдсэн , 3 устгасан
  1. 21 3
      source/fb2main.cpp
  2. 1 0
      source/fb2main.h

+ 21 - 3
source/fb2main.cpp

@@ -195,7 +195,7 @@ void MainWindow::createActions()
     tool->addAction(act);
 
     icon = QIcon::fromTheme("document-save-as");
-    act = new QAction(tr("Save &As..."), this);
+    act = new QAction(icon, tr("Save &As..."), this);
     act->setShortcuts(QKeySequence::SaveAs);
     act->setStatusTip(tr("Save the document under a new name"));
     connect(act, SIGNAL(triggered()), this, SLOT(fileSaveAs()));
@@ -272,26 +272,37 @@ void MainWindow::createActions()
     icon = QIcon::fromTheme("format-text-bold", QIcon(":/images/textbold.png"));
     actionTextBold = act = new QAction(icon, tr("Bold"), this);
     act->setShortcuts(QKeySequence::Bold);
+    act->setCheckable(true);
+    connect(act, SIGNAL(triggered()), this, SLOT(textBold()));
     menu->addAction(act);
     tool->addAction(act);
 
     icon = QIcon::fromTheme("format-text-italic", QIcon(":/images/textitalic.png"));
-    actionTextBold = act = new QAction(icon, tr("Italic"), this);
+    actionTextItalic = act = new QAction(icon, tr("Italic"), this);
     act->setShortcuts(QKeySequence::Italic);
+    act->setCheckable(true);
+    connect(act, SIGNAL(triggered()), this, SLOT(textItalic()));
     menu->addAction(act);
     tool->addAction(act);
 
     icon = QIcon::fromTheme("format-text-underline", QIcon(":/images/textunderline.png"));
-    actionTextBold = act = new QAction(icon, tr("Underline"), this);
+    actionTextUnder = act = new QAction(icon, tr("Underline"), this);
     act->setShortcuts(QKeySequence::Underline);
+    act->setCheckable(true);
+    connect(act, SIGNAL(triggered()), this, SLOT(textUnder()));
     menu->addAction(act);
     tool->addAction(act);
 
     icon = QIcon::fromTheme("format-text-strikethrough", QIcon(":/images/textstrike.png"));
     actionTextStrike = act = new QAction(icon, tr("Strikethrough"), this);
+    act->setCheckable(true);
+    connect(act, SIGNAL(triggered()), this, SLOT(textStrike()));
     menu->addAction(act);
     tool->addAction(act);
 
+    // format-text-subscript
+    // format-text-superscript
+
     menu = menuBar()->addMenu(tr("&View"));
 
     QAction * actText = act = new QAction(tr("&Text"), this);
@@ -559,6 +570,13 @@ void MainWindow::textItalic()
     mergeFormatOnWordOrSelection(fmt);
 }
 
+void MainWindow::textStrike()
+{
+    QTextCharFormat fmt;
+    fmt.setFontStrikeOut(actionTextStrike->isChecked());
+    mergeFormatOnWordOrSelection(fmt);
+}
+
 void MainWindow::mergeFormatOnWordOrSelection(const QTextCharFormat &format)
 {
     if (!textEdit) return;

+ 1 - 0
source/fb2main.h

@@ -41,6 +41,7 @@ private slots:
     void textBold();
     void textUnder();
     void textItalic();
+    void textStrike();
 
     void currentCharFormatChanged(const QTextCharFormat &format);
     void cursorPositionChanged();