(C++) QGraphicsProxyWidget example 1
February 24, 2017 · View on GitHub
(C++)
QGraphicsProxyWidget example 1
QGraphicsProxyWidget example 1 is a QGraphicsProxyWidget example.
View a screenshot of
'CppQGraphicsProxyWidgetExample1' (png)
View a screenshot of
'CppQGraphicsProxyWidgetExample1' (png)
Download the Qt Creator project
'CppQGraphicsProxyWidgetExample1' (zip)
Download the Windows executable of
'CppQGraphicsProxyWidgetExample1' (zip)
Technical facts
Operating system(s) or programming environment(s)
Lubuntu 12.10 (quantal)
Qt Creator 2.5.2
- G++ 4.7.2
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(); }