本文整理汇总了C++中QSpinBox::selectAll方法的典型用法代码示例。如果您正苦于以下问题:C++ QSpinBox::selectAll方法的具体用法?C++ QSpinBox::selectAll怎么用?C++ QSpinBox::selectAll使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QSpinBox
的用法示例。
在下文中一共展示了QSpinBox::selectAll方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setEditorData
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
void USplata_zaborg_Delegate::setEditorData(QWidget *editor,
const QModelIndex &index) const
{
QSpinBox *spinbox;
int value;
if ((index.column() == durationColumn_1)
|| (index.column() == durationColumn_3)
|| (index.column() == durationColumn_4)
|| (index.column() == durationColumn_5)
|| (index.column() == durationColumn_6)
|| (index.column() == durationColumn_7)) {
value = index.model()->data(index, Qt::DisplayRole).toInt();
spinbox = qobject_cast<QSpinBox *>(editor);
spinbox->setValue(value);
spinbox->selectAll();
}
else if (index.column() == durationColumn_2) {
double sum = index.model()->data(index, Qt::DisplayRole).toDouble();
QDoubleSpinBox *double_spinbox = qobject_cast<QDoubleSpinBox *>(editor);
double_spinbox->setValue(sum);
double_spinbox->selectAll();
}
else {
QSqlRelationalDelegate::setEditorData(editor, index);
}
}
示例2: setEditorData
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
void UKvyt_Delegate::setEditorData(QWidget *editor,
const QModelIndex &index) const
{
if (index.column() == durationColumn_2) {
double value = index.model()->data(index, Qt::DisplayRole).toDouble();
QDoubleSpinBox *double_spinbox = qobject_cast<QDoubleSpinBox *>(editor);
double_spinbox->setValue(value);
double_spinbox->selectAll();
}
else if ( (index.column() == durationColumn_3) || (index.column() == durationColumn_4) ){
QDateEdit * dateEdit = qobject_cast<QDateEdit *>(editor);
dateEdit->setDate( index.model()->data(index, Qt::DisplayRole).toDate() );
dateEdit->setCurrentSection( QDateTimeEdit::DaySection );
dateEdit->stepBy( 0 );
}
else if ((index.column() == durationColumn_5) || (index.column() == durationColumn_1)){
int value = index.model()->data(index, Qt::DisplayRole).toInt();
QSpinBox *spinbox = qobject_cast<QSpinBox *>(editor);
spinbox->setValue(value);
spinbox->selectAll();
}
else {
QSqlRelationalDelegate::setEditorData(editor, index);
}
}
示例3: createValueEditorImpl
QWidget* QtnPropertyDelegateInt::createValueEditorImpl(QWidget* parent, const QRect& rect, QtnInplaceInfo* inplaceInfo)
{
QSpinBox* spinBox = new QSpinBox(parent);
spinBox->setGeometry(rect);
new QtnPropertyIntSpinBoxHandler(owner(), *spinBox);
if (inplaceInfo)
{
spinBox->selectAll();
}
return spinBox;
}
示例4: setEditorData
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
void USpravy_subs_Delegate::setEditorData(QWidget *editor,
const QModelIndex &index) const
{
QSpinBox *spinbox;
int value;
if ( (index.column() == durationColumn_1)
|| (index.column() == durationColumn_2)
|| (index.column() == durationColumn_4)
|| (index.column() == durationColumn_3)
|| (index.column() == durationColumn_5)
|| (index.column() == durationColumn_6)) {
value = index.model()->data(index, Qt::DisplayRole).toInt();
spinbox = qobject_cast<QSpinBox *>(editor);
spinbox->setValue(value);
spinbox->selectAll();
}
else {
QSqlRelationalDelegate::setEditorData(editor, index);
}
}
示例5: eventFilter
bool IpAddressWidget::eventFilter(QObject *object, QEvent *event)
{
//如果object不是四个输入框,则返回
int nowBox = -1;
for(int i=0; i<4; i++)
{
if( object == m_SpinBox[i] )
nowBox = i;
}
if( -1 == nowBox )
return false;
QSpinBox *spinBox = dynamic_cast<QSpinBox*>(object);
//如果某个输入框得到了输入焦点,则将它们设为全选状态
if( QEvent::FocusIn == event->type() )
{
spinBox->selectAll();
return true;
}
//如果输入框内的字符为0,则清空该输入框(防止用户输入多个0)
else if( QEvent::KeyPress == event->type() )
{
QString context = spinBox->text();
if( "0" == context )
spinBox->clear();
}
//如果输入框内的数字大于25,则输入焦点自动跳到下一格
else if( QEvent::KeyRelease == event->type() )
{
int val = spinBox->value();
if( spinBox->value() > 25 && nowBox < 3 )
{
m_SpinBox[nowBox+1]->setFocus();
}
}
return false;
}