Go back to Richel Bilderbeek's homepage.

Go back to Richel Bilderbeek's C++ page.

 

 

 

 

 

(C++) Qt QGraphicsProxyWidget example 1

 

QGraphicsProxyWidget example 1 is a QGraphicsProxyWidget example.

 

 

 

 

 

 

Technical facts

 

Application type(s)

Operating system(s) or programming environment(s)

IDE(s):

Project type:

C++ standard:

Compiler(s):

Libraries used:

 

 

 

 

 

Qt project file: CppQGraphicsProxyWidgetExample1.pro

 

QT       += core
QT       += gui
QMAKE_CXXFLAGS += -Wextra -Werror
TARGET = CppQGraphicsProxyWidgetExample1
CONFIG   += console
CONFIG   -= app_bundle
TEMPLATE = app
SOURCES += main.cpp

 

 

 

 

 

main.cpp

 

#include <QApplication>
#include <QGraphicsProxyWidget>
#include <QGraphicsScene>
#include <QGraphicsView>
#include <QLineEdit>

int main(int argc, char **argv)
{
  //Create the application
  QApplication app(argc, argv);

  //Create the Qt Graphics Framework components
  QGraphicsScene scene;
  QGraphicsView view(&scene);
  view.setGeometry(100,100,400,200);
  view.show();

  //Create a QWidget
  QLineEdit *const edit = new QLineEdit;
  //Add the QWidget and obtain its proxy
  QGraphicsProxyWidget * const proxy = scene.addWidget(edit);
  //Modify the widget by using its proxy
  proxy->setScale(2.0);
  proxy->setRotation(30);

  return app.exec();
}

 

 

 

 

 

Go back to Richel Bilderbeek's C++ page.

Go back to Richel Bilderbeek's homepage.

 

Valid XHTML 1.0 Strict

This page has been created by the tool CodeToHtml