コード例 #1
0
ChooseGeneralDialog::ChooseGeneralDialog(const QStringList &general_names, QWidget *parent)
    :QDialog(parent), free_chooser(NULL)
{
    setWindowTitle(tr("Choose general"));

    QString lord_name;

    QList<const General *> generals;
    foreach(QString general_name, general_names){
        if(general_name.contains("(lord)"))
        {
            general_name.chop(6);
            lord_name = general_name;
            continue;
        }
        const General *general = Sanguosha->getGeneral(general_name);
        generals << general;
    }

    QSignalMapper *mapper = new QSignalMapper(this);
    QList<OptionButton *> buttons;
#ifdef USE_RCC
    QString category("card2");
#else
    QString category("card");
#endif
    QSize icon_size(200*0.8, 290*0.8);
    if(generals.length() > 10){
        category = "big";
        icon_size = QSize(94, 96);
    }

    foreach(const General *general, generals){
        QString icon_path = general->getPixmapPath(category);
        QString caption = Sanguosha->translate(general->objectName());
        OptionButton *button = new OptionButton(icon_path, caption);
        button->setToolTip(general->getSkillDescription());
        button->setIconSize(icon_size);
        buttons << button;

        mapper->setMapping(button, general->objectName());
        connect(button, SIGNAL(double_clicked()), mapper, SLOT(map()));
        connect(button, SIGNAL(double_clicked()), this, SLOT(accept()));

        // special case
        //if(Self->getRoleEnum() == Player::Lord && general->objectName() == "shencaocao")
        //    button->setEnabled(false);
    }
コード例 #2
0
ファイル: moc_QTshot.cpp プロジェクト: quanth29/topolinux
int QTshotWidget::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QMAINWINDOW::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: doHelp(); break;
        case 1: doQuit(); break;
        case 2: doOpen(); break;
        case 3: doNew(); break;
        case 4: doSave(); break;
        case 5: doData(); break;
        case 6: doExport(); break;
        case 7: doExportOK(); break;
        case 8: doOptions(); break;
        case 9: doToggle(); break;
        case 10: doCollapse(); break;
        case 11: doPlan(); break;
        case 12: doExtended(); break;
        case 13: do3D(); break;
        case 14: doCrossSection((*reinterpret_cast< DBlock*(*)>(_a[1])),(*reinterpret_cast< bool(*)>(_a[2])),(*reinterpret_cast< bool(*)>(_a[3]))); break;
        case 15: doCrossSection((*reinterpret_cast< DBlock*(*)>(_a[1])),(*reinterpret_cast< bool(*)>(_a[2]))); break;
        case 16: value_changed((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break;
        case 17: double_clicked((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2])),(*reinterpret_cast< int(*)>(_a[3])),(*reinterpret_cast< const QPoint(*)>(_a[4]))); break;
        }
        _id -= 18;
    }
    return _id;
}
コード例 #3
0
ChooseGeneralDialog::ChooseGeneralDialog(const QList<const General *> &generals, QWidget *parent)
    :QDialog(parent), free_chooser(NULL)
{
    setWindowTitle(tr("Choose general"));

    QSignalMapper *mapper = new QSignalMapper(this);
    QList<OptionButton *> buttons;
    foreach(const General *general, generals){
        QString icon_path = general->getPixmapPath("card");
        QString caption = Sanguosha->translate(general->objectName());
        OptionButton *button = new OptionButton(icon_path, caption);
        button->setToolTip(general->getSkillDescription());
        button->setIconSize(GeneralSize);
        buttons << button;

        mapper->setMapping(button, general->objectName());
        connect(button, SIGNAL(double_clicked()), mapper, SLOT(map()));
        connect(button, SIGNAL(double_clicked()), this, SLOT(accept()));

        // special case
        if(Self->getRoleEnum() == Player::Lord && general->objectName() == "shencaocao"){
            button->setEnabled(false);
        }
    }
コード例 #4
0
ファイル: TreeBrowser.cpp プロジェクト: BijanZarif/coolfluid3
TreeBrowser::TreeBrowser(TreeView * view, QWidget *parent) :
    QWidget(parent),
    m_tree_view(view),
    m_current_index(0)
{
  cf3_assert(view != nullptr);

  m_bt_previous = new QToolButton(this);
  m_bt_next = new QToolButton(this);
  m_menu_next = new QMenu(m_bt_next);
  m_menu_previous = new QMenu(m_bt_previous);
  m_filter = new QLineEdit(this);

  m_buttons_layout = new QGridLayout();
  m_main_layout = new QVBoxLayout(this);

  m_main_layout->setMargin(0);

  m_bt_previous->setArrowType(Qt::LeftArrow);
  m_bt_next->setArrowType(Qt::RightArrow);

  m_bt_next->setMenu(m_menu_next);
  m_bt_previous->setMenu(m_menu_previous);

  m_bt_next->setPopupMode(QToolButton::MenuButtonPopup);
  m_bt_previous->setPopupMode(QToolButton::MenuButtonPopup);

  m_buttons_layout->addWidget(m_bt_previous, 0, 0);
  m_buttons_layout->addWidget(m_bt_next, 0, 1);
  m_buttons_layout->addWidget(m_filter, 0, 2);

  m_buttons_layout->setColumnStretch(2, 10);

  m_main_layout->addLayout(m_buttons_layout);
  m_main_layout->addWidget(m_tree_view);

  connect(m_bt_previous, SIGNAL(clicked()), this, SLOT(previous_clicked()));
  connect(m_bt_next, SIGNAL(clicked()), this, SLOT(next_clicked()));
  connect(m_filter, SIGNAL(textChanged(QString)), this, SLOT(filter_updated(QString)));

  connect(m_tree_view, SIGNAL(item_double_clicked(QModelIndex)),
          this, SLOT(double_clicked(QModelIndex)));

  m_history << m_tree_view->rootIndex();
  this->update_buttons();
}
コード例 #5
0
void OptionButton::mouseDoubleClickEvent(QMouseEvent *){
    emit double_clicked();
}
コード例 #6
0
ファイル: carditem.cpp プロジェクト: unowoo/QSanguosha
void CardItem::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event){
    if(hasFocus()){
        event->accept();
        emit double_clicked();
    }
}
コード例 #7
0
ファイル: tree_widget.hpp プロジェクト: cpplibivl/ivl
	void doubleClicked_(const QModelIndex& index)   { double_clicked(index); }
コード例 #8
0
void HaiQTextEdit::mouseDoubleClickEvent ( QMouseEvent * event ) {
	select_current_word();
	emit double_clicked();
}