Exemplo n.º 1
0
TabButton::TabButton(QWidget *parent) :
    QPushButton(parent), isLeftBtnHold(false)
{
    setFlat(true);
    setCheckable(true);
    setAutoExclusive(true);
    setAutoDefault(false);
    setAcceptDrops(true);

    parentHeight = QPushButton::sizeHint().height();

    label = new QLabel(this);
    label->setPixmap(WulforUtil::getInstance()->getPixmap(WulforUtil::eiEDITDELETE).scaled(CLOSEPXWIDTH, CLOSEPXWIDTH, Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
    label->setFixedSize(QSize(LABELWIDTH, LABELWIDTH));
    label->setAlignment(Qt::AlignCenter | Qt::AlignVCenter);

    px_label = new QLabel(this);
    px_label->setFixedSize(QSize(LABELWIDTH, LABELWIDTH));
    px_label->setAlignment(Qt::AlignCenter | Qt::AlignVCenter);

    installEventFilter(this);
    label->installEventFilter(this);

    updateGeometry();
}
Exemplo n.º 2
0
AtomButton::AtomButton(DrawingCanvas* d, const char* label)
{
    _label = label;
    _canvas = d;
    
    int dimension1 = 18;
    int dimension2 = 18;

    QSize icon_box(dimension1, dimension2);
    // Start by drawing the button icon
    QPixmap icon(icon_box);
    icon.fill(Atom::labelToColor.value(_label).value<QColor>());
    QPainter painter(&icon);
    QString text(_label);
    QFont font;
    font.setPointSize(12);
    painter.setFont(font);
    painter.drawText(QRectF(0, 0, dimension1, dimension2), Qt::AlignCenter, text);

    // Now make the button and set it up
    setIcon(icon);
    setText(text);
    setIconSize(icon_box);
    setAutoExclusive(true);

    connect(this, SIGNAL(clicked()), this, SLOT(setAtomColor()));
    connect(this, SIGNAL(clicked()), this, SLOT(toggle()));
}
Exemplo n.º 3
0
TowerButton::TowerButton(quint8 towerType, QString icone, QWidget *parent) :
    QPushButton(QIcon(icone), "", parent), m_towerType(towerType), m_icone(icone)
{
    setAutoExclusive(true);
    setFixedSize(100,100);
    setCheckable(true);
    connect(this, SIGNAL(clicked()), this, SLOT(onClick()));
}
Exemplo n.º 4
0
QcrRadioButton::QcrRadioButton(const QString& _name, const QString& text, QcrCell<bool>* cell)
    : QcrSingleValue<bool> {_name, cell}
    , QRadioButton{text}
{
    doSetValue(cell_->val());
    setAutoExclusive(false);
    QRadioButton::connect(this, _SLOT_(QRadioButton,toggled,bool), [this](bool val)->void {
            onChangedValue(val); });
}
Exemplo n.º 5
0
QcrRadioButton::QcrRadioButton(const QString& _name, const QString& text, bool val)
    : QcrSingleValue<bool> {_name, val}
    , QRadioButton{text}
{
    doSetValue(cell_->val());
    setAutoExclusive(false); // TODO provide int-valued Qcr wrapper for exclusive radio buttons
    QRadioButton::connect(this, _SLOT_(QRadioButton,toggled,bool), [this,_name](bool val)->void {
            onChangedValue(val); });
}
Exemplo n.º 6
0
RadioChoiceFieldWidget::RadioChoiceFieldWidget(QMutex* mutex, Poppler::FormFieldButton* formField, QWidget* parent) : QRadioButton(parent),
    m_mutex(mutex),
    m_formField(formField)
{
    LOCK_FORM_FIELD

    s_siblings.insert(qMakePair(m_mutex, m_formField->id()), this);

    setAutoExclusive(false);
    setChecked(m_formField->state());

    connect(this, SIGNAL(toggled(bool)), SLOT(on_toggled(bool)));
    connect(this, SIGNAL(toggled(bool)), SIGNAL(wasModified()));
}
int QAbstractButton::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QWidget::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: pressed(); break;
        case 1: released(); break;
        case 2: clicked((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 3: clicked(); break;
        case 4: toggled((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 5: setIconSize((*reinterpret_cast< const QSize(*)>(_a[1]))); break;
        case 6: animateClick((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 7: animateClick(); break;
        case 8: click(); break;
        case 9: toggle(); break;
        case 10: setChecked((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 11: setOn((*reinterpret_cast< bool(*)>(_a[1]))); break;
        }
        _id -= 12;
    }
#ifndef QT_NO_PROPERTIES
      else if (_c == QMetaObject::ReadProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: *reinterpret_cast< QString*>(_v) = text(); break;
        case 1: *reinterpret_cast< QIcon*>(_v) = icon(); break;
        case 2: *reinterpret_cast< QSize*>(_v) = iconSize(); break;
        case 3: *reinterpret_cast< QKeySequence*>(_v) = shortcut(); break;
        case 4: *reinterpret_cast< bool*>(_v) = isCheckable(); break;
        case 5: *reinterpret_cast< bool*>(_v) = isChecked(); break;
        case 6: *reinterpret_cast< bool*>(_v) = autoRepeat(); break;
        case 7: *reinterpret_cast< bool*>(_v) = autoExclusive(); break;
        case 8: *reinterpret_cast< int*>(_v) = autoRepeatDelay(); break;
        case 9: *reinterpret_cast< int*>(_v) = autoRepeatInterval(); break;
        case 10: *reinterpret_cast< bool*>(_v) = isDown(); break;
        }
        _id -= 11;
    } else if (_c == QMetaObject::WriteProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: setText(*reinterpret_cast< QString*>(_v)); break;
        case 1: setIcon(*reinterpret_cast< QIcon*>(_v)); break;
        case 2: setIconSize(*reinterpret_cast< QSize*>(_v)); break;
        case 3: setShortcut(*reinterpret_cast< QKeySequence*>(_v)); break;
        case 4: setCheckable(*reinterpret_cast< bool*>(_v)); break;
        case 5: setChecked(*reinterpret_cast< bool*>(_v)); break;
        case 6: setAutoRepeat(*reinterpret_cast< bool*>(_v)); break;
        case 7: setAutoExclusive(*reinterpret_cast< bool*>(_v)); break;
        case 8: setAutoRepeatDelay(*reinterpret_cast< int*>(_v)); break;
        case 9: setAutoRepeatInterval(*reinterpret_cast< int*>(_v)); break;
        case 10: setDown(*reinterpret_cast< bool*>(_v)); break;
        }
        _id -= 11;
    } else if (_c == QMetaObject::ResetProperty) {
        _id -= 11;
    } else if (_c == QMetaObject::QueryPropertyDesignable) {
        bool *_b = reinterpret_cast<bool*>(_a[0]);
        switch (_id) {
        case 5: *_b = isCheckable(); break;
        }
        _id -= 11;
    } else if (_c == QMetaObject::QueryPropertyScriptable) {
        _id -= 11;
    } else if (_c == QMetaObject::QueryPropertyStored) {
        _id -= 11;
    } else if (_c == QMetaObject::QueryPropertyEditable) {
        _id -= 11;
    } else if (_c == QMetaObject::QueryPropertyUser) {
        _id -= 11;
    }
#endif // QT_NO_PROPERTIES
    return _id;
}
Exemplo n.º 8
0
ButtonWidget::ButtonWidget(QWidget *parent) : QAbstractButton(parent) {
	setAutoExclusive(false);
	clearState();
	QObject::connect(this, SIGNAL(hovered(bool)), this, SLOT(onHovered(bool)));
}