1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
|
int KeyboardWidget::createBtn(QHBoxLayout* row,
int span,
char normal,
char shift,
char caps,
char alt,
char capAlt,
bool autoRepeat)
{
int id = m_allButtons.count();
KeyboardWidgetButton* btn = new KeyboardWidgetButton(this,
id,
c2s(normal),
c2s(shift),
c2s(caps),
c2s(alt),
c2s(capAlt));
row->addWidget(btn, span);
btn->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
btn->setAutoRepeat(autoRepeat);
VERIFY(connect(btn, SIGNAL(takeAction(int)),
this, SLOT(buttonClicked(int))));
m_allButtons.append(btn);
return id;
}
int KeyboardWidget::createBtn(QHBoxLayout* row,
int span,
bool checkable,
int key,
const char* text,
bool autoRepeat)
{
int id = m_allButtons.count();
KeyboardWidgetButton* btn = new KeyboardWidgetButton(this, id, key, QLatin1String(text));
row->addWidget(btn, span);
btn->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
btn->setCheckable(checkable);
btn->setAutoRepeat(autoRepeat);
VERIFY(connect(btn, SIGNAL(takeAction(int)),
this, SLOT(buttonClicked(int))));
m_allButtons.append(btn);
return id;
}
|