Exemplo n.º 1
0
CustomToolbarCreator::CustomToolbarCreator(QWidget* parent,
                                           QMap<QString, QAction*>& action_map)
    : QFrame(parent)
    , ui(new Ui::CustomToolbarCreator)
    , a_map(action_map)
{
    ui->setupUi(this);

    ui->chosen_actions->setDragDropMode(QAbstractItemView::InternalMove);

    ui->offered_actions->setSortingEnabled(true);

    ui->offered_actions->fromActionMap(a_map);

    connect(ui->add_button, SIGNAL(released()), this, SLOT(addChosenAction()));
    connect(ui->remove_button, SIGNAL(released()), this, SLOT(removeChosenAction()));

    connect(ui->offered_actions, SIGNAL(itemDoubleClicked(QListWidgetItem*)),
            this, SLOT(addChosenAction(QListWidgetItem*)));
    connect(ui->chosen_actions, SIGNAL(itemDoubleClicked(QListWidgetItem*)),
            this, SLOT(removeChosenAction(QListWidgetItem*)));

    connect(ui->add_widget_button, SIGNAL(released()), this, SLOT(addWidget()));
    connect(ui->remove_widget_button, SIGNAL(released()), this, SLOT(removeWidget()));

    connect(ui->combo, SIGNAL(activated(QString)), this, SLOT(setLists(QString)));

    connect(ui->save_button, SIGNAL(released()), parent, SLOT(accept()));
}
Exemplo n.º 2
0
CustomToolbarCreator::CustomToolbarCreator(QWidget* parent,
                                           QMap<QString, QAction*>& action_map,
                                           LC_ActionGroupManager* agm)
    : QFrame(parent)
    , ui(new Ui::CustomToolbarCreator)
    , a_map(action_map)
    , ag_manager(agm)
{
    ui->setupUi(this);

    foreach (auto ag, ag_manager->findChildren<QActionGroup*>())
    {
        ui->categories_combobox->addItem(ag->objectName());
    }
    ui->categories_combobox->setCurrentIndex(-1);
    ui->chosen_actions->setDragDropMode(QAbstractItemView::InternalMove);

    ui->offered_actions->setSortingEnabled(true);

    ui->offered_actions->fromActionMap(a_map);

    connect(ui->add_button, SIGNAL(released()), this, SLOT(addChosenAction()));
    connect(ui->remove_button, SIGNAL(released()), this, SLOT(removeChosenAction()));

    connect(ui->offered_actions, SIGNAL(itemDoubleClicked(QListWidgetItem*)),
            this, SLOT(addChosenAction(QListWidgetItem*)));
    connect(ui->chosen_actions, SIGNAL(itemDoubleClicked(QListWidgetItem*)),
            this, SLOT(removeChosenAction(QListWidgetItem*)));

    connect(ui->add_widget_button, SIGNAL(released()), this, SLOT(addWidget()));
    connect(ui->remove_widget_button, SIGNAL(released()), this, SLOT(removeWidget()));

    connect(ui->combo, SIGNAL(activated(QString)), this, SLOT(setLists(QString)));

    connect(ui->save_button, SIGNAL(released()), this, SLOT(create()));

    connect(ui->categories_combobox, SIGNAL(activated(QString)), this, SLOT(setCategory(QString)));
}