当前位置: 首页>>代码示例>>C++>>正文


C++ QRadioButton::setFocusPolicy方法代码示例

本文整理汇总了C++中QRadioButton::setFocusPolicy方法的典型用法代码示例。如果您正苦于以下问题:C++ QRadioButton::setFocusPolicy方法的具体用法?C++ QRadioButton::setFocusPolicy怎么用?C++ QRadioButton::setFocusPolicy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QRadioButton的用法示例。


在下文中一共展示了QRadioButton::setFocusPolicy方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: populateList

/**
 * Populates the tree widget with the cash receipt available list.
 */
void AvailableCashDialog::populateList(QList<QMap<QString, QString>*> list)
{
	QTreeWidgetItem *item;
	QRadioButton *button;

	QSignalMapper *mapper = new QSignalMapper(this);

	connect(mapper, SIGNAL(mapped(const QString)), this,
			SLOT(setCashReceiptId(const QString)));

	for (int i = 0; i < list.size(); i++) {
		item = new QTreeWidgetItem(ui.availableCashReceiptTreeWidget);
		item->setText(1, list.at(i)->value("id"));
		item->setText(2, list.at(i)->value("serial_number") + "-" +
				list.at(i)->value("number"));
		item->setText(3, list.at(i)->value("received_cash"));
		item->setText(4, list.at(i)->value("available_cash"));

		ui.availableCashReceiptTreeWidget->addTopLevelItem(item);

		button = new QRadioButton(ui.availableCashReceiptTreeWidget);
		button->setFocusPolicy(Qt::NoFocus);

		connect(button, SIGNAL(clicked()), mapper, SLOT(map()));

		mapper->setMapping(button, list.at(i)->value("id"));

		ui.availableCashReceiptTreeWidget->setItemWidget(item, 0, button);
	}
}
开发者ID:newzen,项目名称:project-999,代码行数:33,代码来源:available_cash_dialog.cpp

示例2: QRadioButton

/*!
 * Makes a new radio button with the give [text] and with the given [parent]
 * (which can be NULL), adds it to the button group [group] with button ID [id]
 * if [group] is non-NULL, adds it to [layout] if it is non-NULL, sets it for
 * no focus, and sets [tooltip] as the tooltip if it is non-NULL.  [layout] 
 * can be a QHBoxLayout or a QVBoxLayout.
 */
QRadioButton *diaRadioButton(const char *label, QWidget *parent, QButtonGroup *group,
                             QBoxLayout *layout, int id, const char *tooltip)
{
  QRadioButton *radio = new QRadioButton(QString(label), parent);
  if (group)
    group->addButton(radio, id);
  if (layout)
    layout->addWidget(radio);
  radio->setFocusPolicy(Qt::NoFocus);
  if (tooltip)
    radio->setToolTip(QString(tooltip));
  return radio;
}
开发者ID:LabShare,项目名称:IMOD,代码行数:20,代码来源:dia_qtutils.cpp

示例3: passwdPalette

KDMShutdown::KDMShutdown( int mode, QWidget* _parent, const char* _name,
			  const char* _shutdown, 
			  const char* _restart)
     : FDialog( _parent, _name, true)
{
     shutdown = _shutdown;
     restart  = _restart;
     int h = 10, w = 0;
     QFrame* winFrame = new QFrame( this);
     winFrame->setFrameStyle( QFrame::WinPanel | QFrame::Raised);
     QBoxLayout* box = new QBoxLayout( winFrame, QBoxLayout::TopToBottom, 
				       10, 10);
     QString shutdownmsg =  klocale->translate( "Shutdown or restart?");
     if( mode == KDMConfig::RootOnly) {
	  shutdownmsg += '\n';
	  shutdownmsg += klocale->translate( "(Enter Root Password)");
     }
     label = new QLabel( shutdownmsg, winFrame);
     set_fixed( label);
     h += label->height() + 10;
     w = label->width();

     box->addWidget( label, 0, AlignCenter);

     QFrame* sepFrame = new QFrame( this);
     sepFrame->setFrameStyle( QFrame::HLine| QFrame::Sunken);
     h += sepFrame->height(); 
     box->addWidget( sepFrame);

     btGroup = new QButtonGroup( /* this */);
     
     QRadioButton *rb;
     rb = new QRadioButton( winFrame /*btGroup*/);
     rb->setText( klocale->translate("Shutdown"));
     set_min( rb);
     rb->setFocusPolicy( StrongFocus);
     // Default action
     rb->setChecked( true);
     rb->setFocus();
     cur_action = shutdown;
     
     h += rb->height() + 10;
     w = QMAX( rb->width(), w);

     box->addWidget( rb);
     btGroup->insert( rb);
     rb = new QRadioButton( winFrame /*btGroup*/);
     rb->setText( klocale->translate("Shutdown and restart"));
     set_min( rb);
     rb->setFocusPolicy( StrongFocus);
     h += rb->height() + 10;
     w = QMAX( rb->width(), w);

     box->addWidget( rb);
     btGroup->insert( rb);
     rb = new QRadioButton( winFrame /*btGroup*/);
     rb->setText( klocale->translate("Restart X Server"));//better description
     set_min( rb);
     rb->setFocusPolicy( StrongFocus);
     h += rb->height() + 10;
     w = QMAX( rb->width(), w);

     box->addWidget( rb);
     btGroup->insert( rb);

     // Passwd line edit
     if( mode == KDMConfig::RootOnly) {
	  pswdEdit = new QLineEdit( winFrame);
	  //set_min( pswdEdit);
	  pswdEdit->setMinimumHeight( pswdEdit->sizeHint().height());
	  pswdEdit->setEchoMode( QLineEdit::NoEcho);
	  /*QColorGroup   passwdColGroup(
	       QApplication::palette()->normal().foreground(),
	       QApplication::palette()->normal().background(),
	       QApplication::palette()->normal().light(),
	       QApplication::palette()->normal().dark(),
	       QApplication::palette()->normal().mid(),
	       QApplication::palette()->normal().base(),
	       QApplication::palette()->normal().base());
	  QPalette passwdPalette( passwdColGroup, passwdColGroup, 
				  passwdColGroup);
	  pswdEdit->setPalette( passwdPalette);
	  */
	  pswdEdit->setFocusPolicy( StrongFocus);
	  pswdEdit->setFocus();
	  h+= pswdEdit->height() + 10;
	  box->addWidget( pswdEdit);
     }

     QBoxLayout* box3 = new QBoxLayout( QBoxLayout::LeftToRight, 10);
     box->addLayout( box3);

     okButton = new QPushButton( klocale->translate("OK"), winFrame);
     set_min( okButton);
     okButton->setFocusPolicy( StrongFocus);
     cancelButton = new QPushButton( klocale->translate("Cancel"), winFrame);
     set_min( cancelButton);
     //cancelButton->setDefault( true);
     cancelButton->setFocusPolicy( StrongFocus);
     h += cancelButton->height() + 10;
//.........这里部分代码省略.........
开发者ID:kthxbyte,项目名称:KDE1-Linaro,代码行数:101,代码来源:kdmshutdown.cpp


注:本文中的QRadioButton::setFocusPolicy方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。