add of overline function
This commit is contained in:
parent
b9aa141763
commit
0b4f2a172c
1
data.qrc
1
data.qrc
@ -20,5 +20,6 @@
|
||||
<file>data/images/underline.png</file>
|
||||
<file>data/images/add.png</file>
|
||||
<file>data/images/font-color.png</file>
|
||||
<file>data/images/overline.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
||||
BIN
data/images/overline.png
Normal file
BIN
data/images/overline.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.7 KiB |
@ -305,3 +305,23 @@ void MainWindow::on_actionColor_triggered()
|
||||
this->setColor();
|
||||
}
|
||||
|
||||
void MainWindow::setOverline(){
|
||||
QWidget *focused = QApplication::focusWidget();
|
||||
QPlainTextEdit* plainTextEdit = qobject_cast<QPlainTextEdit*>(focused);
|
||||
|
||||
if (plainTextEdit) {
|
||||
QTextCursor cursor = plainTextEdit->textCursor();
|
||||
if (cursor.hasSelection()) {
|
||||
QTextCharFormat format;
|
||||
QFont font = plainTextEdit->currentCharFormat().font();
|
||||
font.setOverline(!font.overline());
|
||||
format.setFont(font);
|
||||
cursor.mergeCharFormat(format);
|
||||
}
|
||||
}
|
||||
}
|
||||
void MainWindow::on_actionOverline_triggered()
|
||||
{
|
||||
this->setOverline();
|
||||
}
|
||||
|
||||
|
||||
@ -30,6 +30,7 @@ public:
|
||||
void setItalic();
|
||||
void setUnderline();
|
||||
void setColor();
|
||||
void setOverline();
|
||||
|
||||
private slots:
|
||||
void on_pushButton_clicked();
|
||||
@ -55,6 +56,8 @@ private slots:
|
||||
|
||||
void on_actionColor_triggered();
|
||||
|
||||
void on_actionOverline_triggered();
|
||||
|
||||
private:
|
||||
Ui::MainWindow *ui;
|
||||
QString currentFile;
|
||||
|
||||
@ -246,7 +246,7 @@
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<iconset resource="data.qrc">
|
||||
<normaloff>:/data/images/data/images/add.png</normaloff>:/data/images/data/images/add.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
@ -346,6 +346,7 @@
|
||||
<addaction name="actionBold"/>
|
||||
<addaction name="actionItalic"/>
|
||||
<addaction name="actionUnderline"/>
|
||||
<addaction name="actionOverline"/>
|
||||
</widget>
|
||||
<action name="actionOpen">
|
||||
<property name="text">
|
||||
@ -373,7 +374,7 @@
|
||||
</action>
|
||||
<action name="actionNewFile">
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<iconset resource="data.qrc">
|
||||
<normaloff>:/data/images/data/images/new.png</normaloff>:/data/images/data/images/new.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
@ -385,7 +386,7 @@
|
||||
</action>
|
||||
<action name="actionSaveFile">
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<iconset resource="data.qrc">
|
||||
<normaloff>:/data/images/data/images/save_as.png</normaloff>:/data/images/data/images/save_as.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
@ -397,7 +398,7 @@
|
||||
</action>
|
||||
<action name="actionSaveAsFile">
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<iconset resource="data.qrc">
|
||||
<normaloff>:/data/images/data/images/save.png</normaloff>:/data/images/data/images/save.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
@ -409,7 +410,7 @@
|
||||
</action>
|
||||
<action name="actionPrintFile">
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<iconset resource="data.qrc">
|
||||
<normaloff>:/data/images/data/images/print.png</normaloff>:/data/images/data/images/print.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
@ -421,7 +422,7 @@
|
||||
</action>
|
||||
<action name="actionEditCopy">
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<iconset resource="data.qrc">
|
||||
<normaloff>:/data/images/data/images/copy.png</normaloff>:/data/images/data/images/copy.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
@ -433,7 +434,7 @@
|
||||
</action>
|
||||
<action name="actionEditPaste">
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<iconset resource="data.qrc">
|
||||
<normaloff>:/data/images/data/images/paste.png</normaloff>:/data/images/data/images/paste.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
@ -445,7 +446,7 @@
|
||||
</action>
|
||||
<action name="actionEditCut">
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<iconset resource="data.qrc">
|
||||
<normaloff>:/data/images/data/images/cut.png</normaloff>:/data/images/data/images/cut.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
@ -457,7 +458,7 @@
|
||||
</action>
|
||||
<action name="actionEditUndo">
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<iconset resource="data.qrc">
|
||||
<normaloff>:/data/images/data/images/edit_undo.png</normaloff>:/data/images/data/images/edit_undo.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
@ -469,7 +470,7 @@
|
||||
</action>
|
||||
<action name="actionEditRedo">
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<iconset resource="data.qrc">
|
||||
<normaloff>:/data/images/data/images/edit_redo.png</normaloff>:/data/images/data/images/edit_redo.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
@ -481,7 +482,7 @@
|
||||
</action>
|
||||
<action name="actionopenFile">
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<iconset resource="data.qrc">
|
||||
<normaloff>:/data/images/data/images/open.png</normaloff>:/data/images/data/images/open.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
@ -493,7 +494,7 @@
|
||||
</action>
|
||||
<action name="actionBold">
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<iconset resource="data.qrc">
|
||||
<normaloff>:/data/images/data/images/bold.png</normaloff>:/data/images/data/images/bold.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
@ -502,7 +503,7 @@
|
||||
</action>
|
||||
<action name="actionItalic">
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<iconset resource="data.qrc">
|
||||
<normaloff>:/data/images/data/images/italic.png</normaloff>:/data/images/data/images/italic.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
@ -511,7 +512,7 @@
|
||||
</action>
|
||||
<action name="actionUnderline">
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<iconset resource="data.qrc">
|
||||
<normaloff>:/data/images/data/images/underline.png</normaloff>:/data/images/data/images/underline.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
@ -520,14 +521,25 @@
|
||||
</action>
|
||||
<action name="actionColor">
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<iconset resource="data.qrc">
|
||||
<normaloff>:/data/images/data/images/font-color.png</normaloff>:/data/images/data/images/font-color.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Color</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionOverline">
|
||||
<property name="icon">
|
||||
<iconset resource="data.qrc">
|
||||
<normaloff>:/data/images/data/images/overline.png</normaloff>:/data/images/data/images/overline.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Overline</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<resources/>
|
||||
<resources>
|
||||
<include location="data.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user