示例#1
0
void ShortcutsImpl::slotDefault()
{
    QMainWindow *dial = new QMainWindow;
    Ui::Main ui;
    ui.setupUi(dial);

    QList<QObject*> childrens = dial->children();
    QListIterator<QObject*> iterator(childrens);

    while( iterator.hasNext() )
    {
        QObject *object = iterator.next();
        QAction *action = qobject_cast<QAction*>(object);

        if (action)
        {
            QString text = action->text().remove("&");
            QString shortcut = action->shortcut();
            QList<QTableWidgetItem *> listFind = table->findItems(text , Qt::MatchExactly);
            if( listFind.count() )
                table->item(table->row(listFind.first()), 1)->setText(shortcut);
        }
    }

    delete dial;
}
image_sink make_gui_sink(int argc, char** argv, uint32_t iterations) {
  auto promise = std::make_shared<std::promise<image_sink>>();
  auto f = promise->get_future();
  std::thread{[=] {
    int ac = argc;
    QApplication app{ac, argv};
    QMainWindow window;
    Ui::Main main;
    main.setupUi(&window);
    window.resize(default_width, default_height);
    main.mainWidget->image_label()->newPalette(iterations, default_color);
    promise->set_value(caf::actor_cast<image_sink>(main.mainWidget->as_actor()));
    window.show();
    app.quitOnLastWindowClosed();
    app.exec();
  }}.detach();
  return f.get();
}