Handle spin boxes in set/get text.

git-svn-id: http://yate.null.ro/svn/yate/trunk@2254 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
marian 2008-10-07 15:39:47 +00:00
parent 3cdaf88017
commit eae9fffeaa
1 changed files with 12 additions and 2 deletions

View File

@ -69,7 +69,8 @@ public:
AbstractButton = 10, AbstractButton = 10,
Slider = 11, Slider = 11,
ProgressBar = 12, ProgressBar = 12,
Unknown = 13, // Unknown type SpinBox = 13,
Unknown = 14, // Unknown type
Action, // QAction descendant Action, // QAction descendant
CustomTable, // QtTable descendant CustomTable, // QtTable descendant
Missing // Invalid pointer Missing // Invalid pointer
@ -143,6 +144,8 @@ public:
{ return static_cast<QSlider*>(m_widget); } { return static_cast<QSlider*>(m_widget); }
inline QProgressBar* progressBar() inline QProgressBar* progressBar()
{ return static_cast<QProgressBar*>(m_widget); } { return static_cast<QProgressBar*>(m_widget); }
inline QSpinBox* spinBox()
{ return static_cast<QSpinBox*>(m_widget); }
inline QtTable* customTable() inline QtTable* customTable()
{ return qobject_cast<QtTable*>(m_widget); } { return qobject_cast<QtTable*>(m_widget); }
inline QAction* action() inline QAction* action()
@ -301,7 +304,8 @@ String QtWidget::s_types[QtWidget::Unknown] = {
"QLineEdit", "QLineEdit",
"QAbstractButton", "QAbstractButton",
"QSlider", "QSlider",
"QProgressBar" "QProgressBar",
"QSpinBox"
}; };
// Connect a sender's signal to a receiver's slot // Connect a sender's signal to a receiver's slot
@ -717,6 +721,9 @@ bool QtWindow::setText(const String& name, const String& text,
case QtWidget::Action: case QtWidget::Action:
w.action()->setText(QtClient::setUtf8(text)); w.action()->setText(QtClient::setUtf8(text));
return true; return true;
case QtWidget::SpinBox:
w.spinBox()->setValue(text.toInteger());
return true;
} }
// Handle some known base classes having a setText() method // Handle some known base classes having a setText() method
@ -1282,6 +1289,9 @@ bool QtWindow::getText(const String& name, String& text, bool richText)
case QtWidget::Action: case QtWidget::Action:
QtClient::getUtf8(text,w.action()->text()); QtClient::getUtf8(text,w.action()->text());
return true; return true;
case QtWidget::SpinBox:
text = w.spinBox()->value();
return true;
default: default:
if (w.inherits(QtWidget::AbstractButton)) { if (w.inherits(QtWidget::AbstractButton)) {
QtClient::getUtf8(text,w.abstractButton()->text()); QtClient::getUtf8(text,w.abstractButton()->text());