Important: Please read the Qt Code of Conduct -

Basic no IDE howto ?

  • I am converting a product from a completely different UI manager.
    I am trying to come as close as possible to replacing the fundimental API's with the equivaent QT API's
    The entire QUI is abstracted into a product specific set of Graphics API's implimented in a single source file.

    All i really need is to be able to initialize Qt,
    create the basic window/canvas/framework objects that are the highest level
    Place Lines, text, bitmaps into those
    and push the window/canvas/framework onto the display.

    Is there are really really basic Qt C/C++ example, that shows this ?
    For this particular application I am not looking for a UI, I am looking for the least amount of code needed to do the
    simplest hopefully with nothing more than C++ code and linking libraries

  • Moderators

    Hard to say much without more info (what is current implementation written in? What do you mean by UI manager? etc.).

    Basically, if you want to create a qmake project, it should be enough for a start to get into your current project dir and type:
    qmake -projetct

    Then it all depends on what your project is based on. Qt provides HTML5 canvas APIs, QPainter raster APIs, QGraphicsView, QtWidgets, Qt QUICK 1 & 2, software and OpenGL... all can be used, but which should be depends on what you need :)

  • The project is an HMI that works on a number of embedded platforms and RTOS's. It is currently using an different graphic framework - PEGPro. We have our own "Designer". That works using an existing Graphics abstraction layer. Graphics is only a tiny part of this application.
    I do not want and can not use - atleast not initially much of Qt.
    I am just looking to write a Qt specific version of the Graphics abstraction layer.

    Basically the layout, as well as myriads of other non-graphics related aspects are created in an independent standalone widows App (that probably also should be converted to Qt at some point, but that is not my task). That is all saved into a configuration file that is transfered to the embedded device, which interprets that configuration to perform numerous functions a small fraction of which are relatively primative graphics operations, and those are performed inside a simple graphics abstraction layer.

    I need to initialize Qt. Create several of whatever the basic object that Qt draws to, render text, bitmaps, and lines, into that basic object, and then display it. The entire abstraction layer is only a couple of hundred lines of code, and is dirt simple.
    At some later point I may be very interested in more sophisticated operations, but right now I am just looking to create the Qt version of that abstraction layer.

    So i am looking for an example using the most basic Qt.
    The Critical Abstraction layer API's I must impliment are
    Initialize() - whatever Qt needs to be happy.
    ShowWindow() - a window is the only container in the abstraction API, but there may be multiple windows. This may correspond to a couple of Qt objects.
    BeginDraw() - start drawing in a window
    The layout is absolute coordinates.
    That is pretty much it.
    My proof of concept implimentation is under X11 Linux - i already have our App running using PEGPro.
    I want to code a simple Qt version of the Graphics layer, build it and get it working under Qt.

    There are many facets and features of Qt that may interest in the future - but not until I can demonstrate it with minimal changes to the existing App.
    My next step will be getting Qt versions working under other RTOS's.
    But I am not that worried about that.

  • Some further information.
    The main application is written in C++, but it is really started life as a standard C app, and there is very little 00 at this time.

  • Moderators

    I'd look at using a QPainter on a QImage. QPainter should provide all the primitives that you're looking to do. A QImage can be painted upon and then save()'d to a byte array in a number of common formats, which could be handed to whatever display mechanism you want.

  • thanks; that sounds like a start.

    Any idea where I might find a really simple example ?

    Most of the examples i am finding are using things like listboxes, editable text boxes, buttons, etc.
    I have no input or anykind that is tied to Qt.

    To make sure I am understanding,
    QImage is the object you draw into, and separately that you push to the display.
    QPainter, is essentially an Object/API that has methods/functions for primitives.
    Then I need to overload save()? to push the QImage to the display.
    Correct ?

Log in to reply