mirror of https://github.com/vitalif/openscad
Change FontDialog button to do "copy to clipboard".
parent
50bf202df1
commit
0760103ac7
|
@ -24,6 +24,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include <QClipboard>
|
||||
#include <QSortFilterProxyModel>
|
||||
|
||||
#include "FontListDialog.h"
|
||||
|
@ -41,9 +42,12 @@ FontListDialog::~FontListDialog()
|
|||
{
|
||||
}
|
||||
|
||||
void FontListDialog::on_pasteButton_clicked()
|
||||
void FontListDialog::on_copyButton_clicked()
|
||||
{
|
||||
font_selected(selection);
|
||||
|
||||
QClipboard *clipboard = QApplication::clipboard();
|
||||
clipboard->setText(selection);
|
||||
}
|
||||
|
||||
void FontListDialog::on_filterLineEdit_textChanged(const QString &text)
|
||||
|
@ -54,7 +58,7 @@ void FontListDialog::on_filterLineEdit_textChanged(const QString &text)
|
|||
void FontListDialog::selection_changed(const QItemSelection ¤t, const QItemSelection &)
|
||||
{
|
||||
if (current.count() == 0) {
|
||||
pasteButton->setEnabled(false);
|
||||
copyButton->setEnabled(false);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -62,12 +66,12 @@ void FontListDialog::selection_changed(const QItemSelection ¤t, const QIte
|
|||
const QString name = model->item(idx.row(), 0)->text();
|
||||
const QString style = model->item(idx.row(), 1)->text();
|
||||
selection = QString("\"%1:style=%2\"").arg(name).arg(style);
|
||||
pasteButton->setEnabled(true);
|
||||
copyButton->setEnabled(true);
|
||||
}
|
||||
|
||||
void FontListDialog::update_font_list()
|
||||
{
|
||||
pasteButton->setEnabled(false);
|
||||
copyButton->setEnabled(false);
|
||||
|
||||
if (proxy) {
|
||||
delete proxy;
|
||||
|
|
|
@ -18,7 +18,7 @@ public:
|
|||
void update_font_list();
|
||||
|
||||
public slots:
|
||||
void on_pasteButton_clicked();
|
||||
void on_copyButton_clicked();
|
||||
void on_filterLineEdit_textChanged(const QString &);
|
||||
void selection_changed(const QItemSelection &, const QItemSelection &);
|
||||
|
||||
|
|
|
@ -34,12 +34,12 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item row="4" column="3">
|
||||
<widget class="QPushButton" name="pasteButton">
|
||||
<widget class="QPushButton" name="copyButton">
|
||||
<property name="toolTip">
|
||||
<string>Paste font selector to Editor Window</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Paste</string>
|
||||
<string>Copy to Clipboard</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
|
@ -126,7 +126,6 @@ private slots:
|
|||
void compileEnded();
|
||||
|
||||
private slots:
|
||||
void pasteText(const QString text);
|
||||
void pasteViewportTranslation();
|
||||
void pasteViewportRotation();
|
||||
void hideEditor();
|
||||
|
|
|
@ -1243,12 +1243,6 @@ void MainWindow::pasteViewportTranslation()
|
|||
cursor.insertText(txt);
|
||||
}
|
||||
|
||||
void MainWindow::pasteText(const QString text)
|
||||
{
|
||||
QTextCursor cursor = editor->textCursor();
|
||||
cursor.insertText(text);
|
||||
}
|
||||
|
||||
void MainWindow::pasteViewportRotation()
|
||||
{
|
||||
QTextCursor cursor = editor->textCursor();
|
||||
|
@ -2292,7 +2286,6 @@ void MainWindow::helpFontInfo()
|
|||
{
|
||||
if (!this->font_list_dialog) {
|
||||
FontListDialog *dialog = new FontListDialog();
|
||||
connect(dialog, SIGNAL(font_selected(QString)), this, SLOT(pasteText(QString)));
|
||||
this->font_list_dialog = dialog;
|
||||
}
|
||||
this->font_list_dialog->update_font_list();
|
||||
|
|
Loading…
Reference in New Issue