本文整理汇总了C++中QPushButton::setAutoRepeat方法的典型用法代码示例。如果您正苦于以下问题:C++ QPushButton::setAutoRepeat方法的具体用法?C++ QPushButton::setAutoRepeat怎么用?C++ QPushButton::setAutoRepeat使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QPushButton
的用法示例。
在下文中一共展示了QPushButton::setAutoRepeat方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: f
/*!
\class QIMPenInput qimpeninput.h
Pen input widget.
*/
QIMPenInput::QIMPenInput( QWidget *parent, const char *name, WFlags wf )
: QFrame( parent, name, wf ), helpDlg(0), profile(0)
{
setFrameStyle( Box | Plain );
profileList.setAutoDelete( true );
matcher = new QIMPenMatch( this );
connect( matcher, SIGNAL(keypress(uint)), this, SLOT(keypress(uint)) );
connect( matcher, SIGNAL(erase()), this, SLOT(erase()) );
QGridLayout *gl = new QGridLayout( this, 5, 2, 1, 0 );
gl->setColStretch( 0, 1 );
wordPicker = new QIMPenWordPick( this );
connect( wordPicker, SIGNAL(wordClicked(const QString&)),
this, SLOT(wordPicked(const QString&)) );
connect( matcher, SIGNAL(matchedCharacters(const QIMPenCharMatchList&)),
this, SLOT(matchedCharacters(const QIMPenCharMatchList&)) );
connect( matcher, SIGNAL(matchedWords(const QIMPenMatch::MatchWordList&)),
wordPicker, SLOT(setWords(const QIMPenMatch::MatchWordList&)) );
QFont f("smallsmooth",9);
QFontInfo fi( f );
wordPicker->setFont( f );
wordPicker->setBackgroundColor( white );
gl->addMultiCellWidget( wordPicker, 0, 0, 0, 1 );
if ( !Global::fixedDawg().root() || !matcher->isWordMatchingEnabled() )
wordPicker->hide();
pw = new QIMPenWidget( this );
gl->addMultiCellWidget( pw, 1, 4, 0, 0 );
int bh = pw->sizeHint().height()/4;
QPushButton *b = new QPushButton( this );
b->setFocusPolicy( NoFocus );
b->setPixmap( QPixmap( (const char **)bs_xpm ) );
b->setFixedHeight(pw->sizeHint().height()-3*bh); // left-over space goes here
b->setAutoRepeat( TRUE );
gl->addWidget( b, 1, 1 );
connect( b, SIGNAL(clicked()), SLOT(backspace()));
b = new QPushButton( this );
b->setFocusPolicy( NoFocus );
b->setPixmap( QPixmap( (const char **)enter_xpm ) );
b->setFixedHeight(bh);
b->setAutoRepeat( TRUE );
gl->addWidget( b, 2, 1 );
connect( b, SIGNAL(clicked()), SLOT(enter()));
helpBtn = new QPushButton( this );
helpBtn->setFocusPolicy( NoFocus );
helpBtn->setPixmap( QPixmap( (const char **)help_xpm ) );
helpBtn->setFixedHeight(bh);
gl->addWidget( helpBtn, 3, 1 );
connect( helpBtn, SIGNAL(clicked()), SLOT(help()));
QPixmap pm( (const char **)pen_xpm );
setupBtn = new QPushButton( this );
setupBtn->setFocusPolicy( NoFocus );
setupBtn->setPixmap( pm );
setupBtn->setFixedHeight(bh);
gl->addWidget( setupBtn, 4, 1 );
connect( setupBtn, SIGNAL(clicked()), SLOT(setup()));
connect( matcher, SIGNAL(removeStroke()), pw, SLOT(removeStroke()) );
connect( pw, SIGNAL(changeCharSet(QIMPenCharSet*)),
matcher, SLOT(setCharSet(QIMPenCharSet*)) );
connect( pw, SIGNAL(changeCharSet(int)),
this, SLOT(selectCharSet(int)) );
connect( pw, SIGNAL(beginStroke()),
matcher, SLOT(beginStroke()) );
connect( pw, SIGNAL(stroke(QIMPenStroke*)),
this, SLOT(strokeEntered(QIMPenStroke*)) );
connect( pw, SIGNAL(stroke(QIMPenStroke*)),
matcher, SLOT(strokeEntered(QIMPenStroke*)) );
shortcutCharSet = 0;
currCharSet = 0;
setupDlg = 0;
profile = 0;
mode = Normal;
loadProfiles();
}
示例2: iconSize
View::View(const QString &name, QWidget *parent)
: QFrame(parent)
{
setFrameStyle(Sunken | StyledPanel);
graphicsView = new GraphicsView(this);
graphicsView->setRenderHint(QPainter::Antialiasing, false);
graphicsView->setDragMode(QGraphicsView::RubberBandDrag);
graphicsView->setOptimizationFlags(QGraphicsView::DontSavePainterState);
graphicsView->setViewportUpdateMode(QGraphicsView::SmartViewportUpdate);
graphicsView->setTransformationAnchor(QGraphicsView::AnchorUnderMouse);
int size = style()->pixelMetric(QStyle::PM_ToolBarIconSize);
QSize iconSize(size, size);
QPushButton *zoomInIcon = new QPushButton;
zoomInIcon->setAutoRepeat(true);
zoomInIcon->setAutoRepeatInterval(33);
zoomInIcon->setAutoRepeatDelay(0);
zoomInIcon->setIcon(QPixmap(":/zoomin.png"));
zoomInIcon->setIconSize(QSize(20,20));
//zoomInIcon->setIconSize(iconSize);
QPushButton *zoomOutIcon = new QPushButton;
zoomOutIcon->setAutoRepeat(true);
zoomOutIcon->setAutoRepeatInterval(33);
zoomOutIcon->setAutoRepeatDelay(0);
zoomOutIcon->setIcon(QPixmap(":/zoomout.png"));
zoomOutIcon->setIconSize(QSize(20,20));
//zoomOutIcon->setIconSize(iconSize);
zoomSlider = new QSlider;
zoomSlider->setMinimum(0);
zoomSlider->setMaximum(500);
zoomSlider->setValue(210);
zoomSlider->setTickPosition(QSlider::TicksRight);
// Zoom slider layout
QVBoxLayout *zoomSliderLayout = new QVBoxLayout;
zoomSliderLayout->addWidget(zoomInIcon);
zoomSliderLayout->addWidget(zoomSlider);
zoomSliderLayout->addWidget(zoomOutIcon);
QToolButton *rotateLeftIcon = new QToolButton;
rotateLeftIcon->setIcon(QPixmap(":images/tool_curved_icon.png"));
rotateLeftIcon->setIconSize(iconSize);
QToolButton *rotateRightIcon = new QToolButton;
rotateRightIcon->setIcon(QPixmap(":/images/toolcurvedicon32.png"));
rotateRightIcon->setIconSize(iconSize);
rotateSlider = new QSlider;
rotateSlider->setOrientation(Qt::Horizontal);
rotateSlider->setMinimum(-360);
rotateSlider->setMaximum(360);
rotateSlider->setValue(0);
rotateSlider->setTickPosition(QSlider::TicksBelow);
// Rotate slider layout
QHBoxLayout *rotateSliderLayout = new QHBoxLayout;
rotateSliderLayout->addWidget(rotateLeftIcon);
rotateSliderLayout->addWidget(rotateSlider);
rotateSliderLayout->addWidget(rotateRightIcon);
resetButton = new QPushButton;
resetButton->setIcon(QPixmap(":/reseticon.png"));
resetButton->setIconSize(QSize(20,20));
//resetButton->setText(tr("0"));
resetButton->setEnabled(false);
// Label layout
layoutName = new QLabel("New Layout");
QHBoxLayout *labelLayout = new QHBoxLayout;
label = new QLabel(name);
label2 = new QLabel(tr("Pointer Mode"));
selectModeButton = new QPushButton;
selectModeButton->setIcon(QPixmap(":/selecticon.png"));
selectModeButton->setIconSize(QSize(20,20));
//selectModeButton->setText(tr("Select"));
selectModeButton->setCheckable(true);
selectModeButton->setChecked(true);
dragModeButton = new QPushButton;
dragModeButton->setIcon(QPixmap(":/handicon.png"));
dragModeButton->setIconSize(QSize(20,20));
//dragModeButton->setMinimumWidth(35);
//dragModeButton->setMinimumHeight(35);
//dragModeButton->setText(tr("Drag"));
dragModeButton->setCheckable(true);
dragModeButton->setChecked(false);
antialiasButton = new QToolButton;
antialiasButton->setText(tr("Antialiasing"));
antialiasButton->setCheckable(true);
antialiasButton->setChecked(false);
openGlButton = new QToolButton;
openGlButton->setText(tr("OpenGL"));
openGlButton->setCheckable(true);
#ifndef QT_NO_OPENGL
openGlButton->setEnabled(QGLFormat::hasOpenGL());
#else
openGlButton->setEnabled(false);
#endif
printButton = new QToolButton;
//.........这里部分代码省略.........
示例3: QGraphicsView
MapGraphicsView::MapGraphicsView()
: QGraphicsView()
{
#ifndef Q_OS_WIN
srand ( time(NULL) );
#endif
m_scaleFactor = 1.;
#ifndef QT_NO_OPENGL
//setViewport(new QGLWidget(QGLFormat(QGL::SampleBuffers)));
#endif
setCacheMode(CacheBackground);
//setViewportUpdateMode(BoundingRectViewportUpdate);
//setRenderHint(QPainter::Antialiasing);
//setTransformationAnchor(AnchorUnderMouse);
#ifdef Q_OS_ANDROID
setTransformationAnchor(QGraphicsView::AnchorViewCenter);
#endif
setResizeAnchor(AnchorViewCenter);
setDragMode(QGraphicsView::ScrollHandDrag);
setRenderHints(QPainter::Antialiasing | QPainter::TextAntialiasing | QPainter::SmoothPixmapTransform );
// if there are ever graphic glitches to be found, remove this again
setOptimizationFlags(QGraphicsView::DontAdjustForAntialiasing | QGraphicsView::DontClipPainter | QGraphicsView::DontSavePainterState);
//setCacheMode(QGraphicsView::CacheBackground);
//setViewportUpdateMode(QGraphicsView::BoundingRectViewportUpdate);
setViewportUpdateMode(QGraphicsView::SmartViewportUpdate);
setOptimizationFlags(QGraphicsView::DontSavePainterState);
setFrameStyle(QFrame::NoFrame);
#ifdef Q_OS_ANDROID
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
#endif
QWidget *viewport = new QWidget();
QVBoxLayout *vbox = new QVBoxLayout(viewport);
QHBoxLayout *hbox;
hbox = new QHBoxLayout();
{
hbox->setSpacing(0);
hbox->addStretch(1);
m_hudLabel = new QLabel();
hbox->addWidget(m_hudLabel);
vbox->addLayout(hbox);
}
vbox->addStretch(1);
hbox = new QHBoxLayout();
{
hbox->setSpacing(0);
hbox->addStretch(1);
m_statusLabel = new QLabel();
hbox->addWidget(m_statusLabel);
m_statusLabel->hide();
hbox->addStretch(1);
}
vbox->addLayout(hbox);
hbox = new QHBoxLayout();
{
hbox->setSpacing(0);
hbox->addStretch(1);
QPushButton *btn;
{
btn = new QPushButton("-");
btn->setStyleSheet("QPushButton {"
#ifdef Q_OS_ANDROID
"background: url(':/data/images/android-zoom-minus-button.png'); width: 117px; height: 47px; "
#else
"background: url(':/data/images/zoom-minus-button.png'); width: 58px; height: 24px; "
#endif
"padding:0; margin:0; border:none; color: transparent; outline: none; }");
btn->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
btn->setAutoRepeat(true);
btn->setMaximumSize(117,48);
connect(btn, SIGNAL(clicked()), this, SLOT(zoomOut()));
hbox->addWidget(btn);
}
{
btn = new QPushButton("+");
btn->setStyleSheet("QPushButton {"
#ifdef Q_OS_ANDROID
"background: url(':/data/images/android-zoom-plus-button.png'); width: 117px; height: 47px; "
#else
//.........这里部分代码省略.........
示例4: evogaControls
ComponentUIViewer EvoRobotViewer::evogaControls( QWidget* parent, Qt::WindowFlags flags ) {
QWidget* widget = new QWidget( parent, flags );
QGridLayout* lay = new QGridLayout( widget );
//lay->setContentsMargins(0,0,0,0);
// --- visualizzaione del trial corrente, e step corrente
infoEvoga = new QLabel( "Information", widget );
infoEvoga->setStyleSheet( "QLabel { font: bold normal large \"Courier\" }" );
lay->addWidget( infoEvoga, 0, 0, 1, 2 );
QPushButton* bt = new QPushButton( "Do Step", widget );
bt->setAutoRepeat(true);
bt->setEnabled( false );
connect( bt, SIGNAL(clicked(bool)), ga, SLOT(doNextStep()) );
QCheckBox* cb = new QCheckBox( "Step by Step Mode", widget );
connect( cb, SIGNAL(clicked(bool)), ga, SLOT(enableStepByStep(bool)) );
connect( cb, SIGNAL(clicked(bool)), bt, SLOT(setEnabled(bool)) );
lay->addWidget( cb, 1, 0 );
lay->addWidget( bt, 1, 1 );
bt = new QPushButton( "Next Trial", widget );
connect( bt, SIGNAL(clicked()), this, SLOT(evogaNextTrial()) );
lay->addWidget( bt, 2, 0, 1, 2 );
//----- Skip Trial... Go to Trial number N
// slider to setup the delay for slowing down the simulation
QLabel* lb = new QLabel( "Simulation Throttle - speed regulator", widget );
lay->addWidget( lb, 3, 0, 1, 2 );
simulationThrottle = new QSlider( widget );
simulationThrottle->setMinimum( 0 );
simulationThrottle->setMaximum( 100 );
simulationThrottle->setMinimumHeight( 200 );
simulationThrottle->setOrientation( Qt::Vertical );
int currDelay = ga->getEvoRobotExperiment()->getStepDelay();
simulationThrottle->setValue( floor(13.0*std::log((float)currDelay)) );
connect( simulationThrottle, SIGNAL(valueChanged(int)), this, SLOT(onSimulationThrottleChanges(int)) );
lay->addWidget( simulationThrottle, 4, 0, 3, 1 );
lb = new QLabel( "slow", widget );
lay->addWidget( lb, 4, 1 );
QString str = "Running as fast as possible";
if ( currDelay > 0 ) {
QString extra;
if ( fabs( currDelay/1000.0 - ga->getEvoRobotExperiment()->getWorldTimeStep() ) < 0.01 ) {
extra = "Running approximately at real time";
}
str = QString("Speed: %1 frames/second [%2 ms]\n%3")
.arg(1000.0/currDelay)
.arg(currDelay)
.arg(extra);
}
simulationSpeed = new QLabel( str, widget );
lay->addWidget( simulationSpeed, 5, 1 );
lb = new QLabel( "fast", widget );
lay->addWidget( lb, 6, 1 );
return ComponentUIViewer( widget, "Evoga Controls" );
}
示例5: locateLocal
HighScore::HighScore
(
QWidget* parent,
const char* name
)
:
QDialog( parent, name, true, 0 )
{
// form the target name
filename = locateLocal("appdata", highScoreFilename);
QFont fnt;
// Number
QLabel* qtarch_Label_3;
qtarch_Label_3 = new QLabel( this, "Label_3" );
qtarch_Label_3->setGeometry( 10, 45, 30, 30 );
qtarch_Label_3->setFrameStyle( 50 );
qtarch_Label_3->setText( i18n("Pos") );
qtarch_Label_3->setAlignment( AlignCenter );
fnt = qtarch_Label_3->font();
fnt.setBold(true);
qtarch_Label_3->setFont(fnt);
// name
QLabel* qtarch_Label_4;
qtarch_Label_4 = new QLabel( this, "Label_4" );
qtarch_Label_4->setGeometry( 40, 45, 150, 30 );
qtarch_Label_4->setFrameStyle( 50 );
qtarch_Label_4->setText( i18n("Name") );
qtarch_Label_4->setFont(fnt);
// board number
QLabel* boardTitle;
boardTitle= new QLabel( this, "" );
boardTitle->setGeometry( 190, 45, 80, 30 );
boardTitle->setFrameStyle( 50 );
boardTitle->setText( i18n("Board") );
boardTitle->setFont(fnt);
// score
QLabel* qtarch_Label_5;
qtarch_Label_5 = new QLabel( this, "Label_5" );
qtarch_Label_5->setGeometry( 270, 45, 70, 30 );
qtarch_Label_5->setFrameStyle( 50 );
qtarch_Label_5->setText( i18n("Score") );
qtarch_Label_5->setFont(fnt);
// time
QLabel* qtarch_Label_6;
qtarch_Label_6 = new QLabel( this, "Label_6" );
qtarch_Label_6->setGeometry( 340, 45, 70, 30 );
qtarch_Label_6->setFrameStyle( 50 );
qtarch_Label_6->setText( i18n("Time") );
qtarch_Label_6->setFont(fnt);
for (int row=0; row<numScores; row++)
addRow(row);
QPushButton* qtarch_PushButton_1;
qtarch_PushButton_1 = new KPushButton( KStdGuiItem::ok(), this, "PushButton_1" );
qtarch_PushButton_1->setGeometry( 110+35, 340+50, 100, 30 );
qtarch_PushButton_1->setMinimumSize( 0, 0 );
qtarch_PushButton_1->setMaximumSize( 32767, 32767 );
qtarch_PushButton_1->setFocusPolicy( QWidget::TabFocus );
qtarch_PushButton_1->setAutoRepeat( false );
qtarch_PushButton_1->setAutoResize( false );
qtarch_PushButton_1->setDefault(true);
QPushButton* resetBtn;
resetBtn= new QPushButton( this, "resetBtn" );
resetBtn->setGeometry( 10, 5, 25, 25);
resetBtn->setMinimumSize( 0, 0 );
resetBtn->setMaximumSize( 32767, 32767 );
resetBtn->setFocusPolicy( QWidget::TabFocus );
//resetBtn->setText(i18n( "Reset" ));
resetBtn->setAutoRepeat( false );
resetBtn->setAutoResize( false );
KIconLoader *loader = KGlobal::iconLoader();
resetBtn->setPixmap(loader->loadIcon("editdelete", KIcon::Toolbar));
/* We create the ediat area for the hi score name entry and move it */
/* off screen. it is moved over and placed in position when a */
/* new name is added */
lineEdit = new QLineEdit(this, "");
lineEdit->setGeometry( 50, 40+(20*30), 190, 30 );
lineEdit->setFocusPolicy(QWidget::StrongFocus);
lineEdit->setFrame(true);
lineEdit->setEchoMode(QLineEdit::Normal);
//.........这里部分代码省略.........
示例6: centerWidgetLayout
/*
* 功能:
* 主窗体设置
* 参数:
* 无
* 返回值:
* 无
*/
void EnglishInput::centerWidgetLayout()
{
p_centerWidget = new QWidget(this);
p_centerWidget->setGeometry(0, (int)(0.1416 * m_currentHeight), m_currentWidth, (int)(0.8584 * m_currentHeight));
p_textEdit = new QTextEdit(p_centerWidget);
p_textEdit->setGeometry((int)(0.0508 * m_currentWidth), (int)(0.0326 * m_currentHeight), (int)(0.7331 * m_currentWidth), (int)(0.198 * m_currentHeight));
p_textEdit->setFocusPolicy(Qt::NoFocus);
p_lineEdit = new QLineEdit(p_centerWidget);
p_lineEdit->setGeometry((int)(0.0508 * m_currentWidth + 1), (int)(0.1617 * m_currentHeight), (int)(0.7331 * m_currentWidth - 2), (int)(0.0627 * m_currentHeight));
p_lineEdit->setFocus();
p_lineEdit->setFrame(false);
p_groupABC = new QButtonGroup;
int groupABCCount = 0;
for(int i = 0; i < 5; ++i)
for(int j = 0; j < 11; ++j) {
QPushButton* abcButton = new QPushButton(p_centerWidget);
abcButton->setFocusPolicy(Qt::NoFocus);
abcButton->setGeometry((int)(0.0508 * m_currentWidth + 0.0827 * m_currentWidth * j),\
(int)(0.2381 * m_currentHeight + 0.1028 * m_currentHeight * i),\
(int)(0.0714 * m_currentWidth), (int)(0.0952 * m_currentHeight));
p_groupABC->addButton(abcButton, groupABCCount);
++groupABCCount;
}
for(int i = 0; i < 2; ++i)
for (int j = 0; j < 2; ++j) {
QPushButton* abcButton = new QPushButton(p_centerWidget);
abcButton->setFocusPolicy(Qt::NoFocus);
abcButton->setAutoRepeat(true);
abcButton->setAutoRepeatDelay(500);
abcButton->setGeometry((int)(0.7951 * m_currentWidth + 0.0827 * m_currentWidth * j),\
(int)(0.0326 * m_currentHeight + 0.1028 * m_currentHeight * i),\
(int)(0.0714 * m_currentWidth), (int)(0.0952 * m_currentHeight));
p_groupABC->addButton(abcButton, groupABCCount);
++groupABCCount;
}
QPushButton* canncelButton = new QPushButton(p_centerWidget);
canncelButton->setFocusPolicy(Qt::NoFocus);
canncelButton->setGeometry((int)(0.0508 * m_currentWidth), (int)(0.7769 * m_currentHeight),\
(int)(0.1165 * m_currentWidth), (int)(0.0652 * m_currentHeight));
p_groupABC->addButton(canncelButton, groupABCCount);
p_groupABC->button(groupABCCount)->setObjectName("ButtonCancel");
++groupABCCount;
QPushButton* OKButton = new QPushButton(p_centerWidget);
OKButton->setFocusPolicy(Qt::NoFocus);
OKButton->setGeometry((int)(0.8327 * m_currentWidth), (int)(0.7769 * m_currentHeight),\
(int)(0.1165 * m_currentWidth), (int)(0.0652 * m_currentHeight));
p_groupABC->addButton(OKButton, groupABCCount);
p_groupABC->button(groupABCCount)->setObjectName("ButtonOK");
++groupABCCount;
QPushButton* showButton = new QPushButton(p_centerWidget);
showButton->setFocusPolicy(Qt::NoFocus);
showButton->setGeometry((int)(0.4418 * m_currentWidth), (int)(0.7769 * m_currentHeight),\
(int)(0.1165 * m_currentWidth), (int)(0.0652 * m_currentHeight));
p_groupABC->addButton(showButton, groupABCCount);
p_groupABC->button(groupABCCount)->setObjectName("ButtonShow");
p_groupABC->button(31)->resize((int)(0.1532 * m_currentWidth), (int)(0.0952 * m_currentHeight));
p_groupABC->button(32)->setHidden(true);
p_groupABC->button(44)->resize((int)(0.1532 * m_currentWidth), (int)(0.0952 * m_currentHeight));
p_groupABC->button(45)->setHidden(true);
p_groupABC->button(46)->resize((int)(0.5677 * m_currentWidth), (int)(0.0952 * m_currentHeight));
p_groupABC->button(47)->setHidden(true);
p_groupABC->button(48)->setHidden(true);
p_groupABC->button(49)->setHidden(true);
p_groupABC->button(50)->setHidden(true);
p_groupABC->button(51)->setHidden(true);
p_groupABC->button(52)->setHidden(true);
p_groupABC->button(53)->resize((int)(0.1532 * m_currentWidth), (int)(0.0952 * m_currentHeight));
p_groupABC->button(54)->setHidden(true);
connect(p_groupABC, SIGNAL(buttonClicked(int)), this, SLOT(slotGroupABCClicked(int)));
connect(p_groupABC, SIGNAL(buttonPressed(int)), this, SLOT(slotGroupABCPressed(int)));
connect(p_groupABC, SIGNAL(buttonReleased(int)), this, SLOT(slotGroupABCReleased(int)));
}