本文整理汇总了C++中QSpinBox::setWrapping方法的典型用法代码示例。如果您正苦于以下问题:C++ QSpinBox::setWrapping方法的具体用法?C++ QSpinBox::setWrapping怎么用?C++ QSpinBox::setWrapping使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QSpinBox
的用法示例。
在下文中一共展示了QSpinBox::setWrapping方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createEditor
QWidget* NumericValueChooserDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const
{
if (!index.isValid()) {
return QStyledItemDelegate::createEditor(parent, option, index);
}
QSpinBox * editor = new QSpinBox(parent);
editor->setMinimum(_min);
editor->setMaximum(_max);
editor->setWrapping(true);
connect(editor, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this,
&NumericValueChooserDelegate::onValueChanged);
return editor;
}
示例2: main
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QSpinBox *spinBox = new QSpinBox;
spinBox->setRange(1,100); //set range of spinBox's values
spinBox->setSuffix(" MB"); // set suffix after our values
spinBox->setButtonSymbols(QSpinBox::PlusMinus);
spinBox->setWrapping(true); // loop mode activating
spinBox->setFixedHeight(100);
spinBox->setFixedWidth(100);
spinBox->move(430,340);
spinBox->show();
return a.exec();
}
示例3: main
int main(int argc, char** argv) {
QApplication app(argc, argv);
QWidget wgt;
wgt.setWindowTitle("Spin Boxes");
QLabel* plblCount = new QLabel("Megabytes:");
QLabel* plblDate = new QLabel("Date and Time:");
QLabel* plblValid = new QLabel("Name:");
QSpinBox spb;
spb.setRange(1, 100);
spb.setSuffix(" MB");
spb.setButtonSymbols(QSpinBox::PlusMinus);
spb.setWrapping(true);
spb.resize(100, 30);
plblCount->setBuddy(&spb);
QObject::connect(&spb, SIGNAL(valueChanged(const QString&)), plblCount, SLOT(setText(const QString&)));
QDateTimeEdit dateTimeEdit(QDateTime::currentDateTime());
QLineEdit* ptxt = new QLineEdit;
NameValidator* pnameValidator = new NameValidator(ptxt);
ptxt->setValidator(pnameValidator);
plblValid->setBuddy(ptxt);
QVBoxLayout* pvbxLayout = new QVBoxLayout;
pvbxLayout->addWidget(plblCount);
pvbxLayout->addWidget(&spb);
pvbxLayout->addWidget(plblDate);
pvbxLayout->addWidget(&dateTimeEdit);
pvbxLayout->addWidget(plblValid);
pvbxLayout->addWidget(ptxt);
wgt.setLayout(pvbxLayout);
wgt.resize(230, 180);
wgt.show();
return app.exec();
}
示例4: iconPixmap
QFrame *AbstractController::telexFrame()
{
/**
* Telextext QFrame
**/
QFrame *telexFrame = new QFrame( this );
QHBoxLayout *telexLayout = new QHBoxLayout( telexFrame );
telexLayout->setSpacing( 0 ); telexLayout->setMargin( 0 );
CONNECT( THEMIM->getIM(), teletextPossible( bool ),
telexFrame, setVisible( bool ) );
/* On/Off button */
QToolButton *telexOn = new QToolButton;
setupButton( telexOn );
BUTTON_SET_BAR2( telexOn, toolbar/tv, qtr( "Teletext Activation" ) );
telexOn->setEnabled( false );
telexOn->setCheckable( true );
telexLayout->addWidget( telexOn );
/* Teletext Activation and set */
CONNECT( telexOn, clicked( bool ),
THEMIM->getIM(), activateTeletext( bool ) );
CONNECT( THEMIM->getIM(), teletextPossible( bool ),
telexOn, setEnabled( bool ) );
/* Transparency button */
QToolButton *telexTransparent = new QToolButton;
setupButton( telexTransparent );
BUTTON_SET_BAR2( telexTransparent, toolbar/tvtelx,
qtr( "Toggle Transparency " ) );
telexTransparent->setEnabled( false );
telexTransparent->setCheckable( true );
telexLayout->addWidget( telexTransparent );
/* Transparency change and set */
CONNECT( telexTransparent, clicked( bool ),
THEMIM->getIM(), telexSetTransparency( bool ) );
CONNECT( THEMIM->getIM(), teletextTransparencyActivated( bool ),
telexTransparent, setChecked( bool ) );
/* Page setting */
QSpinBox *telexPage = new QSpinBox( telexFrame );
telexPage->setRange( 100, 899 );
telexPage->setValue( 100 );
telexPage->setAccelerated( true );
telexPage->setWrapping( true );
telexPage->setAlignment( Qt::AlignRight );
telexPage->setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Minimum );
telexPage->setEnabled( false );
telexLayout->addWidget( telexPage );
/* Contextual & Index Buttons */
QSignalMapper *contextButtonMapper = new QSignalMapper( this );
QToolButton *contextButton = NULL;
int i_iconminsize = __MAX( 16, telexOn->minimumHeight() );
QPixmap iconPixmap( i_iconminsize, i_iconminsize );
iconPixmap.fill( Qt::transparent );
QPainter iconPixmapPainter( &iconPixmap );
QLinearGradient iconPixmapPainterGradient( iconPixmap.rect().center() / 2,
iconPixmap.rect().center() );
#define CREATE_CONTEXT_BUTTON(color, key) \
iconPixmapPainterGradient.setColorAt( 0, QColor( color ).lighter(150) );\
iconPixmapPainterGradient.setColorAt( 1.0, QColor( color ) );\
iconPixmapPainter.setBrush( iconPixmapPainterGradient );\
iconPixmapPainter.drawEllipse( iconPixmap.rect().adjusted( 4, 4, -5, -5 ) );\
contextButton = new QToolButton();\
setupButton( contextButton );\
contextButton->setIcon( iconPixmap );\
contextButton->setEnabled( false );\
contextButtonMapper->setMapping( contextButton, key << 16 );\
CONNECT( contextButton, clicked(), contextButtonMapper, map() );\
CONNECT( contextButtonMapper, mapped( int ),\
THEMIM->getIM(), telexSetPage( int ) );\
CONNECT( THEMIM->getIM(), teletextActivated( bool ), contextButton, setEnabled( bool ) );\
telexLayout->addWidget( contextButton )
CREATE_CONTEXT_BUTTON("grey", 'i'); /* index */
CREATE_CONTEXT_BUTTON("red", 'r');
CREATE_CONTEXT_BUTTON("green", 'g');
CREATE_CONTEXT_BUTTON("yellow", 'y');
CREATE_CONTEXT_BUTTON("blue", 'b');
#undef CREATE_CONTEXT_BUTTON
/* Page change and set */
CONNECT( telexPage, valueChanged( int ),
THEMIM->getIM(), telexSetPage( int ) );
CONNECT( THEMIM->getIM(), newTelexPageSet( int ),
telexPage, setValue( int ) );
CONNECT( THEMIM->getIM(), teletextActivated( bool ), telexPage, setEnabled( bool ) );
CONNECT( THEMIM->getIM(), teletextActivated( bool ), telexTransparent, setEnabled( bool ) );
CONNECT( THEMIM->getIM(), teletextActivated( bool ), telexOn, setChecked( bool ) );
return telexFrame;
}
示例5: QFrame
QFrame *AbstractController::telexFrame()
{
/**
* Telextext QFrame
**/
QFrame *telexFrame = new QFrame( this );
QHBoxLayout *telexLayout = new QHBoxLayout( telexFrame );
telexLayout->setSpacing( 0 ); telexLayout->setMargin( 0 );
CONNECT( THEMIM->getIM(), teletextPossible( bool ),
telexFrame, setVisible( bool ) );
/* On/Off button */
QToolButton *telexOn = new QToolButton;
setupButton( telexOn );
BUTTON_SET_BAR2( telexOn, toolbar/tv, qtr( "Teletext Activation" ) );
telexOn->setEnabled( false );
telexOn->setCheckable( true );
telexLayout->addWidget( telexOn );
/* Teletext Activation and set */
CONNECT( telexOn, clicked( bool ),
THEMIM->getIM(), activateTeletext( bool ) );
CONNECT( THEMIM->getIM(), teletextPossible( bool ),
telexOn, setEnabled( bool ) );
/* Transparency button */
QToolButton *telexTransparent = new QToolButton;
setupButton( telexTransparent );
BUTTON_SET_BAR2( telexTransparent, toolbar/tvtelx,
qtr( "Toggle Transparency " ) );
telexTransparent->setEnabled( false );
telexTransparent->setCheckable( true );
telexLayout->addWidget( telexTransparent );
/* Transparency change and set */
CONNECT( telexTransparent, clicked( bool ),
THEMIM->getIM(), telexSetTransparency( bool ) );
CONNECT( THEMIM->getIM(), teletextTransparencyActivated( bool ),
telexTransparent, setChecked( bool ) );
/* Page setting */
QSpinBox *telexPage = new QSpinBox( telexFrame );
telexPage->setRange( 0, 999 );
telexPage->setValue( 100 );
telexPage->setAccelerated( true );
telexPage->setWrapping( true );
telexPage->setAlignment( Qt::AlignRight );
telexPage->setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Minimum );
telexPage->setEnabled( false );
telexLayout->addWidget( telexPage );
/* Page change and set */
CONNECT( telexPage, valueChanged( int ),
THEMIM->getIM(), telexSetPage( int ) );
CONNECT( THEMIM->getIM(), newTelexPageSet( int ),
telexPage, setValue( int ) );
CONNECT( THEMIM->getIM(), teletextActivated( bool ), telexPage, setEnabled( bool ) );
CONNECT( THEMIM->getIM(), teletextActivated( bool ), telexTransparent, setEnabled( bool ) );
CONNECT( THEMIM->getIM(), teletextActivated( bool ), telexOn, setChecked( bool ) );
return telexFrame;
}
示例6: createEditor
QWidget* TbInterfacesDelegate::createEditor( QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index ) const
{
Q_UNUSED(option);
QWidget *w = NULL;
#if defined(_WIN32) || defined(HAVE_PCAP_CREATE)
gint buffer = DEFAULT_CAPTURE_BUFFER_SIZE;
#endif
guint snap = WTAP_MAX_PACKET_SIZE;
GList *links = NULL;
if (index.column() > 1) {
interface_t device;
QTableWidgetItem *it = table->item(index.row(), INTERFACE);
QString interface_name = it->text();
for (guint i = 0; i < global_capture_opts.all_ifaces->len; i++) {
device = g_array_index(global_capture_opts.all_ifaces, interface_t, i);
#if defined(_WIN32) || defined(HAVE_PCAP_CREATE)
buffer = device.buffer;
#endif
snap = device.snaplen;
links = device.links;
if (interface_name.compare(device.display_name) || device.hidden || device.type == IF_PIPE) {
continue;
} else {
break;
}
}
switch (index.column()) {
case INTERFACE:
break;
case LINK:
{
GList *list;
link_row *temp;
QComboBox *cb = new QComboBox(parent);
for (list=links; list!=NULL; list=g_list_next(list)) {
temp = (link_row*)(list->data);
cb->addItem(QString("%1").arg(temp->name));
}
connect(cb, SIGNAL(currentIndexChanged(QString)), this, SLOT(link_changed(QString)));
w = (QWidget*) cb;
break;
}
case PMODE:
{
// Create the combobox and populate it
QComboBox *cb = new QComboBox(parent);
cb->addItem(QString(tr("enabled")));
cb->addItem(QString(tr("disabled")));
connect(cb, SIGNAL(currentIndexChanged(QString)), this, SLOT(pmode_changed(QString)));
w = (QWidget*) cb;
break;
}
#if defined (HAVE_PCAP_CREATE)
case MONITOR:
{
if (index.data().toString().compare(QString("n/a"))) {
QComboBox *cb = new QComboBox(parent);
cb->addItem(QString(tr("enabled")));
cb->addItem(QString(tr("disabled")));
connect(cb, SIGNAL(currentIndexChanged(QString)), this, SLOT(monitor_changed(QString)));
w = (QWidget*) cb;
}
break;
}
#endif
case SNAPLEN:
{
QSpinBox *sb = new QSpinBox(parent);
sb->setRange(1, 65535);
sb->setValue(snap);
sb->setWrapping(true);
connect(sb, SIGNAL(valueChanged(int)), this, SLOT(snaplen_changed(int)));
w = (QWidget*) sb;
break;
}
#if defined(_WIN32) || defined(HAVE_PCAP_CREATE)
case BUFFER:
{
QSpinBox *sb = new QSpinBox(parent);
sb->setRange(1, 65535);
sb->setValue(buffer);
sb->setWrapping(true);
connect(sb, SIGNAL(valueChanged(int)), this, SLOT(buffer_changed(int)));
w = (QWidget*) sb;
break;
}
#endif
case FILTER:
{
CaptureFilterCombo *cf = new CaptureFilterCombo(parent);
w = (QWidget*) cf;
}
}
}