本文整理汇总了C++中setUnit函数的典型用法代码示例。如果您正苦于以下问题:C++ setUnit函数的具体用法?C++ setUnit怎么用?C++ setUnit使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setUnit函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: KFilePlugin
KPngPlugin::KPngPlugin(QObject *parent, const char *name,
const QStringList &args)
: KFilePlugin(parent, name, args)
{
kdDebug(7034) << "png plugin\n";
// set up our mime type
KFileMimeTypeInfo* info = addMimeTypeInfo( "image/png" );
KFileMimeTypeInfo::GroupInfo* group = 0;
KFileMimeTypeInfo::ItemInfo* item = 0;
// comment group
group = addGroupInfo(info, "Comment", i18n("Comment"));
addVariableInfo(group, QVariant::String, 0);
// technical group
group = addGroupInfo(info, "Technical", i18n("Technical Details"));
item = addItemInfo(group, "Dimensions", i18n("Dimensions"), QVariant::Size);
setHint( item, KFileMimeTypeInfo::Size );
setUnit(item, KFileMimeTypeInfo::Pixels);
item = addItemInfo(group, "BitDepth", i18n("Bit Depth"), QVariant::Int);
setUnit(item, KFileMimeTypeInfo::BitsPerPixel);
addItemInfo(group, "ColorMode", i18n("Color Mode"), QVariant::String);
addItemInfo(group, "Compression", i18n("Compression"), QVariant::String);
addItemInfo(group, "InterlaceMode", i18n("Interlace Mode"),QVariant::String);
}
示例2: KFilePlugin
KRgbPlugin::KRgbPlugin(QObject *parent, const QStringList &args) :
KFilePlugin(parent, args)
{
KFileMimeTypeInfo* info = addMimeTypeInfo("image/x-rgb");
KFileMimeTypeInfo::GroupInfo* group = 0;
KFileMimeTypeInfo::ItemInfo* item;
group = addGroupInfo(info, "Comment", i18n("Comment"));
item = addItemInfo(group, "ImageName", i18n("Name"), QVariant::String);
setAttributes(item, KFileMimeTypeInfo::Modifiable);
setHint(item, KFileMimeTypeInfo::Description);
group = addGroupInfo(info, "Technical", i18n("Technical Details"));
item = addItemInfo(group, "Dimensions", i18n("Dimensions"), QVariant::Size);
setHint(item, KFileMimeTypeInfo::Size);
setUnit(item, KFileMimeTypeInfo::Pixels);
item = addItemInfo(group, "BitDepth", i18n("Bit Depth"), QVariant::Int);
setUnit(item, KFileMimeTypeInfo::BitsPerPixel);
item = addItemInfo(group, "ColorMode", i18n("Color Mode"), QVariant::String);
item = addItemInfo(group, "Compression", i18n("Compression"), QVariant::String);
item = addItemInfo(group, "SharedRows",
i18nc("percentage of avoided vertical redundancy (the higher the better)",
"Shared Rows"), QVariant::String);
}
示例3: QamFlightInstrument
QamTachymeter::QamTachymeter(QWidget* parent ) : QamFlightInstrument(parent)
{
m_class = "QamTachymeter" ;
setLabel(QString("TURBINE"), TURBINE ) ;
setUnit(QString("x 1000"), TURBINE ) ;
setMinMax(0, 40000, TURBINE ) ;
setThresholds(32000, 35000, TURBINE ) ;
setValue(0, TURBINE ) ;
m_radius[TURBINE] = QFI_RADIUS ;
m_start[TURBINE] = 120 ;
m_span[TURBINE] = 300 ;
m_min[TURBINE] = 0 ;
m_max[TURBINE] = 40 ;
m_step[TURBINE] = m_span[TURBINE] / ( m_max[TURBINE] - m_min[TURBINE] ) ;
setLabel(QString("ROTOR"), ROTOR ) ;
setUnit(QString("t/mn x 100"), ROTOR ) ;
setMinMax(0, 450, ROTOR ) ;
setThresholds(280, 420, ROTOR ) ;
setValue(0, ROTOR ) ;
m_radius[ROTOR] = 0.6 * QFI_RADIUS ;
m_start[ROTOR] = 120 ;
m_span[ROTOR] = 320 ;
m_min[ROTOR] = 0 ;
m_max[ROTOR] = 45 ;
m_step[ROTOR] = m_span[ROTOR] / ( m_max[ROTOR] - m_min[ROTOR] ) ;
// animation des aiguilles (pour tests)
setAdjustable(100, 0, TURBINE ) ;
// connect(this, SIGNAL( selectChanged() ), this, SLOT( selectChanged() ) ) ;
}
示例4: setUnit
void NumberValue::setType(const NumberValue &n) {
type = n.type;
if (n.type == DIMENSION)
setUnit(n.getUnit());
else if (n.type == PERCENTAGE)
tokens.front().type = Token::PERCENTAGE;
else if (n.type == NUMBER) {
setUnit("");
}
}
示例5: setUnit
void EditorSession::setCourse(Course *course)
{
if (m_course == course) {
return;
}
m_course = course;
if (m_course && !m_course->unitList().isEmpty()) {
setUnit(m_course->unitList().first());
} else {
setUnit(nullptr);
}
emit courseChanged();
}
示例6: KFilePlugin
KRpmPlugin::KRpmPlugin(QObject *parent,
const QStringList &args)
: KFilePlugin(parent, args)
{
KFileMimeTypeInfo* info = addMimeTypeInfo( "application/x-rpm" );
KFileMimeTypeInfo::GroupInfo* group = 0L;
group = addGroupInfo(info, "General", i18n("General"));
KFileMimeTypeInfo::ItemInfo* item;
item = addItemInfo(group, "Name", i18n("Name"), QVariant::String);
item = addItemInfo(group, "Version", i18n("Version"), QVariant::String);
item = addItemInfo(group, "Release", i18n("Release"), QVariant::Int);
item = addItemInfo(group, "Summary", i18n("Summary"), QVariant::String);
setAttributes ( item, KFileMimeTypeInfo::Description );
item = addItemInfo(group, "Group", i18n("Group"), QVariant::String);
item = addItemInfo(group, "Size", i18n("Size"), QVariant::Int);
setUnit ( item, KFileMimeTypeInfo::Bytes );
item = addItemInfo(group, "Vendor", i18n("Vendor"), QVariant::String );
item = addItemInfo(group, "Packager", i18n("Packager"), QVariant::String );
item = addItemInfo(group, "Archive Offset", i18n("Archive Offset"), QVariant::Int);
item = addItemInfo(group, "Comment", i18n("Comment"), QVariant::String);
setAttributes( item, KFileMimeTypeInfo::MultiLine );
group = addGroupInfo(info, "All tags", i18n("All tags"));
addVariableInfo(group, QVariant::String, 0);
}
示例7: QLabel
void Variometer::createSettings(QGridLayout *layout) {
QLabel *unitsLabel = new QLabel("Unit", layout->parentWidget());
layout->addWidget(unitsLabel, layout->rowCount(), 0);
VelocityUnitComboBox *unitsCombo = new VelocityUnitComboBox(layout->parentWidget(), units);
connect(unitsCombo, SIGNAL(unitSelected(VelocityUnit)), this, SLOT(setUnit(VelocityUnit)));
layout->addWidget(unitsCombo);
QLabel *maxLabel = new QLabel("Maximum value", layout->parentWidget());
layout->addWidget(maxLabel);
NumberInputLineEdit *maxValueEdit = new NumberInputLineEdit(layout->parentWidget());
maxValueEdit->setText(QString::number(maxValue));
layout->addWidget(maxValueEdit);
connect(maxValueEdit, SIGNAL(valueChangedFloat(float)), this, SLOT(setMaxValue(float)));
QLabel *scaleLabel = new QLabel("Scale numbers", layout->parentWidget());
layout->addWidget(scaleLabel);
NumberInputLineEdit *scaleValueEdit = new NumberInputLineEdit(layout->parentWidget());
scaleValueEdit->setText(QString::number(numberScale));
layout->addWidget(scaleValueEdit);
connect(scaleValueEdit, SIGNAL(valueChangedFloat(float)), this, SLOT(setNumberScale(float)));
QCheckBox *totalCheckbox = new QCheckBox("Total energy", layout->parentWidget());
totalCheckbox->setChecked(isTotalEnergy);
layout->addWidget(totalCheckbox);
connect(totalCheckbox, SIGNAL(clicked(bool)), this, SLOT(setIsTotalEnergy(bool)));
}
示例8: getUnit
void NumberValue::verifyUnits(const NumberValue& n) {
if (type == Value::DIMENSION && n.type == Value::DIMENSION &&
getUnit().compare(n.getUnit()) != 0) {
setValue(convert(n.getUnit()));
setUnit(n.getUnit());
}
}
示例9: utFind
/*
* Return the unit corresponding to a unit-specification.
*
*/
int
utFind(
char *spec,
utUnit *up)
{
int status;
ut_unit* unit = ut_parse(unitSystem, spec, UT_ASCII);
if (unit == NULL) {
status = ut_get_status();
if (status == UT_BAD_ARG) {
status = UT_EINVALID;
}
else if (status == UT_SYNTAX) {
status = UT_ESYNTAX;
}
else if (status == UT_UNKNOWN) {
status = UT_EUNKNOWN;
}
else if (status == UT_OS) {
status = UT_EALLOC;
}
}
else {
status = setUnit(up, unit);
}
return status;
}
示例10: RS_Document
/**
* Default constructor.
*/
RS_Graphic::RS_Graphic(RS_EntityContainer* parent)
: RS_Document(parent),
layerList(),
blockList(true)
#ifdef RS_CAM
, camData()
#endif
{
RS_SETTINGS->beginGroup("/Defaults");
setUnit(RS_Units::stringToUnit(RS_SETTINGS->readEntry("/Unit", "None")));
RS_SETTINGS->endGroup();
RS2::Unit unit = getUnit();
if (unit==RS2::Inch) {
addVariable("$DIMASZ", 0.1, 40);
addVariable("$DIMEXE", 0.05, 40);
addVariable("$DIMEXO", 0.025, 40);
addVariable("$DIMGAP", 0.025, 40);
addVariable("$DIMTXT", 0.1, 40);
} else {
addVariable("$DIMASZ",
RS_Units::convert(2.5, RS2::Millimeter, unit), 40);
addVariable("$DIMEXE",
RS_Units::convert(1.25, RS2::Millimeter, unit), 40);
addVariable("$DIMEXO",
RS_Units::convert(0.625, RS2::Millimeter, unit), 40);
addVariable("$DIMGAP",
RS_Units::convert(0.625, RS2::Millimeter, unit), 40);
addVariable("$DIMTXT",
RS_Units::convert(2.5, RS2::Millimeter, unit), 40);
}
setModified(false);
}
示例11: m_state
KWFrameGeometry::KWFrameGeometry(FrameConfigSharedState *state)
: m_state(state),
m_frame(0),
m_topOfPage(0),
m_blockSignals(false),
m_originalGeometryLock(false)
{
m_state->addUser();
widget.setupUi(this);
setUnit(m_state->document()->unit());
widget.width->setMinimum(0.0);
widget.height->setMinimum(0.0);
widget.leftMargin->setMinimum(0.0);
widget.rightMargin->setMinimum(0.0);
widget.bottomMargin->setMinimum(0.0);
widget.topMargin->setMinimum(0.0);
widget.keepAspect->setKeepAspectRatio(m_state->keepAspectRatio());
connect(widget.leftMargin, SIGNAL(valueChangedPt(qreal)), this, SLOT(syncMargins(qreal)));
connect(widget.rightMargin, SIGNAL(valueChangedPt(qreal)), this, SLOT(syncMargins(qreal)));
connect(widget.bottomMargin, SIGNAL(valueChangedPt(qreal)), this, SLOT(syncMargins(qreal)));
connect(widget.topMargin, SIGNAL(valueChangedPt(qreal)), this, SLOT(syncMargins(qreal)));
connect(widget.width, SIGNAL(valueChangedPt(qreal)), this, SLOT(widthChanged(qreal)));
connect(widget.height, SIGNAL(valueChangedPt(qreal)), this, SLOT(heightChanged(qreal)));
connect(m_state, SIGNAL(keepAspectRatioChanged(bool)), widget.keepAspect, SLOT(setKeepAspectRatio(bool)));
connect(widget.keepAspect, SIGNAL(keepAspectRatioChanged(bool)), this, SLOT(updateAspectRatio(bool)));
connect(widget.positionSelector, SIGNAL(positionSelected(KFlake::Position)),
this, SLOT(setGeometryAlignment(KFlake::Position)));
}
示例12: setTitle
void Thermometer::setParameter(QString title, float percentage, float startScale, float endScale, QString unit)
{
setTitle(title);
setPercentage(percentage);
setScale(startScale, endScale);
setUnit(unit);
}
示例13: setUnit
void Variometer::loadSettings(QSettings &settings) {
PanelItem::loadSettings(settings);
QString unitname = settings.value("unit").toString();
VelocityUnit unit = Units::velocityUnitForName(unitname);
setUnit(unit);
setMaxValue(settings.value("maxvalue", 300).toDouble());
setIsTotalEnergy(settings.value("totalenergy", false).toBool());
}
示例14: clear
PPPStats::PPPStats()
{
clear();
timer = new QTimer;
ppp_connection_time = new QTime;
setUnit(0);
connect(timer, SIGNAL(timeout()), SLOT(timerClick()));
}
示例15: switch
void Fight::socketFight()
{
switch( _socket->getCla2() ) {
case C_FIGHT_INIT:
logEE( "Should not happen (C_FIGHT_INIT in Fight)" );
break;
case C_FIGHT_CREATURE:
_isCreature = true;
setOpponent( _game->getLord( 0 ) );
break;
case C_FIGHT_LORD: {
GenericLord * lord = _game->getLord( _socket->readChar() );
lord->setBaseCharac( ATTACK, _socket->readChar() );
lord->setBaseCharac( DEFENSE, _socket->readChar() );
setOpponent( lord );
} break;
case C_FIGHT_CELL:
socketFightCell();
break;
case C_FIGHT_UNIT: {
uchar cla = _socket->readChar();
uchar num = _socket->readChar();
GenericFightUnit * unit = new GenericFightUnit();
uchar race = _socket->readChar();
uchar level = _socket->readChar();
unit->setCreature( race, level );
unit->setNumber( _socket->readInt() );
unit->setMove( _socket->readChar() );
unit->setHealth( _socket->readInt() );
setUnit( unit, (CLASS_FIGHTER)cla, num );
} break;
case C_FIGHT_MODUNIT:
socketFightModify();
break;
case C_FIGHT_MOVE:
socketFightMove();
break;
case C_FIGHT_ENDMOVE:
_isActive = false;
_map->clearPath();
break;
case C_FIGHT_ACTIVE:{
uchar cla = _socket->readChar();
uchar num = _socket->readChar();
setActive( (CLASS_FIGHTER)cla, num );
}
break;
case C_FIGHT_DAMAGE:
socketFightDamage();
break;
case C_FIGHT_END: {
updateUnits();
showFightResults( _socket->readChar() );
emit sig_quit();
}
break;
}
}