diff --git a/RedPandaIDE/settingsdialog/editorfontwidget.cpp b/RedPandaIDE/settingsdialog/editorfontwidget.cpp index 70ffa2cf..76eb8e8d 100644 --- a/RedPandaIDE/settingsdialog/editorfontwidget.cpp +++ b/RedPandaIDE/settingsdialog/editorfontwidget.cpp @@ -29,7 +29,7 @@ Qt::ItemFlags EditorFontModel::flags(const QModelIndex &index) const { Qt::ItemFlags flags = Qt::NoItemFlags; if (index.isValid()) { - flags = Qt::ItemIsEnabled | Qt::ItemIsDragEnabled | Qt::ItemIsEditable | Qt::ItemIsSelectable ; + flags = Qt::ItemIsEnabled | Qt::ItemIsDragEnabled | Qt::ItemIsSelectable ; } else if (index.row() == -1) { // -1 means it's a drop target? flags = Qt::ItemIsDropEnabled; @@ -213,3 +213,15 @@ void EditorFontWidget::updateIcons(const QSize &/*size*/) { pIconsManager->setIcon(ui->btnMoveFontDown, IconsManager::ACTION_MISC_MOVEDOWN); pIconsManager->setIcon(ui->btnMoveFontToBottom, IconsManager::ACTION_MISC_MOVEBOTTOM); } + +void EditorFontWidget::on_lstFontList_doubleClicked(const QModelIndex &index) +{ + if (!index.isValid()) + return; + EditorFontDialog dlg(this); + dlg.setFontFamily(mModel.data(index, Qt::DisplayRole).toString()); + if (dlg.exec() == QDialog::Accepted) { + mModel.setData(index, dlg.fontFamily()); + } +} + diff --git a/RedPandaIDE/settingsdialog/editorfontwidget.h b/RedPandaIDE/settingsdialog/editorfontwidget.h index 7c07f176..89531dcc 100644 --- a/RedPandaIDE/settingsdialog/editorfontwidget.h +++ b/RedPandaIDE/settingsdialog/editorfontwidget.h @@ -57,6 +57,8 @@ private slots: // void on_chkForceFixedFontWidth_toggled(bool checked); + void on_lstFontList_doubleClicked(const QModelIndex &index); + private: Ui::EditorFontWidget *ui; EditorFontModel mModel; diff --git a/RedPandaIDE/widgets/editorfontdialog.ui b/RedPandaIDE/widgets/editorfontdialog.ui index 1afae595..b847ef48 100644 --- a/RedPandaIDE/widgets/editorfontdialog.ui +++ b/RedPandaIDE/widgets/editorfontdialog.ui @@ -15,7 +15,20 @@ - + + + + 0 + 0 + + + + false + + + 15 + + @@ -39,6 +52,12 @@ + + + 0 + 0 + + Qt::Horizontal