本文整理汇总了C++中Q3GroupBox类的典型用法代码示例。如果您正苦于以下问题:C++ Q3GroupBox类的具体用法?C++ Q3GroupBox怎么用?C++ Q3GroupBox使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Q3GroupBox类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: switch
void Q3GroupBoxPrivate::updateFrameWidth()
{
QRect fr = q->frameRect();
int frameShape = frameStyle & QFrame::Shape_Mask;
int frameShadow = frameStyle & QFrame::Shadow_Mask;
frameWidth = -1;
switch (frameShape) {
case QFrame::NoFrame:
frameWidth = 0;
break;
case QFrame::Box:
case QFrame::HLine:
case QFrame::VLine:
switch (frameShadow) {
case QFrame::Plain:
frameWidth = lineWidth;
break;
case QFrame::Raised:
case QFrame::Sunken:
frameWidth = (short)(lineWidth*2 + midLineWidth);
break;
}
break;
case QFrame::StyledPanel:
updateStyledFrameWidths();
break;
case QFrame::WinPanel:
frameWidth = 2;
break;
case QFrame::Panel:
switch (frameShadow) {
case QFrame::Plain:
case QFrame::Raised:
case QFrame::Sunken:
frameWidth = lineWidth;
break;
}
break;
}
if (frameWidth == -1) // invalid style
frameWidth = 0;
q->setFrameRect(fr);
}
示例2: if
/*! \reimp */
QAccessible::Relation Q3AccessibleDisplay::relationTo(int child, const QAccessibleInterface *other,
int otherChild) const
{
Relation relation = QAccessibleWidget::relationTo(child, other, otherChild);
if (child || otherChild)
return relation;
QObject *o = other->object();
QLabel *label = qobject_cast<QLabel*>(object());
Q3GroupBox *groupbox = qobject_cast<Q3GroupBox*>(object());
if (label) {
if (o == label->buddy())
relation |= Label;
} else if (groupbox && !groupbox->title().isEmpty()) {
if (groupbox->children().contains(o))
relation |= Label;
}
return relation;
}
示例3: navigate
/*! \reimp */
int Q3AccessibleDisplay::navigate(RelationFlag rel, int entry, QAccessibleInterface **target) const
{
*target = 0;
if (rel == Labelled) {
QObject *targetObject = 0;
QLabel *label = qobject_cast<QLabel*>(object());
Q3GroupBox *groupbox = qobject_cast<Q3GroupBox*>(object());
if (label) {
if (entry == 1)
targetObject = label->buddy();
} else if (groupbox && !groupbox->title().isEmpty()) {
rel = Child;
}
*target = QAccessible::queryAccessibleInterface(targetObject);
if (*target)
return 0;
}
return QAccessibleWidget::navigate(rel, entry, target);
}
示例4: qMax
/*!
\internal
Updates the frame widths from the style.
*/
void Q3GroupBoxPrivate::updateStyledFrameWidths()
{
QStyleOptionFrameV2 opt;
opt.initFrom(q);
QRect cr = q->style()->subElementRect(QStyle::SE_FrameContents, &opt, q);
leftFrameWidth = cr.left() - opt.rect.left();
topFrameWidth = cr.top() - opt.rect.top();
rightFrameWidth = opt.rect.right() - cr.right(),
bottomFrameWidth = opt.rect.bottom() - cr.bottom();
frameWidth = qMax(qMax(leftFrameWidth, rightFrameWidth),
qMax(topFrameWidth, bottomFrameWidth));
}
示例5: QWidget
CTracing::CTracing( QWidget* parent, const char* name )
: QWidget( parent, name, 0 )
{
QBoxLayout *playoutTop = new QVBoxLayout( this, 5 );
// Tracing
#ifdef QT_V4LAYOUT
Q3GroupBox *pgroupbox = new Q3GroupBox( this );
#else
QGroupBox *pgroupbox = new QGroupBox( this );
#endif
pgroupbox->setFrameStyle( QFrame::Box | QFrame::Raised );
pgroupbox->setTitle( QString("Tracing") );
playoutTop->addWidget( pgroupbox, 5 );
QGridLayout *playoutGrid = new QGridLayout( pgroupbox, 3, 2, 5 );
QLabel *plabel1 = new QLabel( "Enabled", pgroupbox, "plabel1" );
pTracing = new QCheckBox( pgroupbox, "pTracing" );
QLabel *plabel3 = new QLabel( "Force Tracing", pgroupbox, "plabel1" );
pForce = new QCheckBox( pgroupbox, "pForce" );
QLabel *plabel2 = new QLabel( "File", pgroupbox, "plabel2" );
pTraceFile = new CFileSelector( pgroupbox, "pTraceFile" );
playoutGrid->addWidget( plabel1, 1, 0 );
playoutGrid->addWidget( pTracing, 1, 1 );
playoutGrid->addWidget( plabel3, 1, 2 );
playoutGrid->addWidget( pForce, 1, 3 );
playoutGrid->addWidget( plabel2, 2, 0 );
playoutGrid->addWidget( pTraceFile, 2, 1 );
// Connection Pooling
#ifdef QT_V4LAYOUT
pgroupbox = new Q3GroupBox( this );
#else
pgroupbox = new QGroupBox( this );
#endif
pgroupbox->setFrameStyle( QFrame::Box | QFrame::Raised );
pgroupbox->setTitle( QString("Connection Pooling") );
playoutTop->addWidget( pgroupbox, 5 );
playoutGrid = new QGridLayout( pgroupbox, 3, 3, 5 );
playoutGrid->setColStretch( 2, 10 );
plabel1 = new QLabel( "Enabled", pgroupbox, "plabel1" );
pPooling = new QCheckBox( pgroupbox, "pPooling" );
playoutGrid->addWidget( plabel1, 1, 0 );
playoutGrid->addWidget( pPooling, 1, 1 );
// Buttons
playoutGrid = new QGridLayout( playoutTop, 1, 5, 2 );
QPushButton *pSetDefault = new QPushButton( "De&fault", this );
QPushButton *pApply = new QPushButton( "A&pply", this );
playoutGrid->addWidget( pSetDefault, 1, 1 );
playoutGrid->addWidget( pApply, 1, 3 );
// helpt text
QFrame *pframe;
pframe = new QFrame( this, "Frame_7" );
pframe->setFrameStyle( QFrame::Box | QFrame::Raised );
playoutTop->addWidget( pframe, 4 );
playoutGrid = new QGridLayout( pframe, 1, 2, 5 );
plabel1 = new QLabel( pframe, "Label_1" );
plabel1->setGeometry( 20, 20, 32, 32 );
plabel1->setPixmap( xpmAdvanced );
plabel1->setMinimumSize( 32, 32 );
// plabel1->setMaximumSize( 32, 32 );
plabel2 = new QLabel( pframe, "Label_2" );
plabel2->setText( "These options are global. As such, they can only be set by the system administrator or someone else with 'root' access. Turn Tracing on to enable logging of calls. Turn Pooling on to enable Driver Pooling options." );
#ifdef QT_V4LAYOUT
plabel2->setAlignment( Qt::AlignLeft | Qt::WordBreak );
plabel2->setWordWrap( true );
#else
plabel2->setAlignment( AlignLeft | WordBreak );
#endif
playoutGrid->addWidget( plabel1, 0, 0 );
playoutGrid->addWidget( plabel2, 0, 1 );
playoutGrid->setColStretch( 1, 10 );
// init values
char szTracing[10];
char szForce[10];
char szTracingFile[FILENAME_MAX];
char szPooling[10];
char szGUIPlugin[FILENAME_MAX];
SQLGetPrivateProfileString( "ODBC", "Trace", "No", szTracing, sizeof(szTracing), "odbcinst.ini" );
if ( szTracing[0] == '1' || toupper( szTracing[0] ) == 'Y'
|| ( toupper( szTracing[0] ) == 'O' && toupper( szForce[0] ) == 'N' ))
pTracing->setChecked( true );
SQLGetPrivateProfileString( "ODBC", "ForceTrace", "No", szForce, sizeof(szForce), "odbcinst.ini" );
//.........这里部分代码省略.........
示例6: QVBoxLayout
QDataDescriptionWidget::QDataDescriptionWidget(QWidget* parent, core::objectmodel::Base* object):QWidget(parent)
{
QVBoxLayout* tabLayout = new QVBoxLayout( this, 0, 1, QString("tabInfoLayout"));
//Instance
{
Q3GroupBox *box = new Q3GroupBox(this, QString("Instance"));
box->setColumns(2);
box->setTitle(QString("Instance"));
new QLabel(QString("Name"), box);
new QLabel(QString(object->getName().c_str()), box);
new QLabel(QString("Class"), box);
new QLabel(QString(object->getClassName().c_str()), box);
std::string namespacename = core::objectmodel::BaseClass::decodeNamespaceName(typeid(*object));
if (!namespacename.empty())
{
new QLabel(QString("Namespace"), box);
(new QLabel(QString(namespacename.c_str()), box))->setMinimumWidth(20);
}
if (!object->getTemplateName().empty())
{
new QLabel(QString("Template"), box);
(new QLabel(QString(object->getTemplateName().c_str()), box))->setMinimumWidth(20);
}
tabLayout->addWidget( box );
}
//Class description
core::ObjectFactory::ClassEntry entry = core::ObjectFactory::getInstance()->getEntry(object->getClassName());
if (! entry.creatorMap.empty())
{
Q3GroupBox *box = new Q3GroupBox(this, QString("Class"));
box->setColumns(2);
box->setTitle(QString("Class"));
if (!entry.description.empty() && entry.description != std::string("TODO"))
{
new QLabel(QString("Description"), box);
(new QLabel(QString(entry.description.c_str()), box))->setMinimumWidth(20);
}
core::ObjectFactory::CreatorMap::iterator it = entry.creatorMap.find(object->getTemplateName());
if (it != entry.creatorMap.end() && *it->second->getTarget())
{
new QLabel(QString("Provided by"), box);
(new QLabel(QString(it->second->getTarget()), box))->setMinimumWidth(20);
}
if (!entry.authors.empty() && entry.authors != std::string("TODO"))
{
new QLabel(QString("Authors"), box);
(new QLabel(QString(entry.authors.c_str()), box))->setMinimumWidth(20);
}
if (!entry.license.empty() && entry.license != std::string("TODO"))
{
new QLabel(QString("License"), box);
(new QLabel(QString(entry.license.c_str()), box))->setMinimumWidth(20);
}
tabLayout->addWidget( box );
}
tabLayout->addStretch();
}
示例7: KDialog
MicroSettingsDlg::MicroSettingsDlg( MicroSettings * microSettings, QWidget *parent, const char *name )
:
//KDialog( parent, name, true, i18n("PIC Settings"), KDialog::Ok|KDialog::Apply|KDialog::Cancel, KDialog::Ok, true )
KDialog( parent /*, name, true, i18n("PIC Settings"), KDialog::Ok|KDialog::Apply|KDialog::Cancel, KDialog::Ok, true */ )
{
setName(name);
setModal(true);
setCaption(i18n("PIC Settings"));
setButtons(KDialog::Ok | KDialog::Apply | KDialog::Cancel);
setDefaultButton(KDialog::Ok);
showButtonSeparator(true);
m_pMicroSettings = microSettings;
m_pNewPinMappingWidget = 0l;
m_pNewPinMappingDlg = 0l;
m_pWidget = new MicroSettingsWidget(this);
QWhatsThis::add( this, i18n("This dialog allows editing of the initial properties of the PIC") );
QWhatsThis::add( m_pWidget->portsGroupBox, i18n("Edit the initial value of the ports here. For each binary number, the order from right-to-left is pins 0 through 7.<br><br>The \"Type (TRIS)\" edit shows the initial input/output state of the ports; 1 represents an input, and 0 an output.<br><br>The \"State (PORT)\" edit shows the initial high/low state of the ports; 1 represents a high, and 0 a low.") );
QWhatsThis::add( m_pWidget->variables, i18n("Edit the initial value of the variables here.<br><br>Note that the value of the variable can only be in the range 0->255. These variables will be initialized before any other code is executed.") );
//BEGIN Initialize initial port settings
m_portNames = microSettings->microInfo()->package()->portNames();
m_portTypeEdit.resize( m_portNames.size(), 0 );
m_portStateEdit.resize( m_portNames.size(), 0 );
uint row = 0;
QStringList::iterator end = m_portNames.end();
for ( QStringList::iterator it = m_portNames.begin(); it != end; ++it, ++row )
{
//BEGIN Get current Type / State text
QString portType = QString::number( microSettings->portType(*it), 2 );
QString portState = QString::number( microSettings->portState(*it), 2 );
QString fill;
fill.fill( '0', 8-portType.length() );
portType.prepend(fill);
fill.fill( '0', 8-portState.length() );
portState.prepend(fill);
//END Get current Type / State text
Q3GroupBox * groupBox = new Q3GroupBox( *it, m_pWidget->portsGroupBox );
groupBox->setColumnLayout(0, Qt::Vertical );
groupBox->layout()->setSpacing( 6 );
groupBox->layout()->setMargin( 11 );
QGridLayout * groupBoxLayout = new QGridLayout( groupBox->layout() );
groupBoxLayout->setAlignment( Qt::AlignTop );
// TODO: replace this with i18n( "the type", "Type (TRIS register):" );
groupBoxLayout->addWidget( new QLabel( i18n("Type (TRIS register):"), groupBox ), 0, 0 );
groupBoxLayout->addWidget( new QLabel( i18n("State (PORT register):"), groupBox ), 1, 0 );
m_portTypeEdit[row] = new KLineEdit( portType, groupBox );
groupBoxLayout->addWidget( m_portTypeEdit[row], 0, 1 );
m_portStateEdit[row] = new KLineEdit( portState, groupBox );
groupBoxLayout->addWidget( m_portStateEdit[row], 1, 1 );
// (dynamic_cast<QVBoxLayout*>(m_pWidget->portsGroupBox->layout()))->insertWidget( row, groupBox );
(dynamic_cast<QVBoxLayout*>(m_pWidget->portsGroupBox->layout()))->addWidget( groupBox );
}
//END Initialize initial port settings
//BEGIN Initialize initial variable settings
// Hide row headers
m_pWidget->variables->setLeftMargin(0);
// Make columns as thin as possible
m_pWidget->variables->setColumnStretchable( 0, true );
m_pWidget->variables->setColumnStretchable( 1, true );
QStringList variables = microSettings->variableNames();
row = 0;
end = variables.end();
for ( QStringList::iterator it = variables.begin(); it != end; ++it )
{
VariableInfo *info = microSettings->variableInfo(*it);
if (info)
{
m_pWidget->variables->insertRows( row, 1 );
m_pWidget->variables->setText( row, 0, *it );
m_pWidget->variables->setText( row, 1, info->valueAsString() );
++row;
}
}
m_pWidget->variables->insertRows( row, 1 );
connect( m_pWidget->variables, SIGNAL(valueChanged(int,int)), this, SLOT(checkAddVariableRow()) );
//END Initialize initial variable settings
//BEGIN Initialize pin maps
connect( m_pWidget->pinMapAdd, SIGNAL(clicked()), this, SLOT(slotCreatePinMap()) );
//.........这里部分代码省略.........
示例8: gp_widget_get_type
void GPConfigDlg::appendWidget(QWidget* parent, CameraWidget* widget)
{
QWidget* newParent = parent;
CameraWidgetType widget_type;
const char* widget_name;
const char* widget_info;
const char* widget_label;
float widget_value_float;
int widget_value_int;
const char* widget_value_string;
gp_widget_get_type(widget, &widget_type);
gp_widget_get_label(widget, &widget_label);
gp_widget_get_info(widget, &widget_info);
gp_widget_get_name(widget, &widget_name);
// gphoto2 doesn't seem to have any standard for i18n
QString whats_this = QString::fromLocal8Bit(widget_info);
// Add this widget to parent
switch (widget_type)
{
case GP_WIDGET_WINDOW:
{
setCaption(widget_label);
break;
}
case GP_WIDGET_SECTION:
{
if (!d->tabWidget)
{
d->tabWidget = new QTabWidget(parent);
parent->layout()->addWidget(d->tabWidget);
}
QWidget* tab = new QWidget(d->tabWidget);
// widgets are to be aligned vertically in the tab
QVBoxLayout* tabLayout = new QVBoxLayout(tab, marginHint(),
spacingHint());
d->tabWidget->insertTab(tab, widget_label);
KVBox* tabContainer = new KVBox(tab);
tabContainer->setSpacing(spacingHint());
tabLayout->addWidget(tabContainer);
newParent = tabContainer;
tabLayout->addStretch();
break;
}
case GP_WIDGET_TEXT:
{
gp_widget_get_value(widget, &widget_value_string);
Q3Grid* grid = new Q3Grid(2, Qt::Horizontal, parent);
parent->layout()->addWidget(grid);
grid->setSpacing(spacingHint());
new QLabel(QString::fromLocal8Bit(widget_label) + ':', grid);
QLineEdit* lineEdit = new QLineEdit(widget_value_string, grid);
d->wmap.insert(widget, lineEdit);
if (!whats_this.isEmpty())
{
grid->setWhatsThis(whats_this);
}
break;
}
case GP_WIDGET_RANGE:
{
float widget_low;
float widget_high;
float widget_increment;
gp_widget_get_range(widget, &widget_low, &widget_high, &widget_increment);
gp_widget_get_value(widget, &widget_value_float);
Q3GroupBox* groupBox = new Q3GroupBox(1, Qt::Horizontal, widget_label, parent);
parent->layout()->addWidget(groupBox);
QSlider* slider = new QSlider(
(int)widget_low,
(int)widget_high,
(int)widget_increment,
(int)widget_value_float,
Qt::Horizontal,
groupBox);
d->wmap.insert(widget, slider);
if (!whats_this.isEmpty())
{
groupBox->setWhatsThis(whats_this);
}
break;
}
case GP_WIDGET_TOGGLE:
{
//.........这里部分代码省略.........