本文整理汇总了C++中GLWidget::width方法的典型用法代码示例。如果您正苦于以下问题:C++ GLWidget::width方法的具体用法?C++ GLWidget::width怎么用?C++ GLWidget::width使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GLWidget
的用法示例。
在下文中一共展示了GLWidget::width方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GLWidget_width
/** int QWidget::width()
* bind/QWidget.h:14
*/
static int GLWidget_width(lua_State *L) {
try {
GLWidget *self = *((GLWidget **)dub_checksdata(L, 1, "mimas.GLWidget"));
lua_pushnumber(L, self->width());
return 1;
} catch (std::exception &e) {
lua_pushfstring(L, "width: %s", e.what());
} catch (...) {
lua_pushfstring(L, "width: Unknown exception");
}
return dub_error(L);
}
示例2: QMainWindow
/*---------------------------------------------------------------------------*/
MainWindow::MainWindow( QWidget* pParent ):
QMainWindow( pParent )
{
CreateMenu( );
GLWidget* pGLWidget = new GLWidget( this );
connect( pGLWidget, SIGNAL( ToggleFullScreen( ) ),
this, SLOT( ToggleFullScreen( ) ) );
setCentralWidget( pGLWidget );
resize( pGLWidget->width( ), pGLWidget->height( ) + menuBar( )->height( ) );
setWindowTitle( tr( "Color cube example" ) ); // 设置窗口标题
}
示例3: qttextlabeltest
int qttextlabeltest(int argc, char *argv[])
{
// Set up the default format for our GL contexts.
QGLFormat defaultFormat = QGLFormat::defaultFormat();
defaultFormat.setSampleBuffers(true);
QGLFormat::setDefaultFormat(defaultFormat);
// Create and show widget
QApplication app(argc, argv);
GLWidget widget;
widget.setGeometry(10, 10, 500, 500);
widget.show();
// Create scene
GeometryNode *geometry = new GeometryNode;
widget.renderer().scene().rootNode().addChild(geometry);
// Add a small sphere at the origin for reference:
SphereGeometry *spheres = new SphereGeometry;
spheres->addSphere(Vector3f::Zero(), Vector3ub(128, 128, 128), 0.1f);
geometry->addDrawable(spheres);
// Default text property:
TextProperties tprop;
// Test alignment:
TextLabel3D *l3 = NULL;
TextLabel2D *l2 = NULL;
// 3D:
tprop.setColorRgb(255, 0, 0);
tprop.setAlign(TextProperties::HLeft, TextProperties::VTop);
l3 = new TextLabel3D;
l3->setText("Upper Left Anchor");
l3->setAnchor(Vector3f::Zero());
l3->setTextProperties(tprop);
geometry->addDrawable(l3);
tprop.setColorRgb(0, 255, 0);
tprop.setAlign(TextProperties::HLeft, TextProperties::VBottom);
l3 = new TextLabel3D;
l3->setText("Bottom Left Anchor");
l3->setAnchor(Vector3f::Zero());
l3->setTextProperties(tprop);
geometry->addDrawable(l3);
tprop.setColorRgb(0, 0, 255);
tprop.setAlign(TextProperties::HRight, TextProperties::VTop);
l3 = new TextLabel3D;
l3->setText("Upper Right Anchor");
l3->setAnchor(Vector3f::Zero());
l3->setTextProperties(tprop);
geometry->addDrawable(l3);
tprop.setColorRgb(255, 255, 0);
tprop.setAlign(TextProperties::HRight, TextProperties::VBottom);
l3 = new TextLabel3D;
l3->setText("Bottom Right Anchor");
l3->setAnchor(Vector3f::Zero());
l3->setTextProperties(tprop);
geometry->addDrawable(l3);
tprop.setColorRgba(255, 255, 255, 220);
tprop.setRotationDegreesCW(90.f);
tprop.setAlign(TextProperties::HCenter, TextProperties::VCenter);
l3 = new TextLabel3D;
l3->setText("Centered Anchor (3D)");
l3->setAnchor(Vector3f::Zero());
l3->setTextProperties(tprop);
l3->setRenderPass(Avogadro::Rendering::TranslucentPass);
geometry->addDrawable(l3);
tprop.setRotationDegreesCW(0.f);
tprop.setAlpha(255);
// 2D:
tprop.setColorRgb(255, 0, 0);
tprop.setAlign(TextProperties::HLeft, TextProperties::VTop);
l2 = new TextLabel2D;
l2->setText("Upper Left Corner");
l2->setAnchor(Vector2i(0, widget.height()));
l2->setTextProperties(tprop);
geometry->addDrawable(l2);
tprop.setColorRgb(0, 255, 0);
tprop.setAlign(TextProperties::HLeft, TextProperties::VBottom);
l2 = new TextLabel2D;
l2->setText("Bottom Left Corner");
l2->setAnchor(Vector2i(0, 0));
l2->setTextProperties(tprop);
geometry->addDrawable(l2);
tprop.setColorRgb(0, 0, 255);
tprop.setAlign(TextProperties::HRight, TextProperties::VTop);
l2 = new TextLabel2D;
l2->setText("Upper Right Corner");
l2->setAnchor(Vector2i(widget.width(), widget.height()));
l2->setTextProperties(tprop);
geometry->addDrawable(l2);
tprop.setColorRgb(255, 255, 0);
//.........这里部分代码省略.........