Ejemplo n.º 1
0
ChewingEditor::ChewingEditor(QWidget *parent)
    :QMainWindow{parent}
    ,ui_{new Ui::ChewingEditor}
    ,model_{new UserphraseModel{this}}
    ,proxyModel_{new UserphraseSortFilterProxyModel{this}}
    ,fileDialog_{new QFileDialog{this}}
{
    ui_.get()->setupUi(this);

    proxyModel_->setSourceModel(model_);
    ui_.get()->userphraseView->setModel(proxyModel_);

    setupFileSelection();
    setupImport();
    setupExport();
    setupAdd();
    setupRemove();
    setupRefresh();
    setupFilter();
    setupAboutWidget();
}
Ejemplo n.º 2
0
ChewingEditor::ChewingEditor(QWidget *parent)
    :QMainWindow{parent}
    ,ui_{new Ui::ChewingEditor}
    ,model_{new UserphraseModel{this}}
    ,proxyModel_{new UserphraseSortFilterProxyModel{this}}
    ,fileDialog_{new QFileDialog{this}}
{
    ui_.get()->setupUi(this);

    proxyModel_->setSourceModel(model_);
    ui_.get()->userphraseView->setModel(proxyModel_);

    setupFileSelection();
    setupImport();
    setupExport();
    setupAdd();
    setupRemove();
    setupRefresh();
    setupUndo();
    setupFilter();
    setupAboutWidget();

    // exit action
    shortcut_exit_ = new QShortcut(QKeySequence::Quit, this);
    connect(
        shortcut_exit_, SIGNAL(activated()),
        SLOT(close())
    );
    connect(
        ui_.get()->actionExit, SIGNAL(triggered()),
        SLOT(close())
    );

    // modify action
    shortcut_modify_ = new QShortcut(Qt::Key_Return, this);
    connect(
        shortcut_modify_, SIGNAL(activated()),
        ui_.get()->userphraseView, SLOT(showModifyUserphraseDialog())
    );
}