mirror of
https://github.com/arcan1s/awesome-widgets.git
synced 2025-07-14 14:25:50 +00:00
add html text interaction
This commit is contained in:
@ -80,6 +80,7 @@ private slots:
|
|||||||
void editHddSpeedItem(QListWidgetItem *item);
|
void editHddSpeedItem(QListWidgetItem *item);
|
||||||
void editMountItem(QListWidgetItem *item);
|
void editMountItem(QListWidgetItem *item);
|
||||||
void editTempItem(QListWidgetItem *item);
|
void editTempItem(QListWidgetItem *item);
|
||||||
|
void setFormating();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
QList<QAction *> contextualActions();
|
QList<QAction *> contextualActions();
|
||||||
|
@ -318,6 +318,10 @@ void AwesomeWidget::createConfigurationInterface(KConfigDialog *parent)
|
|||||||
else if (fontStyle == QString("italic"))
|
else if (fontStyle == QString("italic"))
|
||||||
uiAppConfig.comboBox_style->setCurrentIndex(1);
|
uiAppConfig.comboBox_style->setCurrentIndex(1);
|
||||||
uiAppConfig.spinBox_weight->setValue(fontWeight);
|
uiAppConfig.spinBox_weight->setValue(fontWeight);
|
||||||
|
// format page
|
||||||
|
uiWidConfig.kcolorcombo->setColor(fontColor);
|
||||||
|
uiWidConfig.fontComboBox->setCurrentFont(font);
|
||||||
|
uiWidConfig.spinBox->setValue(fontSize);
|
||||||
|
|
||||||
// dataengine
|
// dataengine
|
||||||
QMap<QString, QString> deSettings = readDataEngineConfiguration();
|
QMap<QString, QString> deSettings = readDataEngineConfiguration();
|
||||||
@ -391,6 +395,16 @@ void AwesomeWidget::createConfigurationInterface(KConfigDialog *parent)
|
|||||||
this, SLOT(addNewPkgCommand(QTableWidgetItem *)));
|
this, SLOT(addNewPkgCommand(QTableWidgetItem *)));
|
||||||
connect(uiDEConfig.tableWidget_pkgCommand, SIGNAL(customContextMenuRequested(QPoint)),
|
connect(uiDEConfig.tableWidget_pkgCommand, SIGNAL(customContextMenuRequested(QPoint)),
|
||||||
this, SLOT(contextMenuPkgCommand(QPoint)));
|
this, SLOT(contextMenuPkgCommand(QPoint)));
|
||||||
|
connect(uiWidConfig.pushButton_bold, SIGNAL(clicked(bool)), this, SLOT(setFormating()));
|
||||||
|
connect(uiWidConfig.pushButton_italic, SIGNAL(clicked(bool)), this, SLOT(setFormating()));
|
||||||
|
connect(uiWidConfig.pushButton_underline, SIGNAL(clicked(bool)), this, SLOT(setFormating()));
|
||||||
|
connect(uiWidConfig.pushButton_strike, SIGNAL(clicked(bool)), this, SLOT(setFormating()));
|
||||||
|
connect(uiWidConfig.pushButton_left, SIGNAL(clicked(bool)), this, SLOT(setFormating()));
|
||||||
|
connect(uiWidConfig.pushButton_center, SIGNAL(clicked(bool)), this, SLOT(setFormating()));
|
||||||
|
connect(uiWidConfig.pushButton_right, SIGNAL(clicked(bool)), this, SLOT(setFormating()));
|
||||||
|
connect(uiWidConfig.pushButton_fill, SIGNAL(clicked(bool)), this, SLOT(setFormating()));
|
||||||
|
connect(uiWidConfig.pushButton_applyFont, SIGNAL(clicked(bool)), this, SLOT(setFormating()));
|
||||||
|
|
||||||
|
|
||||||
connect(parent, SIGNAL(okClicked()), this, SLOT(configAccepted()));
|
connect(parent, SIGNAL(okClicked()), this, SLOT(configAccepted()));
|
||||||
connect(parent, SIGNAL(applyClicked()), this, SLOT(configAccepted()));
|
connect(parent, SIGNAL(applyClicked()), this, SLOT(configAccepted()));
|
||||||
@ -695,3 +709,39 @@ void AwesomeWidget::editTempItem(QListWidgetItem *item)
|
|||||||
|
|
||||||
uiAdvancedConfig.listWidget_tempDevice->openPersistentEditor(item);
|
uiAdvancedConfig.listWidget_tempDevice->openPersistentEditor(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void AwesomeWidget::setFormating()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Sender" << sender();
|
||||||
|
|
||||||
|
QString selectedText = uiWidConfig.textEdit_elements->textCursor().selectedText();
|
||||||
|
if (sender() == uiWidConfig.pushButton_bold)
|
||||||
|
uiWidConfig.textEdit_elements->insertPlainText(QString("<b>") + selectedText + QString("</b>"));
|
||||||
|
else if (sender() == uiWidConfig.pushButton_italic)
|
||||||
|
uiWidConfig.textEdit_elements->insertPlainText(QString("<i>") + selectedText + QString("</i>"));
|
||||||
|
else if (sender() == uiWidConfig.pushButton_underline)
|
||||||
|
uiWidConfig.textEdit_elements->insertPlainText(QString("<u>") + selectedText + QString("</u>"));
|
||||||
|
else if (sender() == uiWidConfig.pushButton_strike)
|
||||||
|
uiWidConfig.textEdit_elements->insertPlainText(QString("<s>") + selectedText + QString("</s>"));
|
||||||
|
else if (sender() == uiWidConfig.pushButton_left)
|
||||||
|
uiWidConfig.textEdit_elements->insertPlainText(QString("<p align=\"left\">") + selectedText + QString("</p>"));
|
||||||
|
else if (sender() == uiWidConfig.pushButton_center)
|
||||||
|
uiWidConfig.textEdit_elements->insertPlainText(QString("<p align=\"center\">") + selectedText + QString("</p>"));
|
||||||
|
else if (sender() == uiWidConfig.pushButton_right)
|
||||||
|
uiWidConfig.textEdit_elements->insertPlainText(QString("<p align=\"right\">") + selectedText + QString("</p>"));
|
||||||
|
else if (sender() == uiWidConfig.pushButton_fill)
|
||||||
|
uiWidConfig.textEdit_elements->insertPlainText(QString("<p align=\"justify\">") + selectedText + QString("</p>"));
|
||||||
|
else if (sender() == uiWidConfig.pushButton_applyFont) {
|
||||||
|
QString color = uiWidConfig.kcolorcombo->color().name();
|
||||||
|
QString font = uiWidConfig.fontComboBox->currentFont().family();
|
||||||
|
QString size = QString::number(uiWidConfig.spinBox->value());
|
||||||
|
uiWidConfig.textEdit_elements->insertPlainText(QString("<font color=\"%1\" face=\"%2\" size=\"%3\">")
|
||||||
|
.arg(color).arg(font).arg(size) +
|
||||||
|
selectedText + QString("</font>"));
|
||||||
|
uiWidConfig.kcolorcombo->setColor(uiAppConfig.kcolorcombo->color());
|
||||||
|
uiWidConfig.fontComboBox->setCurrentFont(uiAppConfig.fontComboBox->currentFont());
|
||||||
|
uiWidConfig.spinBox->setValue(uiAppConfig.spinBox_size->value());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -171,8 +171,7 @@ void AwesomeWidget::updateTooltip()
|
|||||||
}
|
}
|
||||||
toolTipScene->addLine(x1, y1, x2, y2, pen);
|
toolTipScene->addLine(x1, y1, x2, y2, pen);
|
||||||
}
|
}
|
||||||
if (trueKeys[i] == QString("down"))
|
if (trueKeys[i] == QString("down")) down = true;
|
||||||
down = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
toolTip.setImage(QPixmap::grabWidget(toolTipView));
|
toolTip.setImage(QPixmap::grabWidget(toolTipView));
|
||||||
|
@ -45,6 +45,179 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="layput_mainFormating">
|
||||||
|
<item>
|
||||||
|
<spacer name="spacer_mainFormatingLeft">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="pushButton_bold">
|
||||||
|
<property name="icon">
|
||||||
|
<iconset theme="format-text-bold">
|
||||||
|
<normaloff/>
|
||||||
|
</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="shortcut">
|
||||||
|
<string>Ctrl+B</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="pushButton_italic">
|
||||||
|
<property name="icon">
|
||||||
|
<iconset theme="format-text-italic">
|
||||||
|
<normaloff/>
|
||||||
|
</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="shortcut">
|
||||||
|
<string>Ctrl+I, Return</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="pushButton_underline">
|
||||||
|
<property name="icon">
|
||||||
|
<iconset theme="format-text-underline">
|
||||||
|
<normaloff/>
|
||||||
|
</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="shortcut">
|
||||||
|
<string>Ctrl+U</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="pushButton_strike">
|
||||||
|
<property name="icon">
|
||||||
|
<iconset theme="format-text-strikethrough">
|
||||||
|
<normaloff/>
|
||||||
|
</iconset>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="spacer_mainFormatingCenter">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeType">
|
||||||
|
<enum>QSizePolicy::Fixed</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="pushButton_left">
|
||||||
|
<property name="icon">
|
||||||
|
<iconset theme="format-justify-left">
|
||||||
|
<normaloff/>
|
||||||
|
</iconset>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="pushButton_center">
|
||||||
|
<property name="icon">
|
||||||
|
<iconset theme="format-justify-center">
|
||||||
|
<normaloff/>
|
||||||
|
</iconset>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="pushButton_right">
|
||||||
|
<property name="icon">
|
||||||
|
<iconset theme="format-justify-right">
|
||||||
|
<normaloff/>
|
||||||
|
</iconset>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="pushButton_fill">
|
||||||
|
<property name="icon">
|
||||||
|
<iconset theme="format-justify-fill">
|
||||||
|
<normaloff/>
|
||||||
|
</iconset>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="spacer_mainFormatingRight">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="layout_font">
|
||||||
|
<item>
|
||||||
|
<spacer name="spacer_fontLeft">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="KColorCombo" name="kcolorcombo"/>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QFontComboBox" name="fontComboBox"/>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QSpinBox" name="spinBox"/>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="pushButton_applyFont">
|
||||||
|
<property name="text">
|
||||||
|
<string>Insert</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="spacer_fontRight">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QTextEdit" name="textEdit_elements">
|
<widget class="QTextEdit" name="textEdit_elements">
|
||||||
<property name="lineWrapMode">
|
<property name="lineWrapMode">
|
||||||
@ -57,6 +230,13 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
<customwidgets>
|
||||||
|
<customwidget>
|
||||||
|
<class>KColorCombo</class>
|
||||||
|
<extends>QComboBox</extends>
|
||||||
|
<header>kcolorcombo.h</header>
|
||||||
|
</customwidget>
|
||||||
|
</customwidgets>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections/>
|
<connections/>
|
||||||
</ui>
|
</ui>
|
||||||
|
Reference in New Issue
Block a user