本文整理汇总了C++中p函数的典型用法代码示例。如果您正苦于以下问题:C++ p函数的具体用法?C++ p怎么用?C++ p使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了p函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: p
Prop *Prop::AllocTextAlign(AlignAttr align)
{
Prop p(PropTextAlign);
p.textAlign = align;
return UniqifyProp(p);
}
示例2: p1
double MxSegment<DIM>::volumeFraction(const MxShape<DIM> & aShape, const MxDimVector<double, DIM> & midPt) const {
MxDimVector<double, DIM> p1(midPt + 0.5 * len * dir);
MxDimVector<double, DIM> p2(midPt - 0.5 * len * dir);
double f1 = aShape.func(p1);
double f2 = aShape.func(p2);
int f1s = MxUtil::sign(f1);
int f2s = MxUtil::sign(f2);
if ((f1s == 1 and f2s != -1) or (f2s == 1 and f1s != -1)) {
return 1;
} else if ((f1s == -1 and f2s != 1) or (f2s == -1 and f1s != 1)) {
return 0;
} else if (f1s == 0 and f2s == 0) {
return MxUtil::sign(aShape.func(midPt)) == 1 ? 1 : 0;
} else { // bracketing
MxDimVector<double, DIM> p(MxUtil::rootFind<MxShape<DIM>, DIM>(aShape, p1, p2, 1.e-12, 20));
if (f1s == 1)
return (p - p1).norm() / len;
else
return (p - p2).norm() / len;
}
#if 0
if ((f1 > MxUtil::dEps and f2 > -MxUtil::dEps) or
(f2 > MxUtil::dEps and f1 > -MxUtil::dEps)) return 1.0; // one in, other in or on
else if ((f1 < -MxUtil::dEps and f2 < MxUtil::dEps) or
(f2 < -MxUtil::dEps and f1 < MxUtil::dEps)) return 0.0; // one out, other out or on
else if (fabs(f1) < MxUtil::dEps and fabs(f2) < MxUtil::dEps) { // both on
if (aShape.func(midPt) > MxUtil::dEps) return 1.0;
else return 0.0;
}
else { // bracketing
MxDimVector<double, DIM> p(MxUtil::rootFind<MxShape<DIM>, DIM>(aShape, p1, p2, 1.e-12, 20));
if (f1 > MxUtil::dEps)
return (p - p1).norm() / len;
else
return (p - p2).norm() / len;
}
#endif
#if 0
if (f1 * f2 > 0.0) {
if (f1 > 0.0)
return 1.0;
else
return 0.0;
}
else if (f1 == 0.0 and f2 == 0.0) {
if (aShape.func(midPt) > 0.0) return 1.0;
else return 0.0;
}
else if (f1 * f2 == 0.0) {
if (f1 > 0.0 or f2 > 0.0) return 1.0;
else return 0.0;
}
else {
MxDimVector<double, DIM> p(MxUtil::rootFind<MxShape<DIM>, DIM>(aShape, p1, p2, 1.e-12, 20));
if (f1 > 0.0)
return (p - p1).norm() / len;
else
return (p - p2).norm() / len;
}
#endif
}
示例3: p
unsigned int IOFactory::findPlugins( const std::string &path )
{
boost::filesystem::path p( path );
if ( !exists( p ) ) {
LOG( Runtime, warning ) << util::MSubject( p ) << " not found";
return 0;
}
if ( !boost::filesystem::is_directory( p ) ) {
LOG( Runtime, warning ) << util::MSubject( p ) << " is no directory";
return 0;
}
LOG( Runtime, info ) << "Scanning " << util::MSubject( p ) << " for plugins";
boost::regex pluginFilter( std::string( "^" ) + DL_PREFIX + "isisImageFormat_" + "[[:word:]]+" + DL_SUFFIX + "$", boost::regex::perl | boost::regex::icase );
unsigned int ret = 0;
for ( boost::filesystem::directory_iterator itr( p ); itr != boost::filesystem::directory_iterator(); ++itr ) {
if ( boost::filesystem::is_directory( *itr ) )continue;
if ( boost::regex_match( itr->path().filename().string(), pluginFilter ) ) {
const std::string pluginName = itr->path().native();
#ifdef WIN32
HINSTANCE handle = LoadLibrary( pluginName.c_str() );
#else
void *handle = dlopen( pluginName.c_str(), RTLD_NOW );
#endif
if ( handle ) {
#ifdef WIN32
image_io::FileFormat* ( *factory_func )() = ( image_io::FileFormat * ( * )() )GetProcAddress( handle, "factory" );
#else
image_io::FileFormat* ( *factory_func )() = ( image_io::FileFormat * ( * )() )dlsym( handle, "factory" );
#endif
if ( factory_func ) {
FileFormatPtr io_class( factory_func(), _internal::pluginDeleter( handle, pluginName ) );
if ( registerFileFormat( io_class ) ) {
io_class->plugin_file = pluginName;
ret++;
} else {
LOG( Runtime, warning ) << "failed to register plugin " << util::MSubject( pluginName );
}
} else {
#ifdef WIN32
LOG( Runtime, warning )
<< "could not get format factory function from " << util::MSubject( pluginName );
FreeLibrary( handle );
#else
LOG( Runtime, warning )
<< "could not get format factory function from " << util::MSubject( pluginName ) << ":" << util::MSubject( dlerror() );
dlclose( handle );
#endif
}
} else
#ifdef WIN32
LOG( Runtime, warning ) << "Could not load library " << util::MSubject( pluginName );
#else
LOG( Runtime, warning ) << "Could not load library " << util::MSubject( pluginName ) << ":" << util::MSubject( dlerror() );
#endif
} else {
LOG( Runtime, verbose_info ) << "Ignoring " << *itr << " because it doesn't match " << pluginFilter.str();
}
}
return ret;
}
示例4: p
void
StatsGauge::paintEvent( QPaintEvent* event )
{
QPainter p( this );
p.setRenderHint( QPainter::Antialiasing );
p.setClipRect( event->rect() );
QSize gaugeSize = m_sizeHint - QSize( 0, 40 );
QPen pen( TomahawkStyle::NOW_PLAYING_ITEM.lighter() );
pen.setWidth( 16 );
p.setPen( pen );
int fullCircle = 16 * 360;
p.drawArc( QRect( 12, 12, gaugeSize.width() - 24, gaugeSize.height() - 24 ),
4*360, (int)( -1.0 * (float)fullCircle * ( invertedAppearance() ? ( 1.0 - m_percentage ) : m_percentage ) ) );
pen = QPen( TomahawkStyle::NOW_PLAYING_ITEM.darker() );
pen.setWidth( 6 );
p.setPen( pen );
QBrush brush( QColor( "#252020" ) );
p.setBrush( brush );
p.drawEllipse( QRect( 28, 28, gaugeSize.width() - 56, gaugeSize.height() - 56 ) );
pen = QPen( Qt::white );
p.setPen( pen );
QFont font = p.font();
font.setWeight( QFont::Black );
if ( value() <= 999 )
font.setPixelSize( 60 );
else
font.setPixelSize( 44 );
p.setFont( font );
QRect textRect( 0, gaugeSize.height() / 2 - 14, gaugeSize.width(), 62 );
p.drawText( textRect, Qt::AlignCenter, value() > 0 ? QString::number( value() ) : "-" );
pen = QPen( QColor( "#8b8b8b" ) );
p.setPen( pen );
font = p.font();
font.setWeight( QFont::Black );
font.setPixelSize( 16 );
p.setFont( font );
textRect = QRect( 0, gaugeSize.height() / 2 - 32, gaugeSize.width(), 20 );
p.drawText( textRect, Qt::AlignCenter, maximum() > 0 ? tr( "out of %1" ).arg( maximum() ) : "-" );
if ( !m_text.isEmpty() )
{
pen = QPen( Qt::white );
p.setPen( pen );
font = p.font();
font.setWeight( QFont::DemiBold );
font.setPixelSize( 16 );
p.setFont( font );
QColor figColor( "#3e3e3e" );
p.setBrush( figColor );
QFontMetrics fm( font );
int textWidth = fm.width( m_text );
textRect = QRect( m_sizeHint.width() / 2 - ( textWidth / 2 + 12 ), m_sizeHint.height() - 32, textWidth + 24, 28 );
TomahawkUtils::drawBackgroundAndNumbers( &p, m_text, textRect );
}
}
示例5: p
void ContextTile::paintEvent(QPaintEvent *) {
QStyleOption o;
o.initFrom(this);
QPainter p(this);
style()->drawPrimitive(QStyle::PE_Widget, &o, &p, this);
}
示例6: p
void DiagramCanvas::paint_all( QRect& r )
{
int i;
QPainter p( &buffer );
QPen pen;
QBrush brush;
QPointArray a;
QColor color;
QRegion mask, crossing_disk;
set<double>::iterator dbl_it;
for ( i=0; i<crossingList.size(); ++i )
{
Crossing *c = crossingList[i];
c->under->underpasses.insert( c->under->underpasses.end(), c->position_on_understrand );
}
for ( i=0; i<edgeList.size(); ++i )
{
Edge *e = edgeList[i];
pen.setWidth( e->thickness );
pen.setColor( CANVAS );
p.setPen( pen );
QPoint v, v1, v2, p1, p2 ;
p1 = e->vertex[begin]->position;
p2 = e->vertex[end]->position;
p.drawLine( p1, p2 );
/*
if (e->edge_type==singular)
{
v = p1 - p2;
v1.setX( v.x() - v.y() );
v1.setY( v.x() + v.y() );
v2.setX( v.x() + v.y() );
v2.setY( -v.x() + v.y() );
v1 = 5 * v1 / sqrt( double (v1.x() * v1.x() + v1.y() * v1.y()) );
v2 = 5 * v2 / sqrt( double (v2.x() * v2.x() + v2.y() * v2.y()) );
v = v / 2;
pen.setWidth( ARROW );
p.setPen( pen );
p.drawLine( p2+v, p2+v1+v );
p.drawLine( p2+v, p2+v2+v );
}
*/
}
for ( i=0; i<edgeList.size(); ++i )
{
Edge *e = edgeList[i];
color = (e->edge_type == drilled) ? DRILLED : colorList[e->arc_id % 18 ];
pen.setWidth( e->thickness );
pen.setColor( color );
p.setPen( pen );
brush.setColor( color );
brush.setStyle( SolidPattern );
p.setBrush( brush );
if ( e->underpasses.size() > 0 )
{
p.setClipping( TRUE );
mask = QRegion( 0, 0, width(), height(), QRegion::Rectangle );
for ( dbl_it=e->underpasses.begin(); dbl_it!=e->underpasses.end(); ++dbl_it )
{
QPoint center = time_to_point( e, *dbl_it );
crossing_disk = QRegion( center.x()-7, center.y()-7, 14, 14 , QRegion::Ellipse );
mask -= crossing_disk;
}
p.setClipRegion( mask );
QPoint v, v1, v2, p1, p2 ;
p1 = e->vertex[begin]->position;
p2 = e->vertex[end]->position;
p.drawLine( p1, p2 );
/*
if (e->edge_type==singular)
{
v = p1 - p2;
v1.setX( v.x() - v.y() );
v1.setY( v.x() + v.y() );
v2.setX( v.x() + v.y() );
v2.setY( -v.x() + v.y() );
v1 = 5 * v1 / sqrt( double (v1.x() * v1.x() + v1.y() * v1.y()) );
v2 = 5 * v2 / sqrt( double (v2.x() * v2.x() + v2.y() * v2.y()) );
v = v / 2;
pen.setWidth( ARROW );
p.setPen( pen );
p.drawLine( p2+v, p2+v1+v );
p.drawLine( p2+v, p2+v2+v );
//.........这里部分代码省略.........
示例7: WndProc
LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
static int cxChar, cxCaps, cyChar, cyClient, iVscrollPos ;
HDC hdc ;
int i, y ;
PAINTSTRUCT ps ;
// TCHAR szBuffer[10] ;
TEXTMETRIC tm ;
static int LoadDLLTag=0;
static int poehackTag=0;
static BOOL show_flag=TRUE;
switch (message)
{
case WM_LBUTTONDOWN:
if(LoadDLLTag==1)
{
show_flag=!show_flag;
InvalidateRect (hwnd, NULL, TRUE) ;
return 0;
}
LoadDLLTag=1;
PoeIntercept(hwnd);
/*
typedef void(*pExecute)(DWORD);
pExecute p;
p=(pExecute)GetProcAddress(poehackModule,"Execute");
if(p)
p((DWORD)hwnd);
*/
return 0;
case WM_RBUTTONDOWN:
if(poehackTag==1){
return 0;
}
char dllFullName[10240];
GetCurrentDirectory(255, dllFullName);
strcpy(dllFullName, "c:\\bot\\d3\\poehack.dll");
poehackModule = LoadLibrary(dllFullName);
if(!poehackModule) _showinfo("poehack load failed: %s",dllFullName);
else
{
_showinfo("poehack loaded");
poehackTag=1;
}
if(!_PassValueAddr)
_PassValueAddr=(pPassValue)GetProcAddress(poehackModule,"PassValue");
_showinfo("_PassValueAddr %x",_PassValueAddr);
return 0;
case WM_MBUTTONDOWN:
if(poehackTag==0) return 0;
_value.id = DO_UNLOAD;
if(_PassValueAddr) _PassValueAddr(&_value);
/*
typedef void(*pUnload)();
pUnload p;
p=(pUnload)GetProcAddress(poehackModule,"Unload");
if(p) p();
*/
FreeLibrary(poehackModule);
poehackModule=NULL;
_PassValueAddr=NULL;
_showinfo("poehack unloaded");
poehackTag=0;
return 0;
case WM_CREATE:
hdc = GetDC (hwnd) ;
GetTextMetrics (hdc, &tm) ;
cxChar = tm.tmAveCharWidth ;
cxCaps = (tm.tmPitchAndFamily & 1 ? 3 : 2) * cxChar / 2 ;
cyChar = tm.tmHeight + tm.tmExternalLeading ;
ReleaseDC (hwnd, hdc) ;
SetScrollRange (hwnd, SB_VERT, 0, NUMLINES - 1, FALSE) ;
SetScrollPos (hwnd, SB_VERT, iVscrollPos, TRUE) ;
_window_up=TRUE;
return 0 ;
case WM_SIZE:
cyClient = HIWORD (lParam) ;
return 0 ;
case WM_VSCROLL:
switch (LOWORD (wParam))
{
case SB_LINEUP:
iVscrollPos -= 1 ;
break ;
case SB_LINEDOWN:
iVscrollPos += 1 ;
break ;
case SB_PAGEUP:
iVscrollPos -= cyClient / cyChar ;
break ;
//.........这里部分代码省略.........
示例8: evaluateDefines
bool Bass::executeInstruction(Instruction& i) {
activeInstruction = &i;
string s = i.statement;
evaluateDefines(s);
if(s.match("macro ?*(*) {") || s.match("global macro ?*(*) {")) {
bool local = s.beginsWith("global ") == false;
s.ltrim<1>("global ");
s.trim<1>("macro ", ") {");
lstring p = s.split<1>("(");
bool scoped = p(0).beginsWith("scope ");
p(0).ltrim<1>("scope ");
lstring a = p(1).empty() ? lstring{} : p(1).qsplit(",").strip();
setMacro(p(0), a, ip, scoped, local);
ip = i.ip;
return true;
}
if(s.match("define ?*(*)") || s.match("global define ?*(*)")) {
bool local = s.beginsWith("global ") == false;
s.ltrim<1>("global ");
lstring p = s.trim<1>("define ", ")").split<1>("(");
setDefine(p(0), p(1), local);
return true;
}
if(s.match("evaluate ?*(*)") || s.match("global evaluate ?*(*)")) {
bool local = s.beginsWith("global ") == false;
s.ltrim<1>("global ");
lstring p = s.trim<1>("evaluate ", ")").split<1>("(");
setDefine(p(0), evaluate(p(1)), local);
return true;
}
if(s.match("variable ?*(*)") || s.match("global variable ?*(*)")) {
bool local = s.beginsWith("global ") == false;
s.ltrim<1>("global ");
lstring p = s.trim<1>("variable ", ")").split<1>("(");
setVariable(p(0), evaluate(p(1)), local);
return true;
}
if(s.match("if ?* {")) {
s.trim<1>("if ", " {").strip();
bool match = evaluate(s, Evaluation::Strict);
ifStack.append(match);
if(match == false) {
ip = i.ip;
}
return true;
}
if(s.match("} else if ?* {")) {
if(ifStack.last()) {
ip = i.ip;
} else {
s.trim<1>("} else if ", " {").strip();
bool match = evaluate(s, Evaluation::Strict);
ifStack.last() = match;
if(match == false) {
ip = i.ip;
}
}
return true;
}
if(s.match("} else {")) {
if(ifStack.last()) {
ip = i.ip;
} else {
ifStack.last() = true;
}
return true;
}
if(s.match("} endif")) {
ifStack.removeLast();
return true;
}
if(s.match("while ?* {")) {
s.trim<1>("while ", " {").strip();
bool match = evaluate(s, Evaluation::Strict);
if(match == false) ip = i.ip;
return true;
}
if(s.match("} endwhile")) {
ip = i.ip;
return true;
}
if(s.match("?*(*)")) {
lstring p = string{s}.rtrim<1>(")").split<1>("(");
lstring a = p(1).empty() ? lstring{} : p(1).qsplit(",").strip();
string name = {p(0), ":", a.size()}; //arity overloading
if(auto macro = findMacro({name})) {
struct Parameter {
enum class Type : unsigned { Define, Variable } type;
string name;
//.........这里部分代码省略.........
示例9: aw
void AGXContinuousTrack::createTrackConstraint()
{
AGXLinkPtr agxFootLinkStart = _feet[0];
AGXLinkPtr agxFootLinkEnd = _feet[_feet.size() - 1];
// Connect footLinkStart and footLinkEnd with Hinge
// Create Hinge with world coordination
LinkPtr link = agxFootLinkStart->getOrgLink();
const Vector3& a = link->a(); // local
const Vector3 aw = link->attitude() * a; // world
const Vector3& p = link->p(); // world
AGXHingeDesc hd;
hd.frameAxis = agx::Vec3(aw(0), aw(1), aw(2));
hd.frameCenter = agx::Vec3(p(0), p(1), p(2));
hd.rigidBodyA = agxFootLinkStart->getAGXRigidBody();
hd.rigidBodyB = agxFootLinkEnd->getAGXRigidBody();
hd.motor.enable = false;
hd.lock.enable = false;
hd.range.enable = false;
agx::ConstraintRef constraint = AGXObjectFactory::createConstraint(hd);
link->setJointType(Link::ROTATIONAL_JOINT);
agxFootLinkStart->setAGXConstraint(constraint);
getAGXBody()->getAGXScene()->getSimulation()->add(constraint);
// Create PlaneJoint to prvent the track falling off
// Create joint with parent(example:chasis) coordination
const Vector3& b = link->b();
const agx::Vec3 a0 = agx::Vec3(a(0), a(1), a(2)); // Rotate axis of track. local
const agx::Vec3& b0 = agx::Vec3(b(0), b(1), b(2)); // Vector from parent to footLinkStart
const agx::Vec3& p0 = (a0 * b0) * a0; // Middle position of track(projection vector of b0 to a0). local
agx::Vec3 nx = agx::Vec3::Z_AXIS().cross(a0); // Check a0 is parallel to Z. X-Y consists plane joint.
agx::OrthoMatrix3x3 rotation;
if (nx.normalize() > 1.0e-6) {
nx.normal();
rotation.setColumn(0, nx);
agx::Vec3 ny = a0.cross(nx);
ny.normal();
rotation.setColumn(1, ny);
rotation.setColumn(2, a0);
}
agx::AffineMatrix4x4 af(rotation, p0);
AGXPlaneJointDesc pd;
pd.frameB = AGXObjectFactory::createFrame();
pd.frameB->setMatrix(af);
pd.rigidBodyB = agxFootLinkStart->getAGXParentLink()->getAGXRigidBody();
// Generate collision group name to disable collision between tracks
std::stringstream trackCollsionGroupName;
trackCollsionGroupName.str("");
trackCollsionGroupName << "SelfCollisionContinuousTrack" << agx::UuidGenerator().generate().str() << std::flush;
getAGXBody()->addCollisionGroupNameToDisableCollision(trackCollsionGroupName.str());
for (int i = 0; i < (int)_feet.size(); ++i) {
AGXLinkPtr agxLink = _feet[i];
// Add plane joint
pd.frameA = AGXObjectFactory::createFrame();
pd.rigidBodyA = agxLink->getAGXRigidBody();
agx::PlaneJointRef pj = AGXObjectFactory::createConstraintPlaneJoint(pd);
getAGXBody()->getAGXScene()->getSimulation()->add((agx::ConstraintRef)pj);
// Force enable collision between other links
agxLink->getAGXGeometry()->removeGroup(getAGXBody()->getCollisionGroupName());
// Disable collision between tracks
agxLink->getAGXGeometry()->addGroup(trackCollsionGroupName.str());
}
}
示例10: main
int main(int argc, char *argv[]) {
bool error = false;
uint8_t buffer[256];
uint16_t bufferSize = 256;
StreamParser p(streamReader, buffer, bufferSize, handlers, 1, NULL);
while(p.parse() >= 0);
int16_t theInt = 400;
float theFloat = 213423.23466432;
uint16_t functionID = 1;
char *stri = (char *)"hello world";
uint8_t indexTable[] = { Object::T_UINT16, Object::T_INT16, Object::T_STRING, Object::T_FLOAT, Object::T_INT32, Object::T_INT64, (uint8_t)(strlen(stri) + 1) };
Object o(indexTable, 6);
uint8_t dataBuffer[o.getDataSize()];
o.setDataBuffer(dataBuffer);
o.uint16At(0, functionID); //function id
o.int16At(1, theInt); //payload argument
o.strAt(2, stri, strlen(stri) + 1);
if(!o.floatAt(3, theFloat)) {
printf("Failed to set float value\n");
}
o.int32At(4, 345589619);
o.int64At(5, 9384760934765065ll);
if(o.int64At(5) != 9384760934765065ll) {
printf("Retrieved int64 does not equal actual A:%lld, R:%lld\n", (long long int)9384760934765065ll, (long long int)o.int64At(5));
}
if(o.int32At(4) != 345589619) {
printf("Retrieved int32 does not equal actual\n");
}
if(o.floatAt(3) != theFloat) {
printf("Retrieved float does not equal actual A:%f, R:%f\n", theFloat, o.floatAt(3));
}
if(o.int16At(1) != theInt) {
printf("Retrieved int does not equal actual A:%d R:%d\n", theInt, o.int16At(1));
}
StreamParser::PacketHeader ph = StreamParser::makePacket(16, o.getSize());
printf("generated packet: ");
printHex(&ph, sizeof(ph));
o.writeTo(writer, NULL);
printf("\n");
testBuffer = ((uint8_t *)(&ph));
testBufferSize = sizeof(StreamParser::PacketHeader);
testBufferIndex = 0;
printf("rpc call: ");
if(rpc.call(10, "cCds", -10, 10, 320, "hello world") <= 0) {
printf("error doing rpc call");
}
printf("\n");
if(error) {
printf("FAIELD: Object & RPC buffer tests\n");
} else {
printf("PASSED: Object & RPC buffer tests\n");
}
printf("Calling socket tests\n");
socketTest();
printf("PASSED: Socket Tests\n");
}
示例11: switch
//! called if an event happened.
bool MainMenu::onEvent(const NEvent& event)
{
if (isEnabled())
{
switch(event.EventType)
{
case sEventGui:
switch(event.GuiEvent.EventType)
{
case guiElementFocusLost:
if (event.GuiEvent.Caller == this && !isMyChild(event.GuiEvent.Element))
{
closeAllSubMenus_();
setHoverIndex_( -1 );
}
break;
case guiElementFocused:
if (event.GuiEvent.Caller == this )
{
bringToFront();
}
break;
default:
break;
}
break;
case sEventMouse:
switch(event.MouseEvent.Event)
{
case mouseLbtnPressed:
{
if (!getEnvironment()->hasFocus(this))
{
getEnvironment()->setFocus(this);
}
bringToFront();
Point p(event.MouseEvent.getPosition() );
bool shouldCloseSubMenu = hasOpenSubMenu_();
if (!getAbsoluteClippingRect().isPointInside(p))
{
shouldCloseSubMenu = false;
}
isHighlighted_( event.MouseEvent.getPosition(), true);
if ( shouldCloseSubMenu )
{
getEnvironment()->removeFocus(this);
}
return true;
}
case mouseLbtnRelease:
{
Point p(event.MouseEvent.getPosition() );
if (!getAbsoluteClippingRect().isPointInside(p))
{
int t = sendClick_(p);
if ((t==0 || t==1) && isFocused())
removeFocus();
}
return true;
}
case mouseMoved:
{
if (getEnvironment()->hasFocus(this) && getHoveredIndex() >= 0)
{
int oldHighLighted = getHoveredIndex();
isHighlighted_( event.MouseEvent.getPosition(), true);
if ( getHoveredIndex() < 0 )
{
setHoverIndex_( oldHighLighted ); // keep last hightlight active when moving outside the area
}
}
return true;
}
default:
break;
}
break;
default:
break;
}
}
return Widget::onEvent(event);
}
示例12: p
void toPieChart::paintEvent(QPaintEvent *)
{
QPainter p(this);
paintChart(&p, QRect(0, 0, width(), height()));
}
示例13: main
int main()
{
GetPsig p("test");
}
示例14: p
void Particle::setThreeMomentum(const double px, const double py, const double pz)
{
ThreeVector p(px, py, pz);
this->setThreeMomentum(p);
}
示例15: p
// fix shadowing problem in OS X
void MainWindow::paintEvent( QPaintEvent *event)
{
QPainter p( this );
p.setCompositionMode( QPainter::CompositionMode_Clear );
p.fillRect( this->rect(), Qt::transparent );
}